![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <bits/stdc++.h> 2 #define _xx ios_base::sync_with_stdio(0);cin.tie(0); 3 #define INFS 0x3fffffff 4 #define INFB 0x3fffffffffffffff 5 #define pf printf 6 #define sf scanf 7 #define mem(a, b) memset(a, 0, sizeof a); 8 using namespace std; 9 typedef long long ll; 10 11 int main() 12 {_xx 13 ll n; 14 while(cin >> n) 15 { 16 ll ans = n*(n + 1)/2; 17 ans %= 10000; 18 ans = ans*ans%10000; 19 cout << setw(4) << setfill('0') << ans << endl; 20 } 21 return 0; 22 }