#include <bits/stdc++.h>
using namespace std;
bool b2(const pair<pair<int, int>, int> &p1,
        const pair<pair<int, int>, int> &p2) {
  return p1.first.first > p2.first.first;
}
bool b1(const pair<pair<int, int>, int> &p1,
        const pair<pair<int, int>, int> &p2) {
  return p1.first.second < p2.first.second;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int scal(int a) {
  int sum = 0;
  while (a > 0) {
    sum += a % 10;
    a = a / 10;
  }
  return sum;
}
int main() {
  int a;
  cin >> a;
  int sum = 0;
  for (int i = 0; i <= 20; i++) {
    if (scal(a + i) % 4 == 0) {
      cout << a + i << endl;
      break;
    }
  }
  return 0;
}
