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