#include <bits/stdc++.h>
using namespace std;
stringstream ss;
string s;
long long n, k, i, sum;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  k = n;
  while (true) {
    ss.clear();
    ss << k;
    ss >> s;
    sum = 0;
    for (i = 0; i < s.size(); i++) sum += s[i] - 48;
    if (sum % 4 == 0) {
      cout << s << endl;
      return 0;
    }
    k++;
  }
  return 0;
}
