#include <bits/stdc++.h>
using namespace std;
int sum(string s) {
  int a = 0;
  for (int i = 0; i < s.length(); i++) {
    a += (s[i] - '0');
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  string s = to_string(n);
  while (sum(s) % 4 != 0) {
    n++;
    s = to_string(n);
  }
  cout << n;
}
