#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
bool is4(int a)
{
int res = 0;
string b = to_string(a);
int n = b.size();
for (int i = 0; i < n; i ++ )
{
res += b[i];
}
return res % 4 == 0;
}
int main()
{
int b;
cin >> b;
while (!is4(b))
{
b ++;
}
printf("%d", b);
return 0;
}