#include <bits/stdc++.h>

template <class T>
inline void read(T &x) {
	static char ch; 
	static bool opt; 
	while (!isdigit(ch = getchar()) && ch != '-'); 
	x = (opt = ch == '-') ? 0 : ch - '0'; 
	while (isdigit(ch = getchar()))
		x = x * 10 + ch - '0'; 
	if (opt)
		x = ~x + 1; 
}

template <class T>
inline void putint(T x) {
	static char buf[45], *tail = buf; 
	if (!x)
		putchar('0'); 
	else {
		if (x < 0)
			putchar('-'), x = ~x + 1; 
		for (; x; x /= 10) *++tail = x % 10 + '0'; 
		for (; tail != buf; --tail) putchar(*tail); 
	}
}

template <class T>
inline bool tense(T &x, const T &y) {
	return y < x ? x = y, true : false; 
}

template <class T>
inline bool relax(T &x, const T &y) {
	return x < y ? x = y, true : false; 
}

template <class T>
inline T getAbs(const T &x) {
	return x < 0 ? -x : x; 
}

typedef long long s64; 
typedef long double ld; 
typedef std::vector<int> vi; 
typedef std::pair<int, int> pii; 
#define mp(x, y) std::make_pair(x, y)

const int MaxN = 3e6 + 5; 

int n, a[MaxN]; 
s64 s[MaxN]; 

s64 ans; 
std::map<s64, int> cnt; 

int main() {
#ifdef orzczk
	freopen("a.in", "r", stdin); 
#endif

	read(n), cnt[s[0] = 0] = 1; 
	for (int i = 1; i <= n; ++i) {
		read(a[i]); 
		s[i] = s[i - 1] + (i & 1 ? -1 : 1) * a[i]; 

		ans += cnt[s[i]]++; 
	}

	std::cout << ans << '\n'; 

	return 0; 
}
#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 100010

ll i, i1, j, k, k1, t, n, m, res, flag[10], a[maxn], b[maxn];
ll m1, m2, l[maxn], r[maxn], bsl, bsm, bsu;

bool solve(ll bsm, ll fll) {
    ll i, sl, sr, k;
    sl = 0; sr = 0;
    for (i = 1; i <= n; i++) {
        l[i] = max((ll)0, (a[i] * m2 - bsm + m1 - 1) / m1);
        r[i] = min(m2, (a[i] * m2 + bsm) / m1);
        sl += l[i]; sr += r[i];
    }

    if (fll == 1) {
        k = m2;
        for (i = 1; i <= n; i++) {
            sl -= l[i]; sr -= r[i];
            b[i] = max(l[i], k - sr);
            b[i] = min(b[i], r[i]);
            k -= b[i];
        }
    }

    /* cout << "bsm = " << bsm << nl;
    for (i = 1; i <= n; i++) {
        cout << i _ l[i] _ r[i] << nl;
    } */

    for (i = 1; i <= n; i++) {
        if (l[i] > r[i]) return false;
    }

    if (m2 >= sl && m2 <= sr) return true;
    else return false;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n >> m1 >> m2;
    for (i = 1; i <= n; i++) {
        cin >> a[i];
    }

    bsl = 0; bsu = 3 * INF;
    while (bsl != bsu) {
        bsm = (bsl + bsu) / 2;
        if (solve(bsm, 0)) bsu = bsm;
        else bsl = bsm + 1;
    }

    solve(bsl, 1);
    for (i = 1; i <= n; i++) cout << b[i] << ' ';
    cout << nl;

    return 0;
}
