#include<ctime>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<algorithm>
#define ll long long
using namespace std;
const double k=(sqrt(5)-1)/2;
const double t=k;
ll read(){
	char c;
	ll x=0,f=1;
	while(!isdigit(c=getchar()))
		f-=2*(c=='-');
	while(isdigit(c)){
		x=x*10+f*(c-48);
		c=getchar();
	}
	return x;
}
ll n,x,y,cnt,ans[1000];
void solve(){
	if(n==1){
		puts("1");
		puts("1");
		return;
	}
	ans[1]=3;
	for(ll i=max(0ll,(ll)(k*n-1000000));i<=min(n,(ll)(k*n+1000000));++i){
		x=i;
		cnt=1;
		y=n-x;
		while(x>=1&&y>=1){
			if(cnt>130)
				break;
			if(x>y){
				ans[++cnt]=3;
				x-=y;
			}
			else{
				ans[++cnt]=4;
				y-=x;
			}
		}
		while(x){
			if(cnt>130)
				break;
			--x;
			ans[++cnt]=1;
		}
		while(y){
			if(cnt>130)
				break;
			--y;
			ans[++cnt]=2;
		}
		if(cnt<=130)
			break;
	}
	printf("%lld\n",cnt);
	for(ll i=cnt;i;--i)
		printf("%lld\n",ans[i]);
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
	#endif
	clock_t t1=clock();
	//--------
	n=read();
	solve();
	//--------
	fprintf(stderr,"%0.3lfs",1.0*(clock()-t1)/CLOCKS_PER_SEC);
	return 0;
}

#include <cmath>
#include <cstdio>
#include <stack>
using namespace std;

