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