#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  scanf("%d", &n);
  int i;
  int sum = 0, a, same;
  for (i = n; 1; i++) {
    same = i;
    a = 0;
    while (same) {
      a = same % 10;
      sum += a;
      same /= 10;
    }
    if (sum % 4 == 0) {
      cout << i << endl;
      return 0;
    }
    sum = 0;
  }
  return 0;
}
