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