#include "bits/stdc++.h"
using namespace std;
int n;
bool check(int x) {
int res = 0;
while (x) {
int t = x % 10;
res += t;
x /= 10;
}
return res % 4 == 0;
}
int main() {
cin >> n;
while(!check(n)) n ++;
cout << n << '\n';
return 0;
}