Peru

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

This morning, Roxy found NN beetles on her desk. These beetles are numbered from 00 to N1N − 1 and each beetle ii has a strength S_iS\_i. Roxy wants to crush the beetles so she can do her math homework. In order to do this, she bought a special glove which she can use to hit a contiguous subsequence of KK beetles. If Roxy makes an effort EE, then those beetles whose strength S_iS\_i is smaller than or equal to EE will be crushed, while all others will remain unharmed. The crushed beetles maintain their positions on the desk. Roxy can use the glove as many times as she wants.

Roxy wants to know if you can compute the minimum total effort needed to crush the first ii beetles for each 1iN1 ≤ i ≤ N. Because there are too many numbers, Roxy agreed you should give her the result of the following expression: X_023N1+X_123N2++X_N1X\_0 · 23^{N−1} + X\_1 · 23^{N−2} + \dots + X\_{N−1} modulo 109+710^9 + 7, where X_iX\_i represents the minimum total effort to crush the first i+1i + 1 beetles.

제한

  • 1N2,500,0001 ≤ N ≤ 2\\,500\\,000
  • 1KN1 ≤ K ≤ N
  • 1S_i2,000,000,0001 ≤ S\_i ≤ 2\\,000\\,000\\,000