#include <bits/stdc++.h>
using namespace std;
int getSum(string str) {
  int ans = 0;
  for (auto c : str) ans += c - '0';
  return ans;
}
int main() {
  int n = 0;
  cin >> n;
  while (getSum(to_string(n)) % 4) n++;
  cout << n;
  return 0;
}