int main() {
	long long N;
	scanf("%lld", &N);
	stack<int> ans;
	long long x, y;
	x = N;
	__float128 phi = (1 + sqrtf128((__float128)5)) / 2;
	y = (long long)(x / phi) + 1;
	for (; x != 0 || y != 0;) {
		if (y == 0) {
			ans.push(1);
			x--;
		} else if (x == 0) {
			ans.push(2);
			x--;
		} else if (x > y) {
			if ((y - 1) * phi > x) {
				ans.push(2);
				y--;
			} else {
				ans.push(3);
				x -= y;
			}
		} else {
			if ((x - 1) * phi > y) {
				ans.push(1);
				x--;
			} else {
				ans.push(4);
				y -= x;
			}
		}
	}
	printf("%lu\n", ans.size());
	x = 0;
	y = 0;
	for (; !ans.empty();) {
		printf("%d\n", ans.top());
		if (ans.top() == 1) x++;
		if (ans.top() == 2) y++;
		if (ans.top() == 3) x += y;
		if (ans.top() == 4) y += x;
		ans.pop();
	}
	fprintf(stderr, "%lld\n", x);
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = (1<<30)-1;
const int MOD = 1e9+7;
const ll LINF = (1ll<<62)-1;

#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";

int main(){
   int n;cin >> n;
   if(floor(n*1.08)<206)COUT("Yay!");
   else if(floor(n*1.08)==206)COUT("so-so");
   else COUT(":(");
}

/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 61;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[201][12];

void cmemoInit(){
    rep(i, 201){
        rep(j, 12){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
ll n;
vector<string> s;
vector<set<ll>> parents;
int main(void){
    cin >> n;
    s.resize(n);
    vector<string> rs(n, string(n, '0'));
    rep(i, n) cin >> s[i];
    rep(i, n){
        rep(j, n){
            if(s[i][j] == '1'){
                rs[j][i] = '1';
            }
        }
    }

    parents.resize(n);
    rep(i, n){
        queue<ll> q;
        vector<ll> visited(n, 0);
        visited[i] = 1;
        q.push(i);
        parents[i].insert(i);
        while(!q.empty()){
            ll now = q.front();
            q.pop();
            rep(j, n){
                if(visited[j]) continue;
                if(rs[now][j] == '1'){
                    parents[i].insert(j);
                    visited[j] = 1;
                    q.push(j);
                }
            }
        }
    }
    ld ans = 0;
    rep(i, n){
        ans += 1.0 / (ld)parents[i].size();
    }
    cout << fixed << setprecision(10) << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int t,n;
	cin >> t >> n;
	vector<int>arr;
	set<int>s;
	set<int>mods;
	int cur = 100+t;
	while(true){
		if(s.find(cur/100-1)==s.end()&&cur!=100+t){
			arr.push_back(cur/100-1);
		}
		if(cur%100==t&&cur!=100+t)break;
		s.insert(cur/100);
		cur+=100+t;
	}
	int repeat = (cur-100-t)/100;
	n--;
	for(int i = 0; i<arr.size(); i++){
		if(n%arr.size()==i){
			//cout << i << "\n";
			//cout << arr[i] << "\n";
			cout << repeat*(n/arr.size())+arr[i] << "\n";
			return 0;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int H, W;
    vector<string> S;
    void input() {
        cin >> H >> W;
        S.resize(H);
        REP(i, H) {
            cin >> S[i];
        }
    }
    void output() {
        int res = 0;
        REP(i, H) {
            REP(j, W) {
                if (S[i][j] == '#') continue;
                if (i < H - 1) {
                    if (S[i + 1][j] == '.') ++res;
                }
                if (j < W - 1) {
                    if (S[i][j + 1] == '.') ++res;
                }
            }
        }
        cout << res << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <algorithm>
#include <cmath>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> II;
typedef pair<LL, II> III;
typedef priority_queue<III, vector<III>, greater<>> Queue;
static const LL INF = 1LL << 60;

void solve(long long N, long long M, std::vector<long long>& w, std::vector<long long>& l, std::vector<long long>& v) {
	LL max_w = *max_element(w.begin(), w.end());
	LL min_allow = *min_element(v.begin(), v.end());
	if (max_w > min_allow) {
		cout << -1 << endl;
		return;
	}
	//	if (min_allow >= accumulate(w.begin(), w.end(), 0LL)) {
	//		cout << 0 << endl;
	//		return;
	//	}
	vector<II> vv;
	for (int i = 0; i < M; ++i) {
		vv.emplace_back(II(l[i], v[i]));
	}
	sort(vv.begin(), vv.end());
	map<LL, LL> m;
	m[0] = 0;
	LL mn = INF;
	for (LL i = M - 1; i >= 0; --i) {
		if (vv[i].second < mn) {
			mn = vv[i].second;
			m[mn] = vv[i].first;
		}
	}

	sort(w.rbegin(), w.rend());
	vector<int> seq(N);
	iota(seq.begin(), seq.end(), 0);

	LL ans = INF;
	do {
		vector<vector<LL>> dist(N, vector<LL>(N));
		vector<LL> pos(N);
		for (LL i = 1; i < N; ++i) {
			LL tot_w = w[seq[i]];
			for (LL j = i - 1; j >= 0; --j) {
				tot_w += w[seq[j]];
				auto x = m.lower_bound(tot_w);
				if (x == m.end()) --x;
				if (tot_w <= x->first) --x;
				dist[i][j] = dist[j][i] = -x->second;
			}
		}

		// Bellman-Ford
		vector<LL> costs(N);
		costs[0] = 0;
		for (int k = 0; k < N; ++k) {
			bool changed = false;
			for (int i = 0; i < N; ++i) {
				for (int j = i + 1; j < N; ++j) {
					LL cost = costs[i] + dist[i][j];
					if (costs[j] > cost) {
						changed = true;
						costs[j] = cost;
					}
				}
			}
			if (!changed) break;
		}
		ans = min(ans, -costs[N - 1]);
	} while (next_permutation(seq.begin() + 1, seq.end()));

	cout << ans << endl;
}

int main() {
	long long N, M;
	std::cin >> N >> M;
	std::vector<long long> w(N), l(M), v(M);
	for (int i = 0; i < N; i++) {
		std::cin >> w[i];
	}
	for (int i = 0; i < M; i++) {
		std::cin >> l[i] >> v[i];
	}
	solve(N, M, w, l, v);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
// --------------------------------------------------------
template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; }
#define FOR(i,l,r) for (ll i = (l); i < (r); ++i)
#define RFOR(i,l,r) for (ll i = (r)-1; (l) <= i; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define COUNT(c,v) count(ALL(c),(v))
#define SZ(c) ((ll)(c).size())
#define BIT(b,i) (((b)>>(i)) & 1)
#define PCNT(b) __builtin_popcountll(b)
#define CIN(c) cin >> (c)
#define COUT(c) cout << (c) << '\n'
#define debug(x) cerr << "l." << __LINE__ << " : " << #x << " = " << (x) << '\n'
ll llceil(ll a, ll b) { return (a + b - 1) / b; }
string toupper(const string& S) { string T(S); REP(i,SZ(T)) T[i] = toupper(T[i]); return T; }
string tolower(const string& S) { string T(S); REP(i,SZ(T)) T[i] = tolower(T[i]); return T; }
using P = pair<ll,ll>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VVS = vector<VS>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VVVLL = vector<VVLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VVVB = vector<VVB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VVVD = vector<VVD>;
using VLD = vector<ld>;
using VVLD = vector<VLD>;
using VVVLD = vector<VVLD>;
static const double EPS = 1e-10;
static const double PI  = acos(-1.0);
static const ll MOD = 1000000007;
// static const ll MOD = 998244353;
static const ll INF = (1LL << 62) - 1;  // 4611686018427387904 - 1
// --------------------------------------------------------
// #include <atcoder/all>
// using namespace atcoder;

// Editorial AC

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    ll N, M; cin >> N >> M;
    VLL w(N); REP(i,N) cin >> w[i];
    VLL l(M),v(M); REP(i,M) cin >> l[i] >> v[i];

    if (MAX(w) > MIN(v)) { COUT(-1); return 0; }

    VLL X(1<<N);
    REP(S,1<<N) if (PCNT(S) >= 2) {
        ll W = 0;
        REP(i,N) if (BIT(S,i)) W += w[i];
        REP(i,M) if (v[i] < W) chmax(X[S], l[i]);
    }

    ll ans = INF;
    VLL A(N); iota(ALL(A),0);
    VLL dp(N);
    do {
        fill(ALL(dp), 0);
        REP(s,N-1) {
            ll u1 = A[s];
            ll S = (1<<u1);
            FOR(t,s+1,N) {
                ll u2 = A[t];
                S |= (1<<u2);
                chmax(dp[t], dp[s] + X[S]);
            }
        }
        chmin(ans, dp[N-1]);
    } while (next_permutation(ALL(A)));
    assert(ans != INF);

    COUT(ans);

    return 0;
}


#include "bits/stdc++.h"
using namespace std;
int main()
{
    string s;
    cin >>s;

    reverse(s.begin(),s.end());

    for(const auto c:s)
    {
        if(c=='6')
        {
            cout<<"9";
        }
        else if(c=='9')
        {
            cout<<"6";
        }else{
            cout<<c;
        }
    }
}

#include <bits/stdc++.h>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}
template<class T> bool chmax(T& a, const T& b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T> bool chmin(T& a, const T& b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	map<char, char> M;
	M['0'] = '0';
	M['1'] = '1';
	M['6'] = '9';
	M['8'] = '8';
	M['9'] = '6';
	REPR(i, SZ(S)) {
		cout << M[S[i]];
	}
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define int long long
#define ld long double
#define ff first
#define ss second
#define BS binary_search
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define get(a, t) get<a>(t)
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;
double EPS = 1e-9;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};

#ifdef TESTING
#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define VALUE(x)
#define debug(...)
#endif
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define FOREACH(a, b) for (auto &(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
const int INF = 1e18;
const int N = 100005;
int mod = 1e9 + 7;
void solve()
{
    string s;
    cin >> s;
    if (s[1] == s[0] && s[1] == s[2])
    {
        cout << "Won" << endl;
    }
    else
    {
        cout << "Lost" << endl;
    }
}
int32_t main()
{
    IOS;
    //int t;cin >> t;
    int t = 1;
    for (int tc = 1; tc <= t; tc++)
    {
        //cout<<"Case #"<<tc<<": ";
        solve();
    }
    return 0;
}

#include<bits/stdc++.h>
#define ls(p) p<<1
#define rs(p) p<<1|1
#define de(x) cout<<#x<<" = "<<x<<endl;
#define rep(i,a,b) for(int i = (a);i<=(b);++i)
#define endl '\n'
#define PI acos(-1.0)
#define pb push_back
using namespace std;
void debug(){freopen("data.in","r",stdin);freopen("data.out","w",stdout);}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxn  = 1e5+10;

int main(){
	//debug();
	int v,t,s,d;
	cin>>v>>t>>s>>d;
	if(d < t * v || d > v * s) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
 long long N;
 cin >> N;

 vector<long long> A(N);

 for(int i = 0; i < N;i++){
  long long a = 0;
  cin >> a;
  A.at(i) = a;
 }
 sort(A.begin(), A.end());
 reverse(A.begin(),A.end());
 long long ans =0;

 for(int i = 0; i < N ;i++){
   ans += A.at(i)*((N-1)-2*i);
 }

 cout << ans <<endl;
}

///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define     FAST        ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     int 	    long long
#define 	pb 	        push_back
#define     pp          pop_back
#define 	mp 	        make_pair
#define 	pi 	        2*acos(0.0)
#define     scan(i)     scanf("%lld",&i)
#define     scann(i,j)  scanf("%lld%lld",&i,&j)
#define     print(i)    printf("%lld\n",i)
#define     printt(i,j) printf("%lld %lld\n",i,j)
#define     loop(i,n) 	for(int i = 0 ; i <n ; i++)
#define     loopp(i,n) 	for(int i = 1 ; i <n ; i++)
#define     rep(i,n)    for(int i=n-1;i>=0;i--)
#define     rev(v)      reverse(v.begin(),v.end())
#define     reset(a,b)  memset(a,b,sizeof(a))
#define 	vect 	    vector<int>
#define 	vec_it 	    vector<int>::reverse_iterator vi
#define     sorta(v)    sort(v.begin(),v.end())
#define     sortd(v)    sort(v.begin(),v.end(),greater<>())
#define     sorted(v)   is_sorted(v.begin(),v.end())
#define 	mapp 	    map<int,int>
#define     rmap        map<int,int,greater<>>m
#define 	pairr 	    pair<int,int>
#define 	sett	    set<int>
#define     rset        set<int,greater<>>s
#define 	set_it 	    set<int>::reverse_iterator si
#define     map_it      map<int,int> :: reverse_iterator mi
#define     digit(n)    floor(log10(n)+1)
#define 	yes 	    cout<<"Yes"<<endl
#define 	no 	        cout<<"No"<<endl
#define 	ff 	        first
#define 	ss 	        second
#define     mx          INT_MAX
#define     lmx         LLONG_MAX
#define     mn          INT_MIN
#define     lmn         LLONG_MIN
#define     inf         0x3f3f3f3f
#define     inff        10e18
#define     GCD         __gcd(a,b)
#define     LCM         (a/GCD)*b
template <typename T> T gcd(T a,T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
int modulo (int a, int b) { return a >= 0 ? a % b : ( b - abs ( a%b ) ) % b; }

void solve()
{
   // freopen ("(input).txt" , "r",  stdin) ;
    string st,stt;
    int low=0,high=0;
    int l,r; char ch;
    int n,k,t,x,y,z,d=0,cnt=0,temp=0,sum=0,f=0,flag=0;
    cin>>n ; vect v(n) ,a ; sett s ; mapp m,mm ; pairr p ;
    loop(i,n) cin>>v[i];
    sorta(v);
    int dp[n+1];
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        dp[i]=(v[i]-v[i-1])*i+dp[i-1];
        sum+=dp[i];
    }
    cout<<sum<<endl;

}

main()
{
    int t;
  //  cin>>t;
  //  while(t--)
        solve();
}


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

typedef long long ll;
const int N=2e5+5;

int res=INT_MIN,a[N],mark[N],m,n;
vector<int> adj[N];

void dfs(int u){
  for(int v: adj[u]){
    if(mark[v]==INT_MIN)dfs(v);
    mark[u]=max(mark[u],mark[v]);
    res = max(res,mark[u]-a[u]);
  }
  mark[u]=max(a[u],mark[u]);
}

int main() {
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;++i){
    scanf("%d",&a[i]);
    mark[i]=INT_MIN;
  }
  while(m--){
    int u,v;
    scanf("%d%d",&u,&v);
    adj[u].push_back(v);
  }
  for(int i=1;i<=n;++i)if(mark[i]==INT_MIN){
    dfs(i);
  }
  cout << res;
}

#include <bits/stdc++.h>

#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(12)
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
#define sbc __builtin_popcount
#define pb push_back
#define pbk pop_back
#define em emplace
#define emb emplace_back
#define ff first
#define ss second
#define ll long long
const ll mod = 1e9 + 7;

template<typename T> void smax(T& a, T b) { if(a<b) a=b; }
template<typename T> void smin(T& a, T b) { if(a>b) a=b; }
template<typename T> T pw(T a,T b) { T p=1,one=1; while(b) { if(b&one) p=p*a; a=a*a; b >>=1; } return p; }
template<typename T> T pwm(T a,T b,T md=mod) { T p=1,one=1; while(b) { if(b&one) p=p*a%md; a=a*a%md; b >>=1; } return p; }

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (auto &it:v)
        is >> it;
    return is;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &it) {
    os << it.first << ' ' << it.second;
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const array<T, 2> &v) {
    for (auto &it : v) os << it << ' ';
    return os;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (auto &it : v)
        os << it << ' ';
    return os;
}

#ifndef ONLINE_JUDGE
class Timer { chrono::high_resolution_clock::time_point start_t, end_t; public: Timer() { start_t=chrono::high_resolution_clock::now(); } ~Timer() { end_t = chrono::high_resolution_clock::now(); auto duration = chrono::duration_cast<chrono::milliseconds>(end_t-start_t); cerr<<"\nRunTime: "<<duration.count()<<"ms"<<'\n'; } };
void debug() { cerr << '\n'; }

template<typename T, typename... Args>
void debug(T print, Args... args) {
    cerr << ' ' << print;
    debug(args...);
}

#define deb(...) cerr << "[" << #__VA_ARGS__ << "]" << " --> ", debug(__VA_ARGS__)
#else
#define deb(...) void(0)
#endif
void solve() {
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	int a[n],mx[n];
	for(int i=0;i<n;++i) {
		cin>>a[i];
		mx[i]=-1;
	}
	for(int i=0,x,y;i<m;++i) {
		cin>>x>>y, --x, --y;
		g[y].pb(x);
	}
	for(int i=0;i<n;++i)
		deb(a[i]),deb(g[i]);
	int ans=INT_MIN;
	for(int i=n-1;~i;--i) {
		int val=a[i];
		if(~mx[i]) {
			smax(val,mx[i]);
			smax(ans,mx[i]-a[i]);
		}
		for(const auto& j:g[i])
			smax(mx[j], val);
	}
	cout<<ans<<'\n';
}
int main() {
    speedup;
    //int t; cin >> t; while (t--)
	solve();
}
/**Vim
 *
 *
 *
 *
 *
 *
 *
 *
 */


#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, x, n) for(int i = x; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
    int N;
    string S;
    cin >> N >> S;

    int ans = 0;
    for(int i = 0; i < N - 1; i++) {
        int a = 0, t = 0, g = 0, c = 0;
        switch(S[i]) {
        case 'A':
            a++;
            break;
        case 'T':
            t++;
            break;
        case 'G':
            g++;
            break;
        case 'C':
            c++;
            break;
        }

        for(int j = i + 1; j < N; j++) {
            switch(S[j]) {
            case 'A':
                a++;
                break;
            case 'T':
                t++;
                break;
            case 'G':
                g++;
                break;
            case 'C':
                c++;
                break;
            }
            if(a == t && g == c)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
std::istream& operator>>(std::istream& is, mint& a) { return is >> a.x;}
std::ostream& operator<<(std::ostream& os, const mint& a) { return os << a.x;}

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

std::string n;
ll K;

ll dig( char ch ) {
  if( ch >= '0' && ch <= '9' )
    return ch-'0';
  else
    return ch-'A'+10;
}

combination comb( 200010 );
mint inc[20][200010], po[20][200010];

int main() {
  std::cin >> n >> K;

  ll N = n.size();

  rep( i, 20 ) {
    po[i][0] = 1;

    rep( j, N+5 )
      po[i][j+1] = po[i][j]*i;
  }

  rep( a, K+1 ) rep( b, N+1 ) {
    /*mint sign = 1;

    repi( k, K-a, 16-a+1 ) {
      inc[a][b] += sign*comb(b,k)*comb(16-a,k)*po[16][b-k];
      sign *= -1;
    }*/

    repi( k, a, K+1 ) {
      inc[a][b] += comb(K-a, k-a)*po[k][b]*((K-k)&1 ? -1 : 1);
    }

    inc[a][b] *= comb(16-a, K-a);
  }

  ll bit = 0;
  mint ans = 0;

  rep( i, N ) {
    ll x = dig(n[i]);
    ll k = __builtin_popcountll(bit&((1ll<<x)-1));
    ll l = __builtin_popcountll(bit);

    bit |= 1ll<<x;

    if( !i ) {
      --x;

      if( bit&1 )
        --k;
    }

    ans += inc[l][N-i-1]*k;
    ans += inc[l+1][N-i-1]*(x-k);

    if( i )
      ans += inc[1][i-1]*15;
  }

  if( __builtin_popcountll(bit) == K )
    ans += 1;

  std::cout << ans << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repx(i, x, n) for (ll i = (ll)(x); i < (ll)(n); i++)
#define repr(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define reprx(i, x, n) for (ll i = ((ll)(n)-1); i >= (ll)(x); i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((ll)(x).size())
#define submit(x) {cout<<x<<endl; return 0;}
#define X first
#define Y second
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T>bool chmax(T &a,T b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a,T b) {if (b<a) {a=b; return 1;} return 0;}
template<class T>long long ip(T a, T b) {bitset<60> s(b); long long val=1; for(int i=0;i<60;i++){if(s.test(i))val*=a; a*=a;} return val;}
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 1LL << 60;
const double PI = 3.1415926535897932;

ll n;
VV<ll> par;

bool solve(ll mid) {
  set<ll> s;
  rep(i,n) {
    ll tmp = 0;
    rep(j,5) {
      if (par[i][j] >= mid) tmp += (1<<j);
    }
    s.insert(tmp);
  }
  for (auto x : s)  for (auto y : s)  for (auto z : s) {
    if ((x | y | z) == 31) return true;
  }
  return false;
}

int main() {
  cin>>n;
  par.assign(n,V<ll>(5));
  rep(i,n) rep(j,5) cin>>par[i][j];
  ll right = 1000000001;
  ll left = 0;
  ll mid = (right + left) / 2;
  while (right - left > 1) {
    if (solve(mid)) left = mid;
    else right = mid;
    mid = (right + left) / 2;
  }
  submit(left)
}

#include <bits/stdc++.h>
        #include <math.h>

        using namespace std;
        typedef long long ll;
        typedef unsigned long long ull;
        # define M_PI  3.14159265358979323846

        const int M=1e9+7;
        long long mod(long long x){
            return ((x%M + M)%M);
        }
        long long add(long long a, long long b){
            return mod(mod(a)+mod(b));
        }
        long long mul(long long a, long long b){
            return mod(mod(a)*mod(b));
        }

        ll modPow(ll a, ll b){
            if(b==0)
                return 1LL;
            if(b==1)
                return a%M;
            ll res=1;
            while(b){
                if(b%2==1)
                    res=mul(res,a);
                a=mul(a,a);
                b=b/2;
            }
            return res;
        }

        void solve (){
            ll n;
            cin>>n;
            n=2*n;
            ll ans=0;
            for(ll i=1;i*i<=n;i++){
                if(n%i==0){
                    ll f1=i;
                    ll f2=n/i;
                    if((f2+1-f1)%2==0) ans++;
                    if(n/i != i){
                    ll f1=n/i;
                    ll f2=i;
                    if((f2+1-f1)%2==0) ans++;
                    }
                }
            }
            cout<<ans;
        }
        int main(){
            ios::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            cout<<fixed;
            cout<<setprecision(10);
    //        freopen("timber_input.txt", "r", stdin);
    //        freopen("timber_output.txt", "w", stdout);
            int t=1;
            // cin>>t;
            for(int i=1;i<=t;i++){
            //    cout<<"Case #"<<i<<": ";
                solve();
            }
            return 0;
        }


#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<ll, ll>
using namespace std;

int main(){
  int n; cin >> n;
  vector<vector<P> > v(n + 1);
  vector<P> v2(n + 1, P(1e18, -1e18));
  rep(i, n){
    ll x, c; cin >> x >> c;
    v2[c].first = min(v2[c].first, x);
    v2[c].second = max(v2[c].second, x);
  }
  rep(i, n){
    if(v2[i + 1].first == 1e18) continue;
    v[i + 1].push_back(P(v2[i + 1].first, 1e18));
    v[i + 1].push_back(P(v2[i + 1].second, 1e18));
  }
  v[0].push_back(P(0, 0));
  for(int i = 0; i < n; i++){
    // cout << i << endl;
    if(v[i + 1].size() == 0){
      v[i + 1] = v[i];
      continue;
    }
    for(auto& now: v[i]){
      ll nowx = now.first, nowv = now.second;
      ll l = v[i + 1][0].first, r = v[i + 1][v[i + 1].size() - 1].first;
      for(auto& next: v[i + 1]){
        ll nextx = next.first;
        ll nextv = nowv;
        if(nowx < l){
          nextv += r - nowx + r - nextx;
        }
        else if(nowx > r){
          nextv += nowx - l + nextx - l;
        }
        else{
          nextv += r - l;
          if(nextx < nowx){
            nextv += abs(r - nowx) + abs(l - nextx);
          }
          else{
            nextv += abs(l - nowx) + abs(r - nextx);
          }
        }
        next.second = min(next.second, nextv);
      }
    }
    // cout << "------" << i+1 << "-------" << endl;
    // for(auto& e: v[i+1]){
    //   cout << e.first << " , " << e.second << endl;
    // }
  }
  ll ans = 1e18;
  for(auto& e: v[n]){
    ans = min(ans, e.second + abs(e.first));
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<pair <int, int>, null_type,less<pair <int, int>>, rb_tree_tag,tree_order_statistics_node_update>

const int MAXN = 3e5 + 20, MAXM = 16e4 + 5, MOD = 1e9 + 7, SQ = 450;
const long long INF = 1e9 + 10;
int l[MAXN], r[MAXN];
long long dp[MAXN][2];

void solve() {
	int n;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		l[i] = INF;
		r[i] = -INF;
	}

	vector <int> id;
	l[0] = 0;
	r[0] = 0;
	l[n + 1] = 0;
	r[n + 1] = 0;
	id.push_back(0);
	id.push_back(n + 1);
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;

		l[y] = min(x, l[y]);
		r[y] = max(x, r[y]);

		id.push_back(y);
	}

	sort(id.begin(), id.end());
	id.resize(unique(id.begin(), id.end()) - id.begin());

	int t = id.size();
	dp[0][0] = 0;
	dp[0][1] = 0;
	for (int i = 1; i < id.size(); i++) {
		dp[i][0] = dp[i - 1][1] + abs(r[id[i - 1]] - r[id[i]]) + abs(r[id[i]] - l[id[i]]);
		dp[i][0] = min(dp[i - 1][0] + abs(l[id[i - 1]] - r[id[i]]) + abs(r[id[i]] - l[id[i]]), dp[i][0]);
		dp[i][1] = dp[i - 1][1] + abs(r[id[i - 1]] - l[id[i]]) + abs(r[id[i]] - l[id[i]]);
		dp[i][1] = min(dp[i - 1][0] + abs(l[id[i - 1]] - l[id[i]]) + abs(r[id[i]] - l[id[i]]), dp[i][1]);
	}

	cout << min(dp[t - 1][0], dp[t - 1][1]) << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int q = 1;
//	cin >> q;
	while (q--) {
		solve();
	}
}


#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <queue>

#define	INF   1010101010LL
#define INFLL 1010101010101010101LL

using namespace std;

//const int mod = 1000000007;
//const int mod = 998244353;

class BIT {
public:
	BIT(int n) : a(n) {}

	void add(int p, long long num)
	{
		while (p < a.size()) {
			a[p] += num;
			p |= p + 1;
		}
	}

	/* i から j までの和 [i, j] */
	long long sum(int i, int j)
	{
		long long s = 0, t = 0;
		i--;
		while (i >= 0) {
			s += a[i];
			i = (i & (i + 1)) - 1;
		}
		while (j >= 0) {
			t += a[j];
			j = (j & (j + 1)) - 1;
		}
		return t - s;
	}

private:
	vector<long long> a;
};

vector<int> compress_num, compressed_num;
int find_comp(int x)
{
	return lower_bound(compress_num.begin(), compress_num.end(), x) - compress_num.begin();
}

int main()
{
	int n, m, q;
	cin >> n >> m >> q;
	vector<long long> t(q), x(q), y(q);
	for (int i = 0; i < q; i++) {
		cin >> t[i] >> x[i] >> y[i];
		x[i]--;
	}

	for (int i = 0; i < q; i++) {
		compress_num.emplace_back(y[i]);
	}
	compress_num.emplace_back(0);
	sort(compress_num.begin(), compress_num.end());
	compress_num.erase(unique(compress_num.begin(), compress_num.end()), compress_num.end());
	/*for (int i = 0; i < compress_num.size(); i++) {
		compressed_num[i] = lower_bound(compress_num.begin(), compress_num.end(),
			compress_num[i]) - compress_num.begin();
	}*/

	long long sum = 0;
	vector<int> a(n), b(m);
	BIT bita(q+10), bitb(q + 10);
	BIT numa(q+10), numb(q + 10);
	numa.add(0, n);
	numb.add(0, m);
	for (int i = 0; i < q; i++) {
		if (t[i] == 1) {
			sum -= bitb.sum(find_comp(a[x[i]]), q+5) + a[x[i]] * numb.sum(0, find_comp(a[x[i]]) - 1);
			bita.add(find_comp(a[x[i]]), -a[x[i]]);
			numa.add(find_comp(a[x[i]]), -1);
			a[x[i]] = y[i];
			numa.add(find_comp(a[x[i]]), 1);
			bita.add(find_comp(a[x[i]]), a[x[i]]);
			sum += bitb.sum(find_comp(a[x[i]]), q+5) + y[i] * numb.sum(0, find_comp(a[x[i]]) - 1);
			cout << sum << endl;
		} else {
			sum -= bita.sum(find_comp(b[x[i]]), q + 5) + b[x[i]] * numa.sum(0, find_comp(b[x[i]]) - 1);
			bitb.add(find_comp(b[x[i]]), -b[x[i]]);
			numb.add(find_comp(b[x[i]]), -1);
			b[x[i]] = y[i];
			numb.add(find_comp(b[x[i]]), 1);
			bitb.add(find_comp(b[x[i]]), b[x[i]]);
			sum += bita.sum(find_comp(b[x[i]]), q + 5) + y[i] * numa.sum(0, find_comp(b[x[i]]) - 1);
			cout << sum << endl;
		}
		/*for (int j = 0; j < n; j++) {
			cout << a[j] << " ";
		}
		cout << endl;
		for (int j = 0; j < m; j++) {
			cout << b[j] << " ";
		}
		cout << endl;*/
	}

	return 0;
}

#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0, length = n; i < length; i++)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ep emplace
#define epb emplace_back
#define scll static_cast<long long>
#define sz(x) static_cast<int>((x).size())
#define pfll(x) printf("%lld\n", x)
#define ci(x) cin >> x
#define ci2(x, y) cin >> x >> y
#define ci3(x, y, z) cin >> x >> y >> z
#define ci4(w, x, y, z) cin >> w >> x >> y >> z
#define co(x) cout << x << endl
#define co2(x, y) cout << x << " " << y << endl
#define co3(x, y, z) cout << x << " " << y << " " << z << endl
using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int>> PQG;
typedef priority_queue<P> PQP;
typedef priority_queue<P, vector<P>, greater<P>> PQPG;

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int n, m, q, t[MAX_N], x[MAX_N], y[MAX_N], memo[MAX_N][2];
map<int, int> ma;
vector<ll> ans;

P bit[MAX_N + 2][2];

P sum(int i, int j) {
    P s = P(0, 0);
    while (i > 0) {
        s.fi += bit[i][j].fi;
        s.se += bit[i][j].se;
        i -= i & -i;
    }
    return s;
}

void add(int i, int j, int x, int y) {
    while (i <= q + 1) {
        bit[i][j].fi += x;
        bit[i][j].se += y;
        i += i & -i;
    }
}

int main() {
    ci3(n, m, q);
    rep(i, q) {
        ci3(t[i], x[i], y[i]);
        ma.ep(y[i], 0);
    }
    ma.ep(0, 0);
    int cnt = 0;
    for (auto &i: ma) i.se = ++cnt;
    ans.epb(0);
    rep(i, n) add(1, 0, 1, 0);
    rep(i, m) add(1, 1, 1, 0);
    rep(i, q) {
        int old_y = memo[x[i] - 1][t[i] - 1];
        add(ma[y[i]], t[i] - 1, 1, y[i]);
        add(ma[old_y], t[i] - 1, -1, -old_y);
        P p1 = sum(ma[y[i]] - t[i] % 2, t[i] % 2);
        P p2 = sum(ma[old_y] - t[i] % 2, t[i] % 2);
        ll tmp = ans.back();
        tmp += scll(p1.fi) * y[i] - scll(p2.fi) * old_y;
        tmp += p2.se - p1.se;
        ans.epb(tmp);
        memo[x[i] - 1][t[i] - 1] = y[i];
    }
    rep(i, q) co(ans[i + 1]);
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	cout << n / m;
}

//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define bit(n) (1LL<<(n))
#define FIX(d) fixed << setprecision(d)
using P = pair<int, int>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,w; cin >> n >> w;
  cout << n/w << endl;

  return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

long long md = 1000000007;

long long fp(long long n, long long k)
{
	long long s = 1;
	while (k) {
		if (k & 1) s = (s * n) % md;
		k /= 2; n = (n * n) % md;
	}
	return s;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	int s = n;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		s += a;
	}
	int p = n + m;
	long long ns = 1, rs = 1;
	for (int i = 0; i < s; i++) {
		ns = (ns * (p - i)) % md;
		rs = (rs * (i + 1)) % md;
	}
	rs = fp(rs, md - 2);
	cout << (ns * rs) % md << '\n';
	return 0;
}

//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
template<typename T>void rearrange(vector<ll>&ord, vector<T>&v){
  auto tmp = v;
  for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<ll>&ord,Head&& head, Tail&&... tail){
  rearrange(ord, head);
  rearrange(ord, tail...);
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  vector<ll>a(4);
  rep(i,0,4)cin>>a[i];
  cout<<*min_element(ALL(a))<<endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
#define N 110
#define sq(_) ((_) * (_))
#define eps 1e-7
bool equ(double x , double y) {
	return fabs(x - y) < eps;
}
int n;
double x[2][N] , y[2][N];
double gx , gy;
bool vis[N];
int main() {
	cin >> n;
	for(int t = 0 ; t <= 1 ; t++) {
		gx = gy = 0;

		for(int i = 1 ; i <= n ; i++) {
			cin >> x[t][i] >> y[t][i];
			gx += x[t][i] , gy += y[t][i];
//			x[t][i] *= n , y[t][i] *= n;
		}
		gx /= n * 1.0 , gy /= n * 1.0;
		for(int i = 1 ; i <= n ; i++)
			x[t][i] -= gx , y[t][i] -= gy;
	}
	/*
	for(int t = 0 ; t <= 1 ; t++)
		for(int i = 1 ; i <= n ; i++) {
			cout << x[t][i] << '\t' << y[t][i] << endl;

		}*/
	for(int i = 1 ; i <= n ; i++) {
		if(x[0][i] != 0 || y[0][i] != 0) {
			swap(x[0][i] , x[0][1]);
			swap(y[0][i] , y[0][1]);
		}
	}
	for(int i = 1 ; i <= n ; i++) {
//		if(sq(x[1][1]) + sq(y[1][1]) != sq(x[0][i]) + sq(y[0][i]))	continue;
		double angle = atan2(y[1][i] , x[1][i]) - atan2(y[0][1] , x[0][1]);
		memset(vis , 0 , sizeof(vis));
		vis[i] = true;
		for(int j = 1 ; j <= n ; j++) {
			double tx , ty;

			tx = x[0][j] * cos(angle) - y[0][j] * sin(angle);
            ty = x[0][j] * sin(angle) + y[0][j] * cos(angle);
			for(int k = 1 ; k <= n ; k++)
				if(equ(tx , x[1][k]) && equ(ty , y[1][k]))
					vis[k] = true;
		}
		bool flag = true;
		for(int j = 1 ; j <= n ; j++)
			if(vis[j] == 0) {
				flag = false;
				break;
			}
		if(flag) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define int long long
#define endl "\n"
#define mod 1000000007
#define inf (int)1e18

const int mxn = 65;
int dp[mxn][2];
string a[mxn];
int n;

int solve(int i, bool prev){
    if(i>=n){
        return prev;
    }

    int &ans=dp[i][prev];

    if(ans!=-1) return ans;
    ans = 0;

    if(a[i]=="AND"){
        ans += solve(i+1,prev&true) + solve(i+1,prev&false);
    }else{
        ans += solve(i+1,prev|true) +  solve(i+1,prev|false);
    }

    return ans;
}

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    memset(dp,-1,sizeof(dp));

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }

    debug() << range(a,a+n);

    cout << solve(0,0) + solve(0,1) << endl;

    debug() << deb(solve(0,0));
    debug() << deb(solve(0,1));

    return 0;
}


#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 998244353;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, k;
int gr[55][55];

int fact[MAXN];
int p1[MAXN], p2[MAXN];
int sz1[MAXN], sz2[MAXN];
int find_set(int *p, int a){
    if(p[a] == a) return a;
    return p[a] = find_set(p, p[a]);
}

void merge(int a, int b, int *p){
    a = find_set(p, a);
    b = find_set(p, b);
    if(a != b){
        p[b] = a;
        if(p == p1)
            sz1[a] += sz1[b];
        else
            sz2[a] += sz2[b];
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
    #endif

    fact[0] = 1;

    for(int i = 1; i <= 50; i++)
        fact[i] = 1LL * fact[i - 1] * i % mod;

    cin>>n>>k;

    for(int i = 0; i < n; i++){
        p1[i] = i;
        sz1[i] = 1;
        p2[i] = i;
        sz2[i] = 1;
        for(int j = 0; j < n; j++)
            cin>>gr[i][j];
    }
    int ans = 1;

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            bool tru = 1;
            for(int l = 0; l < n; l++){
                if(gr[i][l] + gr[j][l] > k){
                    tru = 0;
                    break;
                }
            }
            if(tru)
                merge(i, j, p1);
        }
    }

    for(int i = 0; i < n; i++){
        if(p1[i] == i){
            ans = 1LL * ans * fact[sz1[i]] % mod;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            bool tru = 1;
            for(int l = 0; l < n; l++){
                if(gr[l][i] + gr[l][j] > k){
                    tru = 0;
                    break;
                }
            }
            if(tru)
                merge(i, j, p2);
        }
    }

    for(int i = 0; i < n; i++){
        if(p2[i] == i){
            ans = 1LL * ans * fact[sz2[i]] % mod;
        }
    }

    cout<<ans<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
//#define int long long
int n,m,a[1500010],f[1500010];
signed main() {
	memset(f,0,sizeof(f));
	scanf("%d%d",&n,&m);
	for(int i = 1; i <= n; i++) {
		scanf("%d",&a[i]);
	}
	for(int i = 1; i <= m; i++) {
		f[a[i]]++;
	}
	int ans;
	for(int i = 0; ; i++) {
		if(f[i] == 0) {
			ans = i;
			break;
		}
	}
	for(int i = 2; i+m-1 <= n; i++) {
		if(a[i-1] < ans && a[i+m-1] != a[i-1] && f[a[i-1]] == 1) {
			ans = a[i-1];
		}
		f[a[i-1]]--;
		f[a[i+m-1]]++;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define clog(x) std::clog << (#x) << " is " << (x) << '\n';
using LL = long long;

int main() {
	//freopen("in", "r", stdin);
	std::cin.tie(nullptr)->sync_with_stdio(false);
	LL n;
	std::cin >> n;
	std::vector<LL> F{1, 1};
	while (F.back() <= n) F.emplace_back(F[F.size() - 2] + F[F.size() - 1]);
	F.pop_back();
	int s = F.size(), now = s - 1;
	std::vector<int> a(s), ans;
	while (now >= 0 && n) {
		if (F[now] <= n) { // 不会超过两次的
			n -= F[now];
			++a[s - 1 - now];
		}
		--now;
	}
	for (int i = 0; i < s; ++i) {
		if ((i & 1) == (s & 1)) {
			if (a[i]) ans.emplace_back(2);
			ans.emplace_back(4);
		} else {
			if (a[i]) ans.emplace_back(1);
			ans.emplace_back(3);
		}
	}
	std::cout << ans.size() << '\n';
	for (auto x : ans) std::cout << x << '\n';
	return 0;
}

///

#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fodec(i,a,b) for(int i=a;i>b;i--)
#define sz(v) int(v.size())
#define len(s) s.length()
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vvll vector<vector<ll>>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define piii pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define bit_cnt(x) __builtin_popcount(x)
#define fastio ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fileio freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define inf 1e9
const int MOD = 1e9+7;

int n;
vvi adj;
vi cc;
vi ans;

unordered_map<int,bool> uu;

void solve(int s,int par){
    bool f=false;
    if(!uu[cc[s]]){
        f=true;
        ans.pb(s);
        uu[cc[s]]=true;
    }
    for(auto&x:adj[s]){
        if(x==par) continue;
        solve(x,s);
    }
    if(f) uu[cc[s]]=false;
}

int main(){
    cin>>n;
    cc.assign(n,-1);
    fo(i,0,n) cin>>cc[i];
    adj.assign(n,vector<int>());
    fo(i,0,n-1){
        int x,y;
        cin>>x>>y;
        x--; y--;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    ans.clear();
    uu.clear();
    solve(0,-1);
    sort(all(ans));
    for(auto&it:ans) cout<<it+1<<endl;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i32 mod   = 1e9 + 7;
// constexpr i32 mod   = 998244353;

constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr i32 dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr i32 dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(i32 x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != (int)v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solve() {
  int v, t, s, d;
  cin >> v >> t >> s >> d;

  if (v * t <= d and d <= v * s) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

signed main() {
  solve();
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
int lst[3][11];
int nlst[10];

bool check(void) {
    int num[3] = {0};
    for (int i = 0; i < 3; i++) {
        if (nlst[lst[i][0]] == 0) return false;
        for (int j = 0; j < lst[i][10]; j++) {
            num[i] *= 10;
            num[i] += nlst[lst[i][j]];
        }
    }
    return (num[0] + num[1] == num[2]);
}

signed main(void) {
    string s;
    bool b;
    char clst[10];
    int cp = 0;
    for (int i = 0; i < 3; i++) {
        cin >> s;
        for (int j = s.size() - 1; j >= 0; j--) {
            lst[i][10] = s.size();
            b = true;
            // アルファベットを数字に変換
            for (int k = 0; k < cp; k++) {
                if (clst[k] == s[j]) {
                    lst[i][j] = k;
                    b = false;
                    break;
                }
            }
            if (b) {
                if (cp >= 10) {
                    // 11文字以上使われてる
                    cout << "UNSOLVABLE" << endl;
                    return 0;
                }
                clst[cp] = s[j];
                lst[i][j] = cp;
                cp++;
            }
        }
    }

    vector<int> seed = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    sort(seed.begin(), seed.end());
    do {
        for (int i = 0; i < 10; i++) nlst[i] = seed[i];
        b = check();
        if (b) break;
    } while (next_permutation(seed.begin(), seed.end()));

    if (b) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < lst[i][10]; j++) cout << nlst[lst[i][j]];
            cout << endl;
        }
    } else
        cout << "UNSOLVABLE" << endl;
}


#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair<int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'
#define vi vector<int>

int32_t main() {
   boost;
   int n;
   cin >> n;
   string s;
   cin >> s;
   int q;
   cin >> q;
   int f = 0;
   while(q--) {
      int t, a, b;
      cin >> t >> a >> b;
      a--, b--;
      if(t == 1) {
         if(f) {
            if(a < n)
               a += n;
            else a -= n;
            if(b < n)
               b += n;
            else b -=n;
         }
         swap(s[a], s[b]);
      }
      else f ^= 1;
   }
   if(f)
      s = s.substr(n) + s.substr(0, n);
   cout << s << endl;
}

#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool s_first = true;//true_s1,false_s2
void swap_char(vector<char>&,vector<char>&,int,int,int);
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<char> s1(n);
    vector<char> s2(n);
    for(int i = 0;i < n;i++){
        s1[i] = s[i];
    }
    for(int i = 0;i < n;i++){
        s2[i] = s[i+n];
    }
    int q;
    cin >> q;
    for(int i = 0;i < q;i++){
        int t,a,b;
        cin >> t >> a >> b;
        a--;
        b--;
        if(t == 1){
            if(s_first){
                swap_char(s1,s2,a,b,n);
            }else{
                swap_char(s2,s1,a,b,n);
            }
        }
        if(t == 2){
            s_first = !s_first;
        }

    }
    if(s_first){
        for(auto i:s1){
            cout << i;
        }
        for(auto i:s2){
            cout << i;
        }
        cout << endl;
    }else{
        for(auto i:s2){
            cout << i;
        }
        for(auto i:s1){
            cout << i;
        }
        cout << endl;
    }

    return 0;
}

void swap_char(vector<char>& s1,vector<char>& s2,int a,int b,int n){

    if(a >= n){
        if(b >= n){
            swap(s2[a-n],s2[b-n]);
        }else{
            swap(s2[a-n],s1[b]);
        }
    }else{
        if(b >= n){
            swap(s1[a],s2[b-n]);
        }else{
            swap(s1[a],s1[b]);
        }
    }
    return;

}


#include <bits/stdc++.h>
#define endl "\n";
#define pii pair<int,int>;
using namespace std;
typedef long long ll;
const ll BIG=1000000007;
const double PI=3.141592653589793238;
ll binpow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0){
        if(b&1){res=(res*a)%m;}
    b>>=1;a=(a*a)%m;
    }
    return res;
}
template <typename T,typename Q>
T max(T a,Q b)
{
    if(a<b)
        return b;
    return a;
}
template <typename T,typename Q>
T min(T a,Q b)
{
    if(a>b)
        return b;
    return a;
}
void solve()
{
	int a,b;
	cin>>a>>b;
	cout<<(a+b)/2<<" "<<(a-b)/2;
}
int main() {
    int t;t=1;
    while(t--)
	{
		solve();
	}
	return 0;
}

#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

int main(){
	int a=read(),b=read(),x=(a+b)/2,y=a-x;
	printf("%d %d\n",x,y);
}


//Many 110

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rrep(i,x,y) for(ll i=x-1;i>=y;i--)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end()
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18
//cout<<fixed<<setprecision(15)<<x<<nnn;

signed main (){
    int n;string t;cin>>n>>t;
    int ans=0;
    string s;
    rep(i,0,n/3+2){
        s.push_back('0');
        s.push_back('1');
        s.push_back('1');
    }
    bool flag=false;
    rep(i,0,3)rep(j,0,n){
        if(t[j]!=s[i+j])break;
        if(j==n-1)flag=true;
    }
    if(flag){
        if(n==1){
            if(t[0]=='1')ans=2*1e10;
            else ans=1e10;
        }else if(n==2){
            if(t[0]=='0')ans=1e10-1;
            else ans=1e10;
        }else{
            if(t[0]=='0')ans=(3e10-2-n)/3+1;
            else if(t[1]=='0')ans=(3e10-1-n)/3+1;
            else ans=(3e10-n)/3+1;
        }
    }
    cout<<ans<<nnn;
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

ll N, ans;
string Tstr;

ll check_valid(ll offset, const char* T) {
	ll i;
	ll m;
	const char* valid = "110";
	m = 0;
	for (i = offset; i < N; i++) {
		if (T[i] != valid[m]) {
			return -1;
		}
		m++;
		if (m == 3) m = 0;
	}

	//cout << "passed" << endl;

	ll n = (N - offset) / 3;
	ll left = (N - offset) % 3;
	if (left > 0) n++;

	if (offset == 0) {
		return n - 1;
	}
	else {
		return n;
	}
}

int main() {

	N = 1E10;
	cin >> N;
	cin >> Tstr;

	if (N == 1) {
		if (Tstr.at(0) == '1') {
			ans = 2 * 1E10;
		}
		else {
			ans = 1E10;
		}
		cout << ans << endl;
		return 0;
	}

	if (N == 2) {
		auto check = Tstr.substr(0, 2);
		if (check == "11" || check == "10") {
			ans = 1E10;
		}
		else if (check=="01"){
			ans = 1E10-1;
		}
		else {
			ans = 0;
		}
		cout << ans << endl;
		return 0;
	}

	string head = Tstr.substr(0, 3);
	ll offset = 0;

	if (head == "110") {
		if (N == 3) {
			ans = 1E10;
			cout << ans << endl;
			return 0;
		}
		offset = 0;
	}
	else if (head == "101"){
		if (N == 3) {
			ans = 1E10-1;
			cout << ans << endl;
			return 0;
		}
		offset = 2;

	}
	else if (head == "011") {
		if (N == 3) {
			ans = 1E10 - 1;
			cout << ans << endl;
			return 0;
		}
		offset = 1;
	}
	else {
		ans = 0;
		cout << ans << endl;
		return 0;
	}

	// cout << "offset=" << offset << " T=" << Tstr << endl;
	ll ret= check_valid(offset, Tstr.c_str());

	if (ret == -1) {
		ans = 0;
	}
	else {
		ans = 1E10 - ret;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_
void debug_out() {cerr << endl;}
template<typename Head,typename... Tail> void debug_out(Head H,Tail... T){cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:",debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl;
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int H,W; cin >> H >> W;
    vector<string> S(H);
    rep(i,H) cin >> S[i];

    int ans = 0;
    rep(i,H) {
        rep(j,W) {
            if (S[i][j] == '#') continue;
            if (i + 1 < H && S[i+1][j] == '.') ++ans;
            if (j + 1 < W && S[i][j+1] == '.') ++ans;
        }
    }
    cout << ans << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
const int mod1=998244353,mod2=(int)1e9+7;
int power(int n,int k,int mod){int ans=1; n=n%mod;while(k>0){if(k&1)ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return (ans+mod)%mod;}//negative nos & 0^0
struct triplet{int a,b,c;};bool operator < (const triplet &t1,const triplet &t2){if(t1.a<t2.a)return true;if(t1.a==t2.a && t1.b <t2.b)return true;if(t1.a==t2.a && t1.b ==t2.b && t1.c<t2.c)return true;return false;}
// memset(dp, -1, sizeof dp);

void problemSolver()
{

	int n,k,ans=0;
	cin>>n>>k;

	for(int y=2;y<=2*n;y++)
	{
		int x=k+y;
		if(x<=1 || x>2*n) continue;
		int ans1=(2*n-x+1),ans2=(2*n-y+1);
		if(x<=n)
			ans1=x-1;
		if(y<=n)
			ans2=y-1;
		ans+=ans1*ans2;
	}
	cout<<ans;
}
int32_t main()
{

	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int testcases=1;
    // cin>>testcases;
    while(testcases--)
    problemSolver();

}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,n,a) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl//デバッグ用
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //10^9+7:合同式の法
#define pb push_back
#define F first
#define S second
typedef long long ll;

//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
//a.erase(unique(all(a)), a.end()); ソート後に重複を削除
//cout<< std::fixed << std::setprecision(15)<<0.000001<<endl; 小数点以下を表示させる
//vector<vector<int>> data(3, vector<int>(4)); int型の2次元配列(3×4要素の)の宣言

int main() {
   ll n;
   cin>>n;
   n-=3;
   cout<<"6 10 15 ";
   ll i=16;
   while(n){
       i++;
       bool is2,is3,is5;
       is2=i%2==0;
       is3=i%3==0;
       is5=i%5==0;

       if((is2&&is3)||(is2&&is5)||(is5&&is3)){
           cout<<i<<" ";
           n--;
           if(n==0)break;
       }
   }
}

#include<bits/stdc++.h>
typedef int LL;
typedef double dl;
#define opt operator
#define pb push_back
#define pii std::pair<LL,LL>
const LL maxn=1e6+9,mod=998244353,inf=0x3f3f3f3f;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
void Chkmin(LL &x,LL y){
	if(y<x) x=y;
}
void Chkmax(LL &x,LL y){
	if(y>x) x=y;
}
LL add(LL x,LL y){
	return x+=y,x>=mod?x-mod:x;
}
LL dec(LL x,LL y){
	return x-=y,x<0?x+mod:x;
}
LL mul(LL x,LL y){
	return 1ll*x*y%mod;
}
LL Pow(LL base,LL b){
	LL ret(1); while(b){
		if(b&1) ret=mul(ret,base); base=mul(base,base); b>>=1;
	}return ret;
}
LL n;
int main(){
	n=Read();
	printf("%d\n",(1<<n)-1);
	for(LL i=1;i<(1<<n);++i){
		for(LL j=0;j<(1<<n);++j){
			if(__builtin_popcount(i&j)&1){
				printf("B");
			}else{
				printf("A");
			}
		}puts("");
	}
	return 0;
}


/**
 *	  author : Nikh1l
 *	  created: 27.02.2021 17:29:54
**/
#include<bits/stdc++.h>

using namespace std;

using ll = int64_t;

void Learner() {

	double a, b, ans = 0;
	cin >> a >> b;
	cout << setprecision(10) << (a - b)*100/a;

}

int32_t main() {

  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
	Learner();
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10, oo = 1e9 + 10, MOD = 1e9 + 7;
ll s, p;
main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> s >> p;
	for(ll i = 1; i * i <= p; i++) {
	    if(p % i == 0) {
	        if(p / i + i == s) {
	            cout << "Yes\n";
	            return 0;
	        }
	    }
	}
	cout << "No\n";
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b){return b ? gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  ll ans = 2;
  for(ll i=3; i<=n; ++i){
    ans *= i /gcd(ans,i);
  }
  cout << ans+1 << endl;
}

#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int fact[N], invfact[N];

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int modinv(int k)
{
	return pow(k, MOD-2, MOD);
}

void precompute()
{
	fact[0]=fact[1]=1;
	for(int i=2;i<N;i++)
	{
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
	invfact[N-1]=modinv(fact[N-1]);
	for(int i=N-2;i>=0;i--)
	{
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
}

int nCr(int x, int y)
{
	if(y>x)
		return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=MOD;
	num*=invfact[x-y];
	num%=MOD;
	return num;
}

int32_t main()
{
	int t;
	t=1;
	while(t--)
	{
		int n;
		cin >> n;
		int x=1;
		for(int i=2;i<=n;i++)
		{
			x=((x*i)/__gcd(x,i));
			//cout << x << endl;
		}
		//for(int i=2;i<=n;i++)
		//cout << (x+1)%i << endl;

		cout << x+1;

	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ull unsigned long long
#define lld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define f first
#define s second
#define mk make_pair

/*----------------------DEBUGGER---------------------------*/
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.f); cerr << ","; _print(p.s); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
/*----------------------DEBUGGER---------------------------*/

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
  int tt = 1;
  //cin >> tt;
  while (tt--)
  {
    int n;
    cin >> n;
    ll ans = 108 * n;
    ans /= 100;
    if (ans < 206)
      cout << "Yay!";
    else if (ans == 206)
      cout << "so-so";
    else
      cout << ":(";
  }//while
}//main

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
using namespace std;

using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define For(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFor(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
#define co(a) cout<<a<<endl
#define ce(a) cerr<<a<<endl
#define Sort(a) sort((a).begin(),(a).end())
#define Rev(a) reverse((a).begin(),(a).end())
#define Unique(a) (a).erase(unique((a).begin(), (a).end()),(a).end())
#define cfs(a) cout<<fixed<<setprecision(a)

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    For(i, 0, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#define LOCAL
#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

constexpr ll INF = TEN(18);

int main() {
    ll N;
    cin >> N;
    N = N * 1.08 / 1;
    if (206 > N) {
        co("Yay!");
    }
    else if (206 == N) {
        co("so-so");
    }
    else {
        co(":(");
    }
}


#pragma region Template  // clang-format off
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, m, n) for (int i = m; i < (int)(n); i++)
#define repe(i, m, n) for (int i = m; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define yesno {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using pii = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#pragma endregion Template  // clang-format on

int main() {
  int k;
  cin >> k;

  string T, A;
  cin >> T >> A;

  vector<ll> c(10, k), t(10), a(10);
  rep(i, 0, 4) {
    t[T[i] - '0']++;
    a[A[i] - '0']++;
    c[T[i] - '0']--;
    c[A[i] - '0']--;
  }

  ll twin = 0, awin = 0;
  repe(i, 1, 9) repe(j, 1, 9) {
    auto tt = t, aa = a;
    tt[i]++;
    aa[j]++;
    ll tsum = 0, asum = 0, n = 0;
    if (i == j) {
      n = c[i] * (c[i] - 1);
    } else {
      n = c[i] * c[j];
    }
    repe(k, 1, 9) {
      tsum += k * (ll)pow(10, tt[k]);
      asum += k * (ll)pow(10, aa[k]);
    }
    if (tsum > asum)
      twin += n;
    else
      awin += n;
  }

  double ans = (double)twin / (twin + awin);
  printf("%.10f\n", ans);
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> bad(n+1);
    vector<int> aa;
    for (int i = 0; i < k; ++i) {
        int x;
        cin >> x;
        bad[x]++;
        aa.emplace_back(x);
    }
    for (int i = 0; i+m <= k; ++i) {
        if(aa[i+m-1]-aa[i] == m-1) return puts("-1"), 0;
    }
    vector<array<double, 2>> ans(n), S(n+1);
    for (int i = n-1; i >= 0; --i) {
        if(bad[i]){
            ans[i][1] = 1;
        }else {
            for (int j = 0; j < 2; ++j) {
                ans[i][j] = (S[i+1][j]-S[min(n, i+1+m)][j])/m;
            }
            ans[i][0]++;
        }
        for (int j = 0; j < 2; ++j) {
            S[i][j] = S[i+1][j]+ans[i][j];
        }
    }
    printf("%.10lf\n", ans[0][0]/(1-ans[0][1]));
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=100+10;
const int SIZE=50;
ll prime[mx], ptot;
bool isp[mx];
ll x[mx];
ll ans;
ll n;
vector<ll>vec[mx];
void fj(ll v){
    ll cpy=v;
    for(ll i=2;i*i<=v;i++){
        if(v%i==0){
            vec[cpy].push_back(i);
            while(v%i==0)v/=i;
        }
    }
    if(v!=1)vec[cpy].push_back(v);
}
void getPrime(){
    isp[1]=1;
    for(ll i=2;i<=SIZE;i++){
        if(isp[i]==0){
            prime[++ptot]=i;
        }
        for(ll j=1;j<=ptot;j++){
            if(i*prime[j]>SIZE)break;
            isp[i*prime[j]]=1;
            if(i%prime[j]==0)break;
        }
    }
}
bool vis[mx];
void dfs(ll c, ll v){//c<=ptot;
    if(v>=ans) return;
    if(c==ptot+1){
        for(ll i=1;i<=n;i++){
            bool ok=false;
            for(ll j=0;j<vec[x[i]].size();j++){
                ll value=vec[x[i]][j];
                if(vis[value]){
                    ok=true;
                    break;
                }
            }
            if(!ok) return;
        }
        ans=v;
        return;
    }
    vis[prime[c]]=true;
    dfs(c+1, v*prime[c]);
    vis[prime[c]]=false;
    dfs(c+1, v);
}
void solve(){
    getPrime();
    for(ll i=1;i<=SIZE;i++)fj(i);

    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>x[i];
    }
    n=unique(x+1, x+1+n)-x-1;

    ans=1e18+10;
    dfs(1, 1);
    cout<<ans<<endl;
}
int main(){
#ifdef LOCAL
    FILE *fp=freopen("1", "r", stdin);
#endif
    solve();
#ifdef LOCAL
    fclose(fp);
#endif
    return 0;
}

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef pair<ll, ll> llpair;

typedef std::numeric_limits<double> dbl;

#if defined(_USE_MATH_DEFINES) && !defined(_MATH_DEFINES_DEFINED)
#define _MATH_DEFINES_DEFINED
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif

void prepareIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(dbl::max_digits10);
}

const ll MOD = 1e9 + 7;

const ll N = 3e3 + 1;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    prepareIO();

    ll n;
    cin >> n;

    vector<ll> a(n + 1), psum(n + 1, 0);

    for (ll i = 1; i <= n; i++)
    {
        cin >> a[i];
        psum[i] = psum[i - 1] + a[i];
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 0));
    vector<vector<ll>> sum(n + 1, vector<ll>(n + 1, 0));

    sum[1][0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 1; j <= i; j++)
        {
            dp[i][j] = sum[j][psum[i] % j];
        }

        for (ll k = 1; k <= n; k++)
        {
            sum[k][psum[i] % k] = ((sum[k][psum[i] % k]) % MOD + (dp[i][k - 1]) % MOD) % MOD;
        }
    }

    ll ans = 0;
    for (ll j = 1; j <= n; j++)
    {
        ans = ((ans % MOD) + (dp[n][j] % MOD) % MOD);
    }

    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp make_pair
#define pb push_back
#define fp first
#define sp second
typedef long long int ll;
typedef pair<ll,ll> pp;
#define check(x, i) ((x>>i)&1LL)
#define set(x,i) (x|(1LL<<i))
#define unset(x,i) (x&~(1LL<<i))
#define INF LONG_MAX
#define MAX_N 20
#define MAX 200005
#define mod 1000000007
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define len(i,s) for(i=0;s[i];i++)
#define T() ll t;cin>>t;while(t--)
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
ll gcd (ll a, ll b){return (a?gcd(b%a,a):b);}
ll pow1(ll a,ll b,ll MOD){ll ans=1;while(b!=0){if(b&1)ans=(ans*a)%MOD;a=(a*a)%MOD;b=b/2;}return ans;}
ll modInverse(ll a,ll p){return pow1(a,p-2,p);}

int main()
{
  boost
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

ll n;
cin>>n;
ll i,j;
ll arr[n-1];
REP(i,n-1)
{
	arr[i]=i+2;
}
ll ans = arr[0];
    for (int i = 1; i < n-1; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

cout<<ans+1<<"\n";

}

#include <bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define forn(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, M;
	cin >> N;
	int d = 0;
	M = N;
	while (M > 0) {
		d++;
		M /= 10;
	}
	if (d == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (d % 2 != 0) {
		M = 0;
		for (int i = 0; i < d; i++) {
			M = 10 * M + 9;
		}
	} else {
		M = N;
	}
	vector<ll> c;
	while (M > 0) {
		c.push_back(M % 10);
		M /= 10;
	}
	reverse(c.begin(), c.end());
	ll R = 0;
	for (ui i = 0; i < c.size() / 2; i++)
		R = 10 * R + c[i];
	ll ans = R;
	for (ui i = 0; i < c.size() / 2; i++)
		R = 10 * R + c[i];
	// cout << R << "  " << N << endl;
	cout << ans - (R > N ? 1 : 0) << endl;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
template<typename T> ostream& operator<<(ostream& os,const vector<T>& v1){
    int n=v1.size();
    for(int i=0;i<n;i++){
        if(i)os<<" ";
        os<<v1[i];
    }
    return os;
}
template<typename T1,typename T2> ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    os<<p.first<<" "<<p.second;
    return os;
}
template<typename T> istream& operator>>(istream& is,vector<T>& v1){
    int n=v1.size();
    for(int i=0;i<n;i++)is>>v1[i];
    return is;
}

namespace sol{

    int n,m;
    const int N=5,M=3;
    int t[3333][N];

    bool check(int q){
        vector<vector<char>> dp(1<<N,vector<char>(M+10));
        dp[0][0]=1;
        int i,j,k;
        int a,b;
        for(i=0;i<n;i++){
            a=0;
            for(j=0;j<N;j++){
                if(t[i][j]>=q)a^=1<<j;
            }
            for(j=0;j<(1<<N);j++){
                for(k=M-1;k>=0;k--){
                    if(dp[j][k])dp[j|a][k+1]=1;
                }
            }
        }
        return dp[(1<<N)-1][M];
    }

    void solve(){
        int i,j,k;
        int a,b,c;
        int z[3]={0,INF};
        cin>>n;
        for(i=0;i<n;i++){
            for(j=0;j<N;j++){
                cin>>t[i][j];
            }
        }
        while(z[1]-z[0]>1){
            z[2]=(z[0]+z[1])/2;
            if(check(z[2]))z[0]=z[2];
            else z[1]=z[2];
        }
        cout<<z[0]<<endl;
    }
}

int main(){
    sol::solve();
}

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 3e18;

inline ll mod(ll a, ll m) { return (a%m+m)%m;}

// EXTGCD  a*x + b*y = extGCD
ll extGCD(ll a, ll b, ll &x, ll &y){
    if(b == 0) { x = 1; y = 0; return a;}
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}

// Chinese Remainder Theorem
// x ≡ r (mod m)
pair<ll, ll> ChineseRem(ll b1, ll m1, ll b2, ll m2){
    ll p, q;
    ll d = extGCD(m1, m2, p, q); // p is inv of m1/d (mod m2/d)
    if((b2 - b1)%d != 0) return make_pair(0, -1); // no answer
    ll m = m1*(m2/d); // lcm(m1, m2)
    ll tmp = (b2 - b1)/d*p%(m2/d);
    ll r = mod(b1 + m1*tmp, m);
    return make_pair(r, m);
}

void solve(){
    ll x, y, p, q;
    cin >> x >> y >> p >> q;
    ll a = (x + y)*2, b = p + q;
    ll ans = INF;
    rep(i, 0, y){
        rep(j, 0, q){
            pair<ll, ll> P = ChineseRem(x+i, a, p+j, b);
            if(P.first != 0) ans = min(ans, P.first);
        }
    }
    if(ans == INF) cout << "infinity" << endl;
    else cout << ans << endl;
    return;
}

int main()
{
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mod 998244353

using namespace std;

const int O = 3e5 + 5;

int tree[O * 4], lazy[O * 4];

void Push(int id, int l, int r){
    int &x = lazy[id];
    int mid = (l + r) / 2;
    if (x == 0) return;
    tree[id << 1] += x;
    lazy[id << 1] += x;
    tree[id << 1 | 1] += x;
    lazy[id << 1 | 1] += x;
    x = 0;
}

void Update(int id, int l, int r, int u, int v, int val){
    if (l > v || r < u) return;
    Push(id, l, r);
    if (u <= l && r <= v){
        tree[id] += val;
        lazy[id] += val;
        return;
    }
    int mid = (l + r) / 2;
    Update(id << 1, l, mid, u, v, val);
    Update(id << 1 | 1, mid + 1, r, u, v, val);
    tree[id] = tree[id << 1] + tree[id << 1 | 1];
}

int Get(int id, int l, int r, int u, int v){
    Push(id, l, r);
    if (l > v || r < u) return 0;
    if (u <= l && r <= v) return tree[id];
    int mid = (l + r) / 2;
    return Get(id << 1, l, mid, u, v) + Get(id << 1 | 1, mid + 1, r, u, v);
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n; cin >> n;
    vector <int> a(n + 1), b(n + 1);
    for (int i = 1; i <= n; ++ i) cin >> a[i], a[i] += i;
    for (int i = 1; i <= n; ++ i) cin >> b[i], b[i] += i;

    vector <int> val;
    for (int i = 1; i <= n; ++ i) val.push_back(b[i]);
    sort(val.begin(), val.end());
    val.resize(distance(val.begin(), (unique(val.begin(), val.end()))));

    vector <vector <int>> g; g.resize((int)val.size() + 1);
    for (int i = 1; i <= n; ++ i){
        int id = upper_bound(val.begin(), val.end(), a[i]) - val.begin() - 1;
        if (val[id] != a[i]) return cout << -1, 0;
        g[id].push_back(i);
    }

    int h = val.size();
    for (int i = 0; i < h; ++ i)
        reverse(g[i].begin(), g[i].end());
    int ans = 0;
    for (int i = 1; i <= n; ++ i){
        int id = upper_bound(val.begin(), val.end(), b[i]) - val.begin() - 1;
        int x = g[id].back();
        ans += (x + Get(1, 1, n, x, x) - i);
        Update(1, 1, n, 1, x, 1);
        g[id].pop_back();
    }
    cout << ans;
}

#include <bits/stdc++.h>
#define sz(c) int(c.size())
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define per(i, a, b) for (int i = (b)-1; i >= (a); --i)
using namespace std;
using ll = long long;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#ifdef LOCAL
#include <local/debug.h>
#else
#define debug(...) (void)0
#endif

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, 0, N) cin >> A[i];
  vector<int> B(N);
  rep(i, 0, N) cin >> B[i];

  set<pair<int, int>> s;
  ordered_set<int> ord;
  rep(i, 0, N) {
    s.insert({A[i] + i, i + 1});
    ord.insert(i + 1);
  }

  ll res = 0;
  rep(i, 0, N) {
    int val = B[i] + i;
    auto it = s.lower_bound({val, 0});
    if (it == s.end() || it->first != val) {
      if (it != s.end())
        assert(it->first > val);
      res = -1;
      break;
    }

    int pos = it->second;
    ll order = ord.order_of_key(pos);
    res += order;
    debug(val, pos, order);
    s.erase(it);
    ord.erase(pos);
  }

  cout << res << '\n';
}


#include<bits/stdc++.h>
using namespace std;
bool cmp(char c1, char c2) {
	if (c1 == c2) return 1;
	if (c1 == 'R' && c2 == 'S') return 1;
	if (c1 == 'P' && c2 == 'R') return 1;
	if (c1 == 'S' && c2 == 'P') return 1;
	return 0;
}
int main() {
	int n, k;
	string s;
	cin >> n >> k >> s;
	for (int i = 1; i <= k; i++) {
		s += s;
		string t;
		for (int j = 0; j < n * 2; j += 2)
			if (cmp(s[j], s[j+1])) t.push_back(s[j]);
			else t.push_back(s[j+1]);
		s = t;
	}
	cout << s[0] << endl;
}

#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
#include <bits/stdc++.h>
using namespace std;

// varibable settings
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T, class U> inline void chmax(T &a, const U &b) { if ((a) < (b)) (a) = (b); }
template <class T, class U> inline void chmin(T &a, const U &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

template <class T> T cdiv(T a, T b){ assert(a >= 0 && b > 0); return (a+b-1)/b; }

#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using iii = tuple<int, int, int>;

int solve() {
    ll n;cin>>n;

    vec<ll> d(n);
    rep(i, n){
        string s;cin>>s;
        d[i] = (s == "AND" ? 1 : 0);
    }

    auto dp0 = make_table(n+1, 0LL);
    auto dp1 = make_table(n+1, 0LL);
    dp0[0] = 1;
    dp1[0] = 1;

    rep(i, 0, n){
        if (d[i] == 1){
            dp0[i+1] += dp1[i];  // x[i] = 0
            dp1[i+1] += dp1[i];  // x[i] = 1
            dp0[i+1] += dp0[i];  // x[i] = 0
            dp0[i+1] += dp0[i];  // x[i] = 1
        }
        else{
            dp1[i+1] += dp1[i];  // x[i] = 0
            dp1[i+1] += dp1[i];  // x[i] = 1
            dp0[i+1] += dp0[i];  // x[i] = 0
            dp1[i+1] += dp0[i];  // x[i] = 1
        }
    }
    cout << dp1[n] << endl;

    return 0;
}

signed main(){/*{{{*/
    solve();

    #if defined(PCM) || defined(LOCAL)
    check_input();
    #endif

    return 0;
}/*}}}*/


#include<bits/stdc++.h>
using namespace std;
using Long = long long;
using Double = long double;
using pii = pair<int,int>;
using pll = pair<Long,Long>;
using vi = vector<int>;
using vl = vector<Long>;
using vs = vector<string>;
using vii = vector<pii>;
using vll = vector<pll>;

#define ff first
#define ss second
#define pb push_back
#define pf push_front

#define fore( i, from, to ) for( int i = from; i < to; ++i )
#define forn( i, n ) fore(i, 0, n )
#define fori( i, from, to ) for( int i = to - 1; i >= from; --i )
#define forin( i, n ) fori(i, 0, n )
#define forit( it, cnt ) for( auto &it : cnt )

#define endl '\n'
#define db(x) cout << "[ " << #x << " = " << x << " ]" << endl
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int) v.size()

#define PI acos(-1.0)
#define INF 2e9
#define MOD 1e9 + 7
#define EPS 1e-6

#define fast ios::sync_with_stdio(false); cin.tie(nullptr)

int main(){
    fast;
    int n;
    cin >> n;
    vector<int> v(n);
    forn(i, n) cin >> v[i];
    int mx = 0;
    int ans = 1;
    fore( i, 2, 1001 ){
        int cnt = 0;
        forn( j, n){
            if( v[j] % i == 0 ) cnt++;
        }
        if( mx < cnt ){
            ans = i;
            mx = cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N;
    vector<int> A(100);
    cin >> N;
    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int maxcount = 0, count, ans;
    for (size_t i = 2; i <= 1000; i++)
    {
        count = 0;
        for (size_t j = 0; j < N; j++)
        {
            if (A[j] % i == 0)
            {
                count++;
            }
        }
        if (count >= maxcount)
        {
            maxcount = count;
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(int)(n);k++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yes(ans) if(ans)printf("yes\n");else printf("no\n")
#define Yes(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YES(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector1d(type,name,...) vector<type>name(__VA_ARGS__)
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define vector3d(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
const int MOD2=998244353;
const int INF=1<<30;
const ll INF2=(ll)1<<60;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T,class L>void scan(pair<T, L>& p){scan(p.first);scan(p.second);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T,class L>void print(const pair<T, L>& p){print(p.first);putchar(' ');print(p.second);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll updivide(ll a,ll b){if(a%b==0) return a/b;else return (a/b)+1;}
template<class T> void chmax(T &a,const T b){if(b>a)a=b;}
template<class T> void chmin(T &a,const T b){if(b<a)a=b;}

int main(){
    codefor{
        LL(l,r);
        ll ans=0,n=r-2*l+1;
        if(n>=0){
            ans=n*n;
            ans-=n*(n-1)/2;
        }
        out(ans);
    }
}

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int, int>;

int main() {
    ll T;
    cin >> T;
    rep(i, T) {
        ll L, R;
        cin >> L >> R;
        if (R - L < L) {
            cout << 0 << endl;
            continue;
        }
        ll a = (R - 2 * L + 1);
        ll b = (R - 2 * L + 2);
        if (a % 2 == 0) a /= 2;
        else b /= 2;
        ll ans = a * b;
        cout << ans << endl;
    }

    return 0;
}