#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, i, x, y, z, s = 0;
  ;
  cin >> a;
  x = a;
  while (1) {
    s = 0;
    while (a > 0) {
      b = a % 10;
      s += b;
      a = a / 10;
    }
    if (s % 4 == 0) {
      cout << x << endl;
      break;
    } else
      x++;
    a = x;
  }
}
