QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#802066#7260. RopeshicgnliawAC ✓5ms4364kbC++14401b2024-12-07 11:43:512024-12-07 11:43:52

Judging History

你现在查看的是最新测评结果

  • [2024-12-07 11:43:52]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:4364kb
  • [2024-12-07 11:43:51]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+5;
const ll md = 1e9+7;
int n,a[N],s;
ll jc = 1,inv = md/2+1;
int main(){
	scanf("%d",&n);
	for(int i = 1;i<=n;i++){
		scanf("%d",&a[i]);
		s+=a[i]; 
		if(a[i]==3)jc = jc*inv%md;
	}
	if(s==(n-1)<<1){
		for(int i = 1;i<=n-2;i++)jc = jc*i%md;
		printf("%lld\n",jc);
	}else printf("0\n");
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3976kb

input:

9
1
3
2
1
3
1
2
1
2

output:

1260

result:

ok 1 number(s): "1260"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

9
1
2
1
1
3
2
1
3
2

output:

1260

result:

ok 1 number(s): "1260"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

5
3
3
3
3
3

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 5ms
memory: 4232kb

input:

100000
3
2
1
3
3
1
3
2
3
3
3
2
1
1
3
2
1
3
1
2
3
2
2
2
3
1
2
3
2
3
3
3
2
2
2
1
3
3
3
3
2
2
3
2
1
1
2
1
3
1
3
1
3
3
1
3
2
3
3
2
1
1
2
2
3
3
3
2
2
1
2
2
3
2
3
3
2
1
3
2
2
3
2
1
2
1
3
2
2
3
1
3
2
3
2
1
2
3
3
2
3
1
2
2
1
3
1
2
1
2
3
3
1
1
3
2
3
1
3
3
3
3
3
2
3
3
2
3
1
2
2
2
1
3
3
2
2
2
1
3
1
1
1
1
2
3
2...

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 4ms
memory: 4252kb

input:

100000
1
1
1
1
1
1
1
2
2
3
1
1
3
1
2
1
2
1
2
1
1
1
1
1
1
1
2
2
2
2
1
1
3
1
1
1
3
3
3
1
1
1
2
1
1
2
1
1
2
1
1
1
2
1
1
1
1
1
2
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
2
1
3
1
2
1
2
2
1
3
3
1
1
2
2
1
1
2
1
1
2
1
1
2
1
1
1
1
2
1
2
1
3
1
3
2
2
3
2
1
1
1
3
1
2
1
1
1
1
1
2
3
3
3
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 4ms
memory: 4116kb

input:

100000
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
1
3
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
3
1
1
1
1
1
2
1
1
2...

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 5ms
memory: 4252kb

input:

100000
2
3
1
2
3
2
2
2
2
2
2
2
1
3
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
1
3
2
2
3
2
1
2
2
2
2
3
2
2
1
2
2
2
2
2
2
2
3
1
2
1
3
1
2
2
2
1
2
3
1
2
2
3
2
3
2
2
2
2
2
3
3
2
2
1
3
2
2
2
2
2
3
2
2
2
1
1
3
2
3
2
2
1
3
1
2
3
2
3
2
2
2
2
2
2
2
2
2
1
2
1
3
2
2
2
3
2
2
2
2
3
1
3
3
2
2
2
1
2
3
2
2
2
3
3
1
2
2...

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 5ms
memory: 4180kb

input:

100000
2
2
3
3
3
1
1
2
1
2
3
1
3
1
1
2
3
1
3
1
3
1
2
2
1
2
3
1
3
2
2
1
3
3
3
1
2
3
3
3
2
3
3
2
2
3
1
3
3
3
1
2
3
3
1
1
3
3
2
2
1
2
2
3
1
3
2
3
1
3
1
3
1
3
1
1
3
3
3
3
2
3
3
2
1
1
1
2
1
3
1
3
1
2
2
2
3
3
3
2
3
1
3
2
3
3
3
3
2
2
1
1
2
2
3
2
2
1
2
3
1
3
3
1
1
3
1
3
3
2
1
3
3
2
2
3
3
2
2
1
1
1
2
3
3
1
3...

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 0ms
memory: 4232kb

input:

100000
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
2
2
1
1
1
2
2
1
1
1
1
2
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
2
1
3
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
3
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
2
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 4ms
memory: 4212kb

input:

100000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
3
1
1
1
1
1
3
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 4ms
memory: 4300kb

input:

100000
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
3
3
3
2
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
3
1
1
2
3
1
1
1
1
1
1
1
3
2
1
1
1
1
3
1
2
3
1
3
1
1
1
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
3...

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 2ms
memory: 4248kb

input:

100000
3
1
1
1
1
1
1
1
1
1
1
3
1
3
3
1
3
1
3
1
1
3
3
3
1
3
1
3
3
1
3
3
3
1
3
3
1
1
1
1
1
3
1
1
1
1
1
1
3
3
2
3
3
3
1
3
1
3
1
3
3
1
3
3
1
1
1
3
1
2
3
1
3
1
1
1
3
1
3
1
1
1
3
1
1
1
1
1
1
3
1
1
1
1
3
1
3
1
3
1
1
3
1
3
3
1
3
1
1
1
3
3
1
1
2
3
3
1
3
3
2
3
3
1
3
3
1
1
1
1
1
1
3
3
1
1
1
1
1
1
1
1
3
1
3
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 2ms
memory: 4200kb

input:

100000
1
3
1
1
1
1
3
1
1
2
1
1
1
3
2
1
3
1
3
3
2
2
3
2
2
2
3
1
3
3
3
1
1
1
3
2
2
2
1
1
2
3
1
1
1
1
1
1
3
2
2
1
3
2
1
1
1
1
1
1
1
3
1
2
1
2
3
1
1
1
3
3
2
1
1
2
2
2
2
1
1
1
1
1
1
3
3
1
1
1
1
1
1
2
1
2
3
2
2
1
1
3
1
1
1
1
2
2
2
1
1
1
1
3
2
1
1
1
3
3
1
1
1
2
1
3
1
2
3
1
1
2
1
2
1
1
1
2
1
1
1
1
2
1
1
3
2...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 0
Accepted
time: 5ms
memory: 4296kb

input:

100000
2
1
1
1
1
3
3
1
1
1
1
1
3
3
1
2
3
1
2
1
1
3
1
3
2
3
2
3
1
1
2
2
1
1
1
1
2
2
2
2
3
3
3
1
3
1
1
1
1
2
3
1
3
1
1
1
3
2
3
1
1
2
3
2
2
1
1
1
1
2
2
1
3
3
1
3
1
2
3
2
3
1
1
3
3
3
2
3
3
1
2
1
1
3
1
3
2
3
1
1
2
1
1
3
3
1
1
3
1
3
1
1
3
3
3
2
1
3
1
1
3
3
2
2
3
3
3
1
1
2
3
1
1
1
2
3
2
3
3
1
3
2
3
3
3
3
1...

output:

919886418

result:

ok 1 number(s): "919886418"

Test #15:

score: 0
Accepted
time: 5ms
memory: 4364kb

input:

100000
2
2
2
2
1
2
3
2
2
2
2
3
3
1
2
2
2
2
2
2
3
2
2
2
3
2
2
1
2
2
2
3
2
2
2
2
2
2
2
3
3
1
2
2
3
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
1
1
3
2
3
2
2
2
1
2
2
1
2
1
3
2
2
1
1
2
1
1
1
2
2
2
3
2
2
2
2
2
2
3
2
2
2
2
2
2
1
3
1
2
1
2
1
2
2
3
3
2
3
2
2
3
2
2
3
2
3
2
2
3
2
3
2
3
2
2
2
2
1
2
1
2
2
3
2
1...

output:

148292810

result:

ok 1 number(s): "148292810"

Test #16:

score: 0
Accepted
time: 5ms
memory: 4224kb

input:

100000
2
1
3
3
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
1
2
1
3
3
1
2
2
1
3
2
3
2
1
2
1
2
2
1
1
2
1
3
2
3
1
2
3
2
1
1
1
3
3
2
1
1
3
3
3
2
1
3
2
3
3
1
2
1
3
2
3
2
2
2
1
1
2
2
1
2
2
2
2
2
1
3
3
1
2
2
2
3
2
3
3
2
2
3
2
2
1
2
3
2
3
2
3
2
1
2
3
1
2
2
2
1
2
1
3
3
2
2
2
2
3
2
3
1
2
2
2
2
2
2
3
2
1
3
3
3
3
2
2
2
2
3
2...

output:

450813336

result:

ok 1 number(s): "450813336"

Test #17:

score: 0
Accepted
time: 5ms
memory: 4364kb

input:

100000
2
2
2
3
3
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

437199404

result:

ok 1 number(s): "437199404"

Test #18:

score: 0
Accepted
time: 5ms
memory: 4304kb

input:

100000
2
2
2
2
2
1
2
3
2
2
1
2
2
2
2
2
1
1
2
2
3
2
3
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
3
2
2
2
2
3
2
2
2
2
2
3
2
3
2
3
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2...

output:

834463090

result:

ok 1 number(s): "834463090"

Test #19:

score: 0
Accepted
time: 5ms
memory: 4224kb

input:

100000
2
1
2
1
3
1
1
3
2
3
3
1
2
2
1
2
2
1
2
2
2
3
2
1
3
2
3
1
2
1
2
2
1
2
2
2
3
3
2
2
3
3
2
1
2
2
2
3
2
3
2
3
1
2
3
3
2
1
3
2
2
2
3
2
2
2
1
2
1
2
3
1
2
2
2
1
2
2
3
2
2
2
2
1
2
2
3
2
2
2
1
2
2
2
3
3
2
2
2
2
2
2
2
2
2
2
3
2
1
2
2
1
2
2
3
2
1
2
3
2
3
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
3
1
3
2
2
3
2
1
3
2
2...

output:

464088820

result:

ok 1 number(s): "464088820"

Test #20:

score: 0
Accepted
time: 5ms
memory: 4364kb

input:

100000
3
1
3
3
3
3
2
3
2
3
2
1
3
2
1
2
2
1
1
2
2
2
3
2
2
2
3
3
1
2
2
1
2
2
1
3
1
2
3
1
1
1
2
2
3
2
3
3
3
3
2
2
2
3
2
2
2
3
3
3
2
2
2
2
2
3
3
2
2
2
2
2
3
1
2
1
2
1
3
2
2
2
2
2
2
2
3
2
3
2
3
1
1
3
3
2
3
1
1
3
3
1
3
2
1
3
2
3
3
3
2
2
1
2
1
2
2
2
1
1
2
2
1
2
3
3
2
2
2
2
2
3
1
2
2
2
2
2
1
2
2
3
2
2
2
2
1...

output:

658273751

result:

ok 1 number(s): "658273751"

Test #21:

score: 0
Accepted
time: 5ms
memory: 4232kb

input:

100000
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
3
2
3
1
2
2
2
2
3
2
2
2
2
2
3
2
2
3
2
2
2
3
2
2
3
3
2
2
2
2
2
2
2
1
3
2
2
1
3
2
1
2
2
2
2
2
2
2
3
2
2
1
2
2
2
2
2
2
2
1
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
3
2
2
1
2
2
3
3
2
3
3
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
1
3
3
2
2
3
2
2
2
1
3
2
2
2
2
2
2
2
2...

output:

749020002

result:

ok 1 number(s): "749020002"

Test #22:

score: 0
Accepted
time: 5ms
memory: 4320kb

input:

100000
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
3
1
2
3
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
3
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
1
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
3
2
2
2
2
3
2
2
2
3
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
1...

output:

126071466

result:

ok 1 number(s): "126071466"

Test #23:

score: 0
Accepted
time: 5ms
memory: 4316kb

input:

100000
3
1
1
3
1
3
2
1
3
1
3
1
1
3
3
3
1
3
1
1
1
3
2
1
3
1
1
3
1
3
3
1
1
3
2
1
3
3
1
1
3
3
1
1
1
1
1
1
2
1
2
1
3
2
1
1
1
1
1
1
1
3
3
3
1
1
3
1
2
2
3
1
3
1
3
1
2
3
3
2
3
2
1
3
3
3
3
2
1
3
3
3
3
1
1
3
3
3
3
3
3
2
3
1
2
2
1
1
3
3
1
3
3
2
1
3
2
1
3
1
1
3
1
3
3
3
1
2
3
2
1
1
1
1
1
1
3
3
3
1
3
2
3
3
3
3
2...

output:

815045464

result:

ok 1 number(s): "815045464"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3984kb

input:

1331
2
2
3
2
1
2
3
2
2
2
2
3
1
2
2
2
2
3
2
2
3
2
1
3
2
2
3
2
3
3
2
2
3
2
2
1
2
1
1
2
2
1
2
2
3
2
1
2
2
3
1
3
2
1
2
3
1
1
2
2
2
3
2
1
2
1
1
2
2
3
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
1
1
2
2
3
2
2
1
2
1
2
2
2
2
2
2
2
1
1
1
2
2
2
3
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
3
1
1
2
1
1
3
2
1
2
1
3
2
2
2
2
2
3
2...

output:

818233920

result:

ok 1 number(s): "818233920"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

385
1
1
2
2
2
1
2
3
3
1
1
2
2
3
2
1
3
2
2
2
3
2
3
2
1
3
3
1
2
2
3
3
3
1
2
3
2
3
1
2
2
3
2
3
3
1
1
3
2
1
1
3
3
1
2
3
1
1
2
1
1
1
2
3
1
3
2
2
2
2
1
3
1
2
2
1
1
1
3
2
3
3
1
1
3
2
2
3
2
1
1
3
1
3
3
1
3
3
2
3
3
3
1
2
2
3
3
2
3
2
3
2
1
1
3
2
2
2
3
3
1
2
1
3
1
3
3
2
2
3
3
3
1
1
3
3
1
3
2
3
2
1
3
1
2
1
1
3
...

output:

467384285

result:

ok 1 number(s): "467384285"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

2065
3
1
1
3
3
3
2
1
2
2
1
3
3
1
2
1
2
1
2
3
1
1
3
2
3
1
3
3
3
3
3
3
3
1
1
1
1
2
3
3
2
3
3
3
1
3
3
1
1
3
3
2
1
3
3
3
2
2
3
3
1
1
3
3
2
3
1
3
3
3
2
3
1
3
2
1
3
1
3
1
3
1
3
1
3
3
1
2
1
1
3
3
1
3
1
3
3
3
1
3
3
1
1
3
3
3
3
2
3
2
3
3
3
3
1
3
3
1
3
3
3
1
3
2
2
3
3
3
3
1
3
1
1
2
1
1
3
3
3
1
3
1
1
2
3
1
1
3...

output:

188426891

result:

ok 1 number(s): "188426891"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

43
1
3
1
1
1
1
2
1
2
3
3
3
1
3
2
1
1
3
2
2
3
2
2
3
3
1
1
3
1
1
1
3
3
3
1
1
3
1
1
2
2
3
3

output:

657497820

result:

ok 1 number(s): "657497820"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

561
2
3
3
1
1
2
1
1
2
1
1
2
2
2
2
2
3
2
3
1
3
1
1
1
2
2
2
2
1
2
1
1
1
2
2
3
2
2
1
3
2
1
3
2
1
1
1
1
1
2
2
2
2
1
2
1
1
3
1
2
1
2
1
1
1
2
3
2
3
3
1
2
2
2
2
2
3
1
1
1
3
3
2
1
2
3
3
2
3
3
2
2
2
3
2
1
2
1
2
1
2
1
2
2
3
2
2
2
3
2
1
2
2
3
3
1
3
2
2
2
3
2
3
3
3
2
3
2
1
1
3
1
2
3
2
1
1
3
2
1
1
1
3
3
1
1
1
2
...

output:

479845932

result:

ok 1 number(s): "479845932"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

2
1
2

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

7
1
1
3
3
1
1
2

output:

30

result:

ok 1 number(s): "30"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

130
2
1
2
2
3
2
2
1
2
1
2
3
3
2
2
1
1
3
3
1
2
1
2
3
2
1
2
2
3
1
2
1
2
3
2
1
2
2
2
2
2
1
1
3
3
1
2
1
2
2
2
2
1
2
3
1
1
3
2
3
1
3
3
3
1
1
2
1
2
1
3
3
2
2
2
1
1
2
3
1
2
1
2
1
2
2
2
2
2
3
3
3
2
2
3
3
2
3
1
3
2
3
2
1
1
1
1
2
3
2
2
1
2
1
2
3
1
2
2
2
3
2
3
2
3
3
2
2
2
3

output:

297870439

result:

ok 1 number(s): "297870439"

Test #32:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

8417
2
1
1
3
1
3
3
3
3
1
3
1
1
3
1
3
3
3
3
1
3
3
3
1
3
1
3
3
1
1
1
3
1
3
3
1
1
3
1
1
3
3
3
1
1
3
3
1
1
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
2
1
3
3
3
1
3
1
3
1
3
3
3
3
1
1
1
1
2
3
3
1
3
1
3
3
1
3
3
1
3
1
3
1
3
1
1
1
1
3
3
1
3
1
1
1
1
1
1
3
3
3
1
3
3
1
3
1
3
1
1
1
3
1
1
3
1
1
3
2
3
1
3
1
1
3
2
3...

output:

380707477

result:

ok 1 number(s): "380707477"

Test #33:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

6433
2
3
2
3
2
3
1
3
3
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2
3
1
2
2
2
3
2
2
3
2
2
3
3
3
1
2
2
3
1
2
3
2
2
2
2
1
2
2
2
3
2
2
2
2
2
2
2
2
1
3
2
2
1
1
1
2
2
2
2
1
2
2
2
1
2
2
3
2
3
1
2
3
3
3
3
2
2
2
2
2
1
3
3
1
2
1
2
1
2
2
2
2
1
3
1
2
1
2
2
2
3
2
3
1
3
2
2
3
2
2
3
2
2
2
2
2
2
3
3...

output:

30227426

result:

ok 1 number(s): "30227426"

Test #34:

score: 0
Accepted
time: 5ms
memory: 4220kb

input:

100000
3
1
3
1
1
1
3
1
3
3
3
3
1
1
1
1
3
1
3
1
3
3
1
3
3
1
1
1
1
3
1
1
1
1
3
3
1
1
3
1
1
1
3
1
1
1
3
3
3
1
3
1
1
1
3
3
3
3
1
3
1
3
1
1
1
1
3
1
1
1
3
3
1
1
3
1
1
1
1
1
3
1
3
1
3
3
3
1
1
1
3
3
1
3
1
3
1
3
3
3
3
3
3
3
3
1
3
3
3
1
1
3
1
1
3
1
1
3
1
3
1
1
3
3
1
3
3
1
3
1
3
1
3
1
1
3
1
3
1
3
1
1
1
3
1
3
1...

output:

320555407

result:

ok 1 number(s): "320555407"

Test #35:

score: 0
Accepted
time: 5ms
memory: 4180kb

input:

100000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

248941163

result:

ok 1 number(s): "248941163"