시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
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+XHVjNzc0IFx1YjU0YywgXHViYWE4XHViNGUwIGlcdWM1ZDAgXHViMzAwXHVkNTc0XHVjMTFjLCBcdWM1ZjBcdWMxOGRcdWQ1NThcdWIyOTQgXHVjMThjXHVjMjE4IG48c3ViPmk8XC9zdWI+XHVhYzFjXHVjNzU4IFx1ZDU2OVx1YzczY1x1Yjg1YyBcdWIwOThcdWQwYzBc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