#include <bits/stdc++.h>
using namespace std;
int n;
inline int solve(int x) {
  int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  if (solve(n) % 4 == 0) return printf("%d\n", n), 0;
  while (n++) {
    if (solve(n) % 4 == 0) {
      printf("%d", n);
      return 0;
    }
  }
  return 0;
}
