#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    long long int a, i, j, k, s = 0, l, n;
    cin >> a;
    n = a;
    while (1) {
      s = 0;
      while (n) {
        l = n % 10;
        n = n / 10;
        s += l;
      }
      if (s % 4 == 0) {
        cout << a << '\n';
        break;
      } else {
        a++;
        n = a;
      }
    }
  }
}
