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