#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int a, b, c;
  scanf("%d", &n);
  if (n > 996) {
    printf("1003\n");
    return 0;
  }
  if (n <= 99) {
    while (1) {
      a = n / 10 % 10;
      b = n % 10;
      if ((a + b) % 4 == 0) {
        printf("%d\n", a * 10 + b);
        break;
      }
      n++;
      if (n >= 100) goto out;
    }
  } else {
  out:
    while (1) {
      a = n / 100;
      b = n / 10 % 10;
      c = n % 10;
      if ((a + b + c) % 4 == 0) {
        printf("%d\n", a * 100 + b * 10 + c);
        break;
      }
      n++;
    }
  }
  return 0;
}
