#include <bits/stdc++.h>
using namespace std;
bool interes(int x) {
  int ans = 0;
  while (x) {
    ans += x % 10;
    x /= 10;
  }
  return ans % 4 == 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  while (!interes(n)) {
    n++;
  }
  cout << n << endl;
}
