#include <bits/stdc++.h>
using namespace std;
int sc(int n) {
  int s = 0;
  do {
    s += n % 10;
    n /= 10;
  } while (n != 0);
  return s;
}
int main() {
  int n, t;
  bool gata = false;
  cin >> n;
  t = n;
  do {
    if (sc(t) % 4 == 0)
      gata = true;
    else
      t++;
  } while (not gata);
  cout << t;
  return 0;
}
