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