#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        ll x,n;
        cin>>x>>n;
        ll y=100ll;
        x+=y;
        ll g=gcd(x,y);
        x/=g;
        y/=g;
        vector <bool> vis(x,false);
        for(int i=1;i<x;i++){
            if((x*i)/y<x){
                vis[(x*i)/y]=true;
            }
        }
        vector <ll> a;
        for(int i=1;i<x;i++){
            if(vis[i]==false){
                a.push_back(i);
            }
        }
        ll m=a.size();
        ll pos=(n-1ll)%m;
        ll ans=(n-1ll)/m;
        ans*=x;
        ans+=a[pos];
        cout<<ans<<"\n";
    }
    return 0;
}
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define li long long
#define pii pair<int, int>
#define vi vector<int>
#define li long long

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

map<li, int> m;

int main() {
	int n;
	scanf("%d", &n);
	li cur = 0;
	m[0]++;
	li ans = 0;
	forn(i, n) {
		int x;
		scanf("%d", &x);
		if (i % 2 == 0) {
			cur += x;
		} else {
			cur -= x;
		}
		ans += m[cur];
		m[cur]++;
	}
	cout << ans;
}