Tổng ước dãy


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 1G

Problem type

Cho dãy $a_1,a_2,...,a_N$. Hãy tính tổng $S= \sum_{i=1}^{N-1} \sum_{j=i}^{N} gcd(a_i,a_{i+1},...,a_j)$.

Dữ liệu

  • Dòng đầu tiên chứa hai số nguyên $N \ (0<N\le 10^5)$;
  • Dòng thứ hai chứa $N$ số nguyên $a_i \ (0<a_i\le 10^9)$.

Kết quả

  • Kết quả bài toán sau khi chia lấy dư cho $10^9+7$.

Ví dụ

Ví dụ 1

input

5
2 3 6 1 8

output

32

Comments

There are no comments at the moment.