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