#include <bits/stdc++.h>
using namespace std;
int su(int n) {
  int r, sum = 0;
  while (n != 0) {
    r = n % 10;
    sum = sum + r;
    n = n / 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  int k = n;
  int i = 0;
  while (i != 10) {
    int d = su(k + i);
    if (d % 4 == 0) {
      cout << k + i << endl;
      break;
    }
    i++;
  }
}
