#include <bits/stdc++.h>
using namespace std;
int digit(int a) {
  int t = 0;
  while (a > 0) {
    t += a % 10;
    a = a / 10;
  }
  return t;
}
int main() {
  int a;
  cin >> a;
  if (digit(a) % 4 == 0) {
    cout << a << endl;
    return 0;
  }
  for (int i = a + 1; 1; i++)
    if (digit(i) % 4 == 0) {
      cout << i << endl;
      return 0;
    }
}
