#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int sum = 0, sum1 = 0, u = 0, p;
  int n = s.length();
  string x;
  for (int i = 0; i < n; i++) {
    sum += s[i];
  }
  p = stoi(s);
  if (sum % 4 == 0)
    cout << p;
  else {
    while (u == 0) {
      p++;
      x = to_string(p);
      for (int i = 0; i < x.length(); i++) {
        sum1 += x[i];
      }
      if (sum1 % 4 == 0) {
        u = 1;
        cout << p;
        break;
      } else
        sum1 = 0;
    }
  }
}
