#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int m = n;
  int co = 0;
  for (int i = n;; i++) {
    int j = i;
    co = 0;
    while (j != 0) {
      co += j % 10;
      j = j / 10;
    }
    if (co % 4 == 0) {
      cout << i << endl;
      return 0;
    }
  }
}
