#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  while (1) {
    int t = n, s = 0;
    while (t) s += t % 10, t /= 10;
    if (s % 4 == 0) return cout << n, 0;
    n++;
  }
  return 0;
}
