#include<bits/stdc++.h> usingnamespacestd; using ll = longlong;
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 107
int n, a[N];
inlineintsqr(int x){return x * x;}
inlineintcalc(int x){ int ans = 0; for (int i = 1; i <= n; ++i) ans += sqr(a[i] - x); return ans; }
intmain(){ n = rd(); for (int i = 1; i <= n; ++i) a[i] = rd(); int ans = 2e9; for (int w = -100; w <= 100; ++w) ans = min(ans, calc(w)); printf("%d\n", ans); return0; }
#include<bits/stdc++.h> usingnamespacestd; using ll = longlong;
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 100007
char s[N];
intmain(){ scanf("%s", s + 1); int n = strlen(s + 1); if (s[n - 1] == s[n]) {printf("%d %d\n", n - 1, n); return0;} for (int i = 1; i <= n - 2; ++i) { if (s[i] == s[i + 1]) {printf("%d %d\n", i, i + 1); return0;} if (s[i] == s[i + 2]) {printf("%d %d\n", i, i + 2); return0;} } puts("-1 -1"); return0; }
#include<bits/stdc++.h> usingnamespacestd; using ll = longlong;
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 407 #define mod 1000000007
int a[N], b[N], pw[N][N], f[N][N];
intmain(){ int n = rd(), c = rd(); for (int i = 1; i <= n; ++i) a[i] = rd(); for (int i = 1; i <= n; ++i) b[i] = rd(); for (int i = 1; i <= n; ++i) for (int j = a[i]; j <= b[i]; ++j) for (int t = 0, nw = 1; t <= c; ++t, nw = 1ll * nw * j % mod) pw[i][t] = (pw[i][t] + nw) % mod; f[0][0] = 1; for (int i = 1; i <= n; ++i) for (int j = 0; j <= c; ++j) for (int k = 0; k <= j; ++k) f[i][j] = (f[i][j] + 1ll * f[i - 1][j - k] * pw[i][k]) % mod; printf("%d\n", f[n][c]); return0; }