#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.flush();
  int a, b;
  cin >> a;
  b = a;
  int sum = 0;
  while (a > 0) {
    sum += a % 10;
    a /= 10;
  }
  if (sum % 4 == 0) {
    cout << b;
    return 0;
  }
  int c = b;
  int d = b;
  while (1) {
    int sumc = 0, sumd = 0;
    ++c;
    int ctemp = c;
    int dtemp = d;
    while (ctemp > 0) {
      sumc += ctemp % 10;
      ctemp /= 10;
    }
    if (sumc % 4 == 0) {
      b = c;
      break;
    }
  }
  cout << b;
}
