#include <bits/stdc++.h>
using namespace std;
int sum(int a) {
  int s = 0;
  while (a) {
    s += a % 10;
    a /= 10;
  }
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a;
  cin >> a;
  while (true) {
    if (sum(a) % 4 == 0) {
      cout << a;
      break;
    }
    a++;
  }
  return 0;
}
