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