#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, ans = 0, a[1000006] = {0}, c = 0, t, n, sum = 0;
  cin >> k;
  n = k;
  for (i = k; i <= 1003; i++) {
    n = i;
    sum = 0;
    while (n > 0) {
      t = n % 10;
      sum += t;
      n /= 10;
    }
    if (sum % 4 == 0) {
      cout << i;
      break;
    }
  }
  return 0;
}
