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