CF696C.PLEASE
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's heart is under the middle cup.

Then at one turn Barney swaps the cup in the middle with any of other two cups randomly (he choses each with equal probability), so the chosen cup becomes the middle one. Game lasts n turns and Barney independently choses a cup to swap with the middle one within each turn, and the key always remains in the cup it was at the start.
After n-th turn Barney asks a girl to guess which cup contains the key. The girl points to the middle one but Barney was distracted while making turns and doesn't know if the key is under the middle cup. That's why he asked you to tell him the probability that girl guessed right.
Number n of game turns can be extremely large, that's why Barney did not give it to you. Instead he gave you an array _a_1, _a_2, ..., a__k such that

in other words, n is multiplication of all elements of the given array.
Because of precision difficulties, Barney asked you to tell him the answer as an irreducible fraction. In other words you need to find it as a fraction p / q such that
, where
is the greatest common divisor. Since p and q can be extremely large, you only need to find the remainders of dividing each of them by 109 + 7.
Please note that we want
of p and q to be 1, not
of their remainders after dividing by 109 + 7.
众所周知,巴尼的工作是“PLEASE”,因此他在工作中并没有太多事情可做。正因如此,他开始玩起了“杯子与钥匙”游戏。在这个游戏中,有三个完全相同的杯子从左到右排成一行。初始时,通往巴尼内心的钥匙位于中间的杯子下方。

接着,在每一轮中,巴尼随机选择左右两个杯子中的一个,将其与中间的杯子交换(每个杯子被选中的概率相等),于是被选中的杯子变为新的中间杯子。游戏共进行 $ n $ 轮;在每一轮中,巴尼独立地随机选择一个杯子与中间杯子交换;而钥匙始终保留在它最初所在的那个杯子中(即不随杯子移动,只随杯子位置变化而改变其所在位置)。
经过第 $ n $ 轮后,巴尼请一位女孩猜出钥匙在哪个杯子下。女孩指向了中间的杯子,但巴尼在操作过程中分心了,因此并不知道自己执行完所有操作后钥匙是否真的在中间杯子下方。所以他请你告诉他:女孩猜对的概率是多少。
游戏轮数 $ n $ 可能极大,因此巴尼并未直接将 $ n $ 告诉你。相反,他给了你一个数组 $ a_1,,a_2,,\dots,,a_k $,使得

换句话说,$ n $ 等于该数组所有元素的乘积。
由于精度问题,巴尼要求你以最简分数形式给出答案。即你需要将答案表示为分数 $ p/q $,满足 $ \gcd(p,,q) = 1 $,其中 $ \gcd(p,,q) $ 表示 $ p $ 与 $ q $ 的最大公约数。又由于 $ p $ 和 $ q $ 可能极大,你只需分别输出它们对 $ 10^9 + 7 $ 取模后的余数。
请注意:我们要求的是 $ p $ 和 $ q $ 本身的 $ \gcd $ 为 1,而不是它们对 $ 10^9 + 7 $ 取模后的余数的 $ \gcd $ 为 1。
输入格式
The first line of input contains a single integer k (1 ≤ k ≤ 105) — the number of elements in array Barney gave you.
The second line contains k integers _a_1, _a_2, ..., a__k (1 ≤ a__i ≤ 1018) — the elements of the array.
输入的第一行包含一个整数 k(1 ≤ k ≤ 105)—— 表示 Barney 给出的数组中元素的个数。
第二行包含 k 个整数 a1,a2,...,ak(1 ≤ ai ≤ 1018)—— 表示该数组的元素。
输出格式
In the only line of output print a single string x / y where x is the remainder of dividing p by 109 + 7 and y is the remainder of dividing q by 109 + 7.
在输出的唯一一行中,打印一个形如 x / y 的字符串,其中 x 是 p 除以 109+7 的余数,y 是 q 除以 109+7 的余数。
输入输出样例
输入#1
1 2
输出#1
1/2
输入#2
3 1 1 1
输出#2
0/1
输入解题思路,AI测评打分。不知道怎么写?