#include <bits/stdc++.h>
using namespace std;
int sod(int x) {
  int ret = 0;
  while (x > 0) {
    ret += (x % 10);
    x /= 10;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a;
  cin >> a;
  int temp = sod(a);
  while (temp % 4 != 0) {
    a++;
    temp = sod(a);
  }
  cout << a << endl;
}
