#include <bits/stdc++.h>
using namespace std;
int sum_of_dig(int n) {
  int sum = 0;
  while (n) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i <= 1000; i++)
    if (sum_of_dig(n + i) % 4 == 0) {
      cout << n + i << endl;
      break;
    }
}
