sum_{x_1 = 1}^{a_1} sum_{x_2 = 1}^{a_2} cdots sum_{x_n = 1}^{a_n} max{x_1, x_2, dots, x_n}
Given a1, a2, ..., an, find sum_{x_1 = 1}^{a_1} sum_{x_2 = 1}^{a_2} cdots sum_{x_n = 1}^{a_n} max{x_1, x_2, dots, x_n} ∑ x 1 =1 a 1 ∑ x 2 =1 a 2 ⋯∑ x n =1 a n max{x 1 ,x 2 ,…,x n } modulo (109+7).
(图片来源网络,侵删)