#include <bits/stdc++.h>
using namespace std;
int sum_of_dig(int n) {
  int s = 0;
  while (n > 0) {
    s += n % 10;
    n /= 10;
  }
  return s;
}
int main() {
  int a;
  cin >> a;
  while (sum_of_dig(a) % 4 != 0) a++;
  cout << a;
}
