CF258C.Little Elephant and LCM

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Little Elephant loves the LCM (least common multiple) operation of a non-empty set of positive integers. The result of the LCM operation of kk positive integers x1,x2,...,xkx_{1},x_{2},...,x_{k} is the minimum positive integer that is divisible by each of numbers xix_{i} .

Let's assume that there is a sequence of integers b1,b2,...,bnb_{1},b_{2},...,b_{n} . Let's denote their LCMs as lcm(b1,b2,...,bn)lcm(b_{1},b_{2},...,b_{n}) and the maximum of them as max(b1,b2,...,bn)max(b_{1},b_{2},...,b_{n}) . The Little Elephant considers a sequence bb good, if lcm(b1,b2,...,bn)=max(b1,b2,...,bn)lcm(b_{1},b_{2},...,b_{n})=max(b_{1},b_{2},...,b_{n}) .

The Little Elephant has a sequence of integers a1,a2,...,ana_{1},a_{2},...,a_{n} . Help him find the number of good sequences of integers b1,b2,...,bnb_{1},b_{2},...,b_{n} , such that for all ii (1<=i<=n)(1<=i<=n) the following condition fulfills: 1<=bi<=ai1<=b_{i}<=a_{i} . As the answer can be rather large, print the remainder from dividing it by 10000000071000000007 (109+7)(10^{9}+7) .

输入格式

The first line contains a single positive integer nn (1<=n<=105)(1<=n<=10^{5}) — the number of integers in the sequence aa . The second line contains nn space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} (1<=ai<=105)(1<=a_{i}<=10^{5}) — sequence aa .

输出格式

In the single line print a single integer — the answer to the problem modulo 10000000071000000007 (109+7)(10^{9}+7) .

输入输出样例

  • 输入#1

    4
    1 4 3 2
    

    输出#1

    15
    
  • 输入#2

    2
    6 3
    

    输出#2

    13
    
首页