#include <bits/stdc++.h>
using namespace std;
bool judge(int k) {
  int sum = 0;
  while (k) {
    sum += k % 10;
    k /= 10;
  }
  if (sum % 4 == 0) return true;
  return false;
}
int main() {
  int n;
  cin >> n;
  while (!judge(n)) n++;
  cout << n << endl;
  return 0;
}
