Logo
(追記) (追記ここまで)

18172번 - Be Geeks! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB245714825.397%

문제

The musical band Be Geeks! got its name by no accident, as all the members are genuine math geeks. Among others, they love examining various properties of number sequences. Let’s see an example of their subject of interest.

  • Let A be a nonempty sequence of positive integers, A = (a1, a2, ..., aN).
  • Let G(i, j) = gcd(ai, ai+1, . . . , aj), where 1 ≤ i ≤ j ≤ N.
  • Let M(i, j) = max(ai, ai+1, . . . , aj), where 1 ≤ i ≤ j ≤ N.
  • Let P(i, j) = G(i, j) · M(i, j), where 1 ≤ i ≤ j ≤ N.
  • Let F(A) = ΣP(i, j) over all pairs of integers 1 ≤ i ≤ j ≤ N.

The function gcd stands for the greatest common divisor of the given values. The greatest common divisor of a nonempty sequence of integers is the biggest integer which divides each integer in the sequence evenly.

입력

The first line contains one integer N (1 ≤ N ≤ 2 · 105). The next line contains N integers a1, a2, . . . , aN (1 ≤ ai ≤ 109).

출력

Print the value of F(A) modulo 1 000 000 007.

제한

예제 입력 1

4
1 2 3 4

예제 출력 1

50

예제 입력 2

5
2 4 6 12 3

예제 출력 2

457

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2019 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /