#include <bits/stdc++.h>
using namespace std;
long long int sumd(long long int n) {
  int m, sum = 0;
  while (n > 0) {
    m = n % 10;
    sum = sum + m;
    n = n / 10;
  }
  return sum;
}
void solve() {
  long long int n;
  cin >> n;
  while (1) {
    if (sumd(n) % 4 == 0) {
      cout << n;
      break;
    } else
      n++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
