#include <bits/stdc++.h>
using namespace std;
int tong(int a) {
  int s = 0;
  while (a) {
    s += a % 10;
    a /= 10;
  }
  return s;
}
int main() {
  int n;
  cin >> n;
  for (int i = n; i <= 100000; i++) {
    if (tong(i) % 4 == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}
