#include <bits/stdc++.h>
using namespace std;
int main() {
  int multiples[8] = {4, 8, 12, 16, 20, 24, 28, 32};
  int a;
  cin >> a;
  for (int i = 0; i < 10; i++) {
    int aa = a + i, sum = 0;
    while (aa) {
      sum += aa % 10;
      aa /= 10;
    }
    if (sum % 4 == 0) {
      cout << a + i;
      return 0;
    }
  }
}
