#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair <int,int>
#define F first
#define S second
#define ever (;;)
const int N = 200100;
int n,x,a[N],ans;
ll t,sum,cum[N];
pair < ll , ll > p;
bool calc(pair < ll , ll > p)
{
p.F %= sum;
p.S %= sum;
if( p.F <= p.S )
return t >= p.F && t <= p.S;
return t >= p.F || t <= p.S;
}
int main()
{
scanf("%d%d%lld",&n,&x,&t);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum += a[i];
cum[i] = cum[i-1] + a[i];
}
sum += x;
t %= sum;
for(int i=1;i<=n+1;i++)
{
p.F = cum[i-1]+1;
p.S = p.F + x - 1;
ans += calc(p);
}
printf("%d\n",ans);
}
Copy