// Slow solution for problem C // Author: Grzegorz Guspiel // O(n^2 log M) #include #include using namespace std; #define REP(i, n) for (int i = 0; i < int(n); i++) typedef long long LL; LL euclid(LL a, LL b) { while (a) { b %= a; swap(a, b); } return b; } int ig; int main() { int z; ig = scanf("%d", &z); while (z--) { int n; ig = scanf("%d", &n); LL t[n]; REP (i, n) ig = scanf("%lld", &t[i]); LL best = 1; REP (i, n) { LL cnt = 0; LL gcd = 0; for (int j = i; j < n; j++) { cnt++; gcd = euclid(gcd, t[j]); best = max(best, gcd * cnt); } } printf("%lld\n", best); } return 0; }