- 希望下次见到这种题能一眼看出来生成函数
- mod非质数只能用卢卡斯
#include<bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(false) ,cin.tie(0), cout.tie(0);
//#pragma GCC optimize(3,"Ofast","inline")
#define ll long long
#define li __int128_t
//#define int long long
const int N = 3e6 + 5;
const int M = 1e6 + 5;
const int mod = 998244353;
const ll LNF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
int a[N];
int c[105][105];
ll C(ll n,ll m){
if(n<m)return 0;
if(n<10)return c[n][m];
return C(n%2,m%2)*C(n/2,m/2)%2;
}
int main() {
c[0][0] = 1;
for ( int i = 1; i <= 10; ++ i ) {
c[i][0] = 1;
for ( int j = 1; j <= i; ++ j ) {
c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 2;
}
}
int n, t, k;
cin >> n >> t >> k;
for ( int i = 0; i < n; ++ i ) cin >> a[i];
ll ans = 0;
for ( int i = 0; i <= t; ++ i ) {
ans +=(a[(i + k - 1 ) % n] * C(t, i));
ans %= 2;
}
cout << ans << endl;
return 0;
}