#include <bits/stdc++.h>
using namespace std;
const int max_n = 100000 + 5;
int a;
int sum(int x) {
  int s = 0, t = x;
  while (t != 0) {
    s += (t % 10);
    t /= 10;
  }
  return s;
}
int main() {
  scanf("%d", &a);
  while (sum(a) % 4 != 0) a++;
  printf("%d\n", a);
  return 0;
}
