#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  while (true) {
    string str = std::to_string(n);
    int sum = 0;
    for (int i = 0; i < str.length(); i++) {
      sum += str[i] - '0';
    }
    if (sum % 4 == 0) {
      cout << str << endl;
      return 0;
    } else
      n++;
  }
  return 0;
}
