#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
bool check(int n){
string s=to_string(n);
int res=0;
for(auto c:s){
res += c-'0';
}
return res % 4 == 0;
}
int main(){
int n;
cin>>n;
while(!check(n)) n++;
cout<<n;
}