시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 468 57 40 16.598%

문제

숫자 m개가 주어지며, 각 숫자를 ni라고 한다. (1 ≤ i ≤ m)

이때, 모든 i에 대해서, 연속하는 소수 ni개의 합으로 나타낼 수 있는 가장 작은 소수를 찾는 프로그램을 작성하시오.

예를 들어, m = 2, n1 = 3, n2 = 5인 경우에 정답은 83이다. (83 = 23 + 29 + 31 = 11 + 13 + 17 + 19 + 23)

입력

첫째 줄에 테스트 케이스의 개수가 주어진다. 각 테스트 케이스의 첫째 줄에는 1 ≤ m ≤ 10 이 주어진다. 둘째 줄에는 ni가 주어진다. (1 ≤ ni ≤ 104)

항상 정답은 107보다 작다.

출력

각 테스트 케이스마다 "Scenario i:"를 출력하고, 둘째 줄에 정답을 출력한다.

예제 입력 1

2
2
3 5
3
3 5 7

예제 출력 1

Scenario 1:
83

Scenario 2:
311
W3sicHJvYmxlbV9pZCI6Ijc1MTIiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1ZjBcdWMxOGRcdWQ1NThcdWIyOTQgXHVjMThjXHVjMjE4XHVjNzU4IFx1ZDU2OSIsImRlc2NyaXB0aW9uIjoiPHA+XHVjMjJiXHVjNzkwIG1cdWFjMWNcdWFjMDAgXHVjOGZjXHVjNWI0XHVjOWMwXHViYTcwLCBcdWFjMDEgXHVjMjJiXHVjNzkwXHViOTdjIG48c3ViPmk8XC9zdWI+XHViNzdjXHVhY2UwIFx1ZDU1Y1x1YjJlNC4gKDEgJmxlOyBpICZsZTsgbSk8XC9wPlxyXG5cclxuPHA+XHVjNzc0XHViNTRjLCBcdWJhYThcdWI0ZTAgaVx1YzVkMCBcdWIzMDBcdWQ1NzRcdWMxMWMsIFx1YzVmMFx1YzE4ZFx1ZDU1OFx1YjI5NCBcdWMxOGNcdWMyMTggbjxzdWI+aTxcL3N1Yj5cdWFjMWNcdWM3NTggXHVkNTY5XHVjNzNjXHViODVjIFx1YjA5OFx1ZDBjM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