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