#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
int n, m, q;
bool ok(int x) {
  int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  if (res % 4 == 0) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  while (!ok(n)) ++n;
  printf("%d\n", n);
  return 0;
}
