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