2 1 1 1
5 3

21

2 2 0 0
5 2

0

## 代码

#include<cstdio>
#include<iostream>
#include<algorithm>
#define ll long long
#define mo 1000000007

using namespace std;

ll n, m, x, y, a[100001], Asum, Bsum, Esum, mi3, mi2, re, ***;
char c;

re = 0;
*** = 1;
c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') {
*** = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
re = re * 10 + c - '0';
c = getchar();
}
return re * ***;
}

bool cmp(ll x, ll y) {
return x > y;
}

ll ksm(ll x, ll y) {//快速幂
re = 1;
while (y) {
if (y & 1) re = (re * x) % mo;
x = (x * x) % mo;
y >>= 1;
}
return re;
}

int main() {
for (ll i = 1; i <= n; i++) a[i] = read();

mi3 = ksm(3, m);//预处理出翻的倍数
mi2 = ksm(2, m);

sort(a + 1, a + n + 1, cmp);//从大到小排序

for (ll i = 1; i <= x; i++)//最前面的（最大的）绩效为 A
Asum = (Asum + (a[i] * mi3) % mo) % mo;
for (ll i = x + 1; i <= x + y; i++)//接着（接着大的）就是绩效为 B
Bsum = (Bsum + (a[i] * mi2) % mo) % mo;
if (m < 2)//只有年数小于两年，这些 C 的才不会被开除，才要记录
for (ll i = x + y + 1; i <= n; i++)
Esum = (Esum + (a[i] * m) % mo) % mo;

printf("%lld", (Asum + Bsum + Esum) % mo);

return 0;
}