UOJ Logo 黑暗爆炸OJ

DARKBZOJ

#3481. DZY Loves Math III

Statistics 下载数据

Description

Input

Output

Sample Input

3
1
2
3
2
4
2

Sample Output

6

Hint


1<=N<=10,0<=Qi<=10^18,1<=Pi<=10^18,P>=2


本题仅四组数据。

Source

By Jc