Scholomance Academy
时间限制:C/C++/Rust/Pascal 10秒,其他语言20秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Toilet-Ares finds a paper on the ground of Scholomance Academy, which says





Note that is the number of positive integer which is smaller than  and co-prime with . In particular .

Now Toilet-Ares wonders, when given  and , what the value of  modulo  is supposed to be.

Of couse, Toilet-Ares who is phoning you, don't know how to solve this problem. Can you help him calculate the answer?

输入描述:

The first line contains three integers  .

The second line contains  integers p_1,...,p_t. It is guaranteed that:
   · p_i is prime for all ;
   ·  for all ;
   · .

输出描述:

Output a single integer representing the answer.
示例1

输入

复制
1 3 1
2 3 5

输出

复制
7
示例2

输入

复制
2 3 1
2 3 5

输出

复制
42
示例3

输入

复制
25 2 5
37 101

输出

复制
910464559