#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int ans = 0;
  while (1) {
    int t = a;
    ans = 0;
    while (t) {
      ans += t % 10;
      t /= 10;
    }
    if (ans % 4 == 0)
      break;
    else
      a++;
  }
  cout << a;
  return 0;
}
