#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int C;
cin >> C;
while (C--)
{
int N;
cin >> N; //펜스 갯수 입력
vector<int> fence;
for (int i = 0; i < N; i++) //펜스 크기 입력
{
int temp;
cin >> temp;
fence.push_back(temp);
}
int result = 0; //결과값
for (int i = 0; i < N; i++) //모든 펜스 탐색
{
int right = 0, left = 0; //right: 오른쪽에 위치한 펜스의 크기가 크거나 같다면 증가
//left: 왼쪽에 위치한 펜스의 크기가 크거나 같다면 증가
for (int j = i + 1; j < N; j++) //오른쪽의 펜스 크기 탐색
{
if (fence[i] <= fence[j])
right++;
else
break;
}
for (int j = i - 1; j >= 0; j--) //왼쪽의 펜스 크기 탐색
{
if (fence[i] <= fence[j])
left++;
else
break;
}
int tempResult = fence[i] * (left + right + 1); //현재 펜스 기준 결과값 저장
if (tempResult > result) //크기가 크다면 결과값으로 저장
result = tempResult;
}
cout << result << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKICAgIGludCBDOwogICAgY2luID4+IEM7CgogICAgd2hpbGUgKEMtLSkKICAgIHsKICAgICAgICBpbnQgTjsKICAgICAgICBjaW4gPj4gTjsgICAgICAgICAgICAgICAgICAgICAgIC8v7Y6c7IqkIOqwr+yImCDsnoXroKUKCiAgICAgICAgdmVjdG9yPGludD4gZmVuY2U7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspICAgICAvL+2OnOyKpCDtgazquLAg7J6F66ClCiAgICAgICAgewogICAgICAgICAgICBpbnQgdGVtcDsKICAgICAgICAgICAgY2luID4+IHRlbXA7CiAgICAgICAgICAgIGZlbmNlLnB1c2hfYmFjayh0ZW1wKTsKICAgICAgICB9CgogICAgICAgIGludCByZXN1bHQgPSAwOyAgICAgICAgICAgICAgICAgLy/qsrDqs7zqsJIKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgICAgIC8v66qo65OgIO2OnOyKpCDtg5Dsg4kKICAgICAgICB7CiAgICAgICAgICAgIGludCByaWdodCA9IDAsIGxlZnQgPSAwOyAgICAgICAgICAgIC8vcmlnaHQ6IOyYpOuluOyqveyXkCDsnITsuZjtlZwg7Y6c7Iqk7J2YIO2BrOq4sOqwgCDtgazqsbDrgpgg6rCZ64uk66m0IOymneqwgAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xlZnQ6IOyZvOyqveyXkCDsnITsuZjtlZwg7Y6c7Iqk7J2YIO2BrOq4sOqwgCDtgazqsbDrgpgg6rCZ64uk66m0IOymneqwgAogICAgICAgICAgICBmb3IgKGludCBqID0gaSArIDE7IGogPCBOOyBqKyspICAgICAvL+yYpOuluOyqveydmCDtjpzsiqQg7YGs6riwIO2DkOyDiQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZiAoZmVuY2VbaV0gPD0gZmVuY2Vbal0pCiAgICAgICAgICAgICAgICAgICAgcmlnaHQrKzsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBmb3IgKGludCBqID0gaSAtIDE7IGogPj0gMDsgai0tKSAgICAvL+yZvOyqveydmCDtjpzsiqQg7YGs6riwIO2DkOyDiQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZiAoZmVuY2VbaV0gPD0gZmVuY2Vbal0pCiAgICAgICAgICAgICAgICAgICAgbGVmdCsrOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGludCB0ZW1wUmVzdWx0ID0gZmVuY2VbaV0gKiAobGVmdCArIHJpZ2h0ICsgMSk7IC8v7ZiE7J6sIO2OnOyKpCDquLDspIAg6rKw6rO86rCSIOyggOyepQogICAgICAgICAgICBpZiAodGVtcFJlc3VsdCA+IHJlc3VsdCkgICAgICAgICAgICAgICAgICAgICAgICAvL+2BrOq4sOqwgCDtgazri6TrqbQg6rKw6rO86rCS7Jy866GcIOyggOyepQogICAgICAgICAgICAgICAgcmVzdWx0ID0gdGVtcFJlc3VsdDsKICAgICAgICB9CiAgICAgICAgY291dCA8PCByZXN1bHQgPDwgZW5kbDsKICAgIH0KICAgIHJldHVybiAwOwp9