Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef map <int, int> mii;
- typedef pair <int, int> pii;
- typedef pair <ll, ll> pll;
- int const maxn = int(1e5 + 12);
- int const maxb = int(2e6 + 12);
- int const inf = int(1e9 + 7);
- ll const linf = ll(1e18 + 12);
- double const eps = 1e-7;
- double const pi = acos(-1);
- #ifdef _WIN32
- #define I64 "%I64d"
- #else
- #define I64 "%lld"
- #endif
- #define mp make_pair
- #define pb push_back
- #define F first
- #define S second
- #define next MyLittleNext
- //#define end MyLittleEnd
- #define all(x) x.begin(), x.end()
- #define fn "floyd_joke"
- int n;
- ll dist(ll a, ll b)
- {
- if (a == b)
- return 0;
- return (((a * b) % inf) * ((a + b) % inf)) % inf;
- }
- int main()
- {
- #ifdef fn
- freopen(fn ".in", "r", stdin);
- freopen(fn ".out", "w", stdout);
- #endif
- scanf("%d", &n);
- ll ans = 0;
- for (int i = 1; i <= n; i++)
- for (int j = 1; j <= n; j++)
- ans = (ans + min(dist(i, j), (dist(1, i) + dist(1, j)) % inf)) % inf;
- printf(I64, ans);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement