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