#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int p;
  cin >> p;
  while (1) {
    long long int n = p;
    long long int sum = 0;
    while (n) {
      sum += n % 10;
      n = n / 10;
    }
    long long int ans = sum % 4;
    if (ans == 0) {
      cout << p;
      break;
    } else {
      n = p + 1;
      p++;
    }
  }
}
