#include <bits/stdc++.h>
#define ll long long
#define N 1000001
#define base int(1e9+7)
using namespace std;
ll n,k,p;
ll a[N];
ll sum=0;
int main()
{
    freopen("tong.inp","r",stdin);
    freopen("tong.out","w",stdout);
    cin >> n >> k >> p;
    for (int i=0; i<n; i++)
    {
        cin >> a[i];
        sum = (sum + a[i]) % base;
    }
    int m = k / n;
    sum = sum * m;
    int x = k % n;
    p = (p-1) % n;
    for (int i=0;i<x;i++)
        sum = (sum + a[(p+i)%n]) % base;
    cout << sum;
    return 0;
}
