#include <bits/stdc++.h>
using namespace std;
int sum(int a) {
  int s = 0;
  while (a > 0) {
    s += (a % 10);
    a = a / 10;
  }
  return s;
}
int main() {
  int n, a, b;
  cin >> n;
  while (sum(n) % 4 != 0) {
    n++;
  }
  cout << n << endl;
  return 0;
}
