Pearl Chains
题目描述
[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=823&page=show_problem&problem=4451
[PDF](https://uva.onlinejudge.org/external/127/p12713.pdf)
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12713/8e6f5d344da98b50a0b85948e7a316c8a47babc8.png)
输入输出格式
输入格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12713/e7d7ff7298fe0cc9d932722711e0fbd34b94525e.png)
输出格式
![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12713/1263aa9b01ef62740197419b2deabb7954f2895c.png)
输入输出样例
输入样例 #1
5
1 1 1 1 1
2 3 1 1 1
1 1 1 2 1
10 10 10 10 10
100 100 100 100 100
输出样例 #1
3
25
5
77069
329672