#include <bits/stdc++.h>
int num(int x) {
  int a = 0, s = 0;
  while (x != 0) {
    a = x % 10;
    x = x / 10;
    s += a;
  }
  return s;
}
int num(int x);
int main() {
  int n, i, j;
  scanf("%d", &n);
  if (num(n) % 4 == 0)
    printf("%d\n", n);
  else {
    for (i = 1; i <= 6; i++) {
      n++;
      if (num(n) % 4 == 0) break;
    }
    printf("%d\n", n);
  }
  return 0;
}
