#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, n, sum = 0;
  cin >> n;
  x = n;
  for (;;) {
    sum = 0;
    while (n != 0) {
      sum = sum + n % 10;
      n = n / 10;
    }
    if (sum % 4 == 0) {
      n = x;
      break;
    } else {
      n = x + 1;
      x = n;
      continue;
    }
  }
  cout << n << endl;
}
