fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define ull unsigned long long
  5. #define endl '\n'
  6. #define pii pair<ll, ll>
  7. #define ff first
  8. #define ss second
  9. #define pb push_back
  10. #define mp make_pair
  11. #define trace1(x) cerr<<#x<<": "<<x<<endl
  12. #define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  13. #define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  14. #define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  15. #define trace5(a, b, c, d, e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  16. #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  17. #define traceloop(x,a) {for(ll i=0;i<x;i++) cerr<<a[i]<<" "; cerr<<endl;}
  18. ll ab(ll x) {return x>0LL?x:-x;}
  19. int sum(int n)
  20. { int ans=0;
  21. while(n>0)
  22. {
  23. ans+=n%10;
  24. n=n/10;
  25. }
  26. return ans;
  27. }
  28. int main()
  29. {
  30. ios::sync_with_stdio(0);
  31. cin.tie(0); cout.tie(0);
  32. int n;
  33. cin>>n;
  34. while(1)
  35. {
  36. int a = sum(n);
  37. if(a%4==0)
  38. {
  39. cout<<n;
  40. return 0;
  41. }
  42. n++;
  43. }
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 15232KB
stdin
1
stdout
4