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