#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, s = 0, p, r;
  cin >> n;
  p = n;
L:
  do {
    r = n % 10;
    n = n / 10;
    s = s + r;
  } while (n > 0);
  if (s % 4 == 0) {
    cout << p;
    return 0;
  } else {
    p++;
    n = p;
    s = 0;
    goto L;
  }
}
