#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pl = pair<ll, ll>;
using Vs = vector<string>;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;//10の18乗
#define yn {puts("Yes");}else{puts("No");}
#define dame { puts("-1"); return 0;}

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    if(a*a+b*b<c*c) yn;
}

#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define mk make_pair
#define ll long long
#define ss second
#define ff first
#define mod 1000000007
#define w(x) ll x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi acos(-1)
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define de(n) ll n;cin>>n;
#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}
#define defi(a,n,k) ll n;cin>>n; ll k;cin>>k;ll a[n];re(i,n){cin>>a[i];}
#define deb(x) cout<<#x<<"="<<x<<endl;
#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define nl cout<<endl;
using namespace std;
//18-1326D1 1208B 845C 912B 1009B 1350C 20C 1333C 1234D 1327C 1305B 1304B (or in matrix) 1216-C(26) 21
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    cp();
    de(n);
    ll a[n],p[n],x[n];
    ll ans=LLONG_MAX;
    bool f=0;
    re(i,n)
    {
        cin>>a[i]>>p[i]>>x[i];
        if(x[i]-a[i]>0)
        {
            f=1;
            ans=min(ans,p[i]);
        }
    }
    if(f)
    cout<<ans;
    else{
        cout<<"-1";
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;

const int N = 2e5 + 5;
const ll P = 998244353LL;

int n, tot, head[N], ans[N], dis[N], fa[N], diaSon[N];
bool vis[N], inDia[N];
vector <int> son[N];

struct Edge {
    int to, nxt;
} e[N << 1];

inline void add(int from, int to) {
    e[++tot].to = to;
    e[tot].nxt = head[from];
    head[from] = tot;
}

template <typename T>
inline void read(T &X) {
    char ch = 0; T op = 1;
    for (X = 0; ch > '9' || ch < '0'; ch = getchar())
        if (ch == '-') op = -1;
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        X = (X * 10) + ch - '0';
    X *= op;
}

void dfs(int x, int fat) {
    for (int i = head[x]; i; i = e[i].nxt) {
        int y = e[i].to;
        if (y == fat) continue;
        fa[y] = x;
        dis[y] = dis[x] + 1;
        dfs(y, x);
    }
}

void makeFlag(int x, int fat, int b) {
    if (x == b) inDia[x] = 1;
    for (int i = head[x]; i; i = e[i].nxt) {
        int y = e[i].to;
        if (y == fat) continue;
        makeFlag(y, x, b);
        if (inDia[y]) inDia[x] = 1;
    }
}

// void getAns(int x, int now, int b) {
//     vis[x] = 1;
//     if (ans[x] == 0) ans[x] = now;
//     if (x == b) return;
//     bool flag = 0;
//     int son = 0, sonInDia = 0;
//     for (int i = head[x]; i; i = e[i].nxt) {
//         int y = e[i].to;
//         if (y == fa[x]) continue;
//         if (inDia[y]) {
//             sonInDia = y;
//             continue;
//         }
//         if (vis[y]) continue;
//         flag = 1;
//         son = y;
//         break;
//     }
//     if (flag) getAns(son, now + 1, b);
//     else {
//         if (sonInDia == 0) getAns(fa[x], now + 1, b);
//         else getAns(sonInDia, now + 1, b);
//     }
// }

void getAns(int x, int now, int b) {
    vis[x] = 1;
    if (ans[x] == 0) ans[x] = now;
    if (x == b) return;
    if (!son[x].empty()) {
        int nowSon = son[x][son[x].size() - 1];
        son[x].pop_back();
        getAns(nowSon, now + 1, b);
    } else {
        if (diaSon[x] == 0) getAns(fa[x], now + 1, b);
        else getAns(diaSon[x], now + 1, b);
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("sample.in", "r", stdin);
    clock_t st_clock = clock();
#endif

    read(n);
    for (int x, y, i = 1; i < n; i++) {
        read(x), read(y);
        add(x, y), add(y, x);
    }
    dis[1] = 0;
    dfs(1, 0);
    int a = 1;
    for (int i = 2; i <= n; i++)
        if (dis[i] > dis[a]) a = i;
    dis[a] = 0;
    dfs(a, 0);
    int b = 1;
    for (int i = 2; i <= n; i++)
        if (dis[i] > dis[b]) b = i;
    makeFlag(a, 0, b);
    for (int x = 1; x <= n; x++) {
        for (int i = head[x]; i; i = e[i].nxt) {
            int y = e[i].to;
            if (y == fa[x]) continue;
            if (inDia[x] && inDia[y]) diaSon[x] = y;
            else son[x].push_back(y);
        }
    }
    getAns(a, 1, b);
    for (int i = 1; i <= n; i++)
        printf("%d%c", ans[i], " \n"[i == n]);

#ifndef ONLINE_JUDGE
    clock_t ed_clock = clock();
    printf("time = %f ms\n", (double)(ed_clock - st_clock) / CLOCKS_PER_SEC * 1000);
#endif
    return 0;
}

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

string sdouble(string s) {
  int n = s.size();
  string s2(n*2,'a');
  for (int i = 0; i < n; i++) {
    s2[i*2] = s[i];
    s2[i*2+1] = s[i];
  }
  return s2;
}

string ssign(string s) {
  int n = s.size();
  string s2(n*2,'a');
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') {
      s2[i*2] = 'A';
      s2[i*2+1] = 'B';
    }
    else {
      s2[i*2] = 'B';
      s2[i*2+1] = 'A';
    }
  }
  return s2;
}

int main() {

  int N;
  cin >> N;

  int m = 1;
  for (int i = 0; i < N; i++) {
    m *= 2;
  }

  cout << m-1 << endl;

  vector<string> group(m);

  group[0] = "A";

  int m2 = 1;
  for (int i = 0; i < N; i++) {
    for (int i = 0; i < m2; i++) {
      group[i+m2] = ssign(group[i]);
      group[i] = sdouble(group[i]);
    }
    m2 *= 2;
  }

  for (int i = 1; i < m; i++) {
    cout << group[i] << endl;
  }

return 0;
}


#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;

int main(){
  long n;
  cin >> n;
  vector<long> ans;
  for(int i=1;i<sqrt(n)+1;i++){
    if(n%i==0){
      ans.push_back(i);
      if(i*i != n)ans.push_back(n/i);
    }
  }
  sort(ans.begin(), ans.end());
  rep(i,(int)ans.size()){
    cout << ans[i] << endl;
    while(i+1 < (int)ans.size() && ans[i] == ans[i+1])i++;
  }
  return 0;
}

#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int main() {
	long long int n,i;
	cin >>n;

	set<long long int> s;

	for(i=1;i<=sqrt(n);i++){
	    if(n%i==0){
	      s.insert(i);
	      s.insert(n/i);
		}
	}

	for(auto it=s.begin();it!=s.end();it++){
	  cout<<*it<<endl;
	}

	return 0;
}


/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
ostream& operator<<(ostream& os, lpair& h){ os << "(" << h.first << ", " << h.second << ")"; return os;}
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
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; }

void solve(){
    ll A,B;
    cin >> A >> B;
    vll ans;
    ll sum = 0;
    if(A <= B){
        rep(i,0,B){
            ans.push_back(-(i+1));
            sum += i+1;
        }
        rep(i,0,A-1){
            ans.push_back(i+1);
            sum -= i+1;
        }
        ans.push_back(sum);

    }else{
        rep(i,0,A){
            ans.push_back((i+1));
            sum += i+1;
        }
        rep(i,0,B-1){
            ans.push_back(-(i+1));
            sum -= i+1;
        }
        ans.push_back(-sum);

    }
    printa(ans, ans.size());

}

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

#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x){
	x=0;char ch=getchar();bool f=false;
	while(!isdigit(ch)){if(ch=='-'){f=true;}ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	x=f?-x:x;
	return ;
}
template <typename T>
inline void write(T x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10^48);
	return ;
}
const int N=3e5+5;
int n,m;
#define ll long long
int main(){
	read(n),read(m);
	if(n>m){
		for(int i=1;i<=n;i++) cout<<i<<" ";
		for(int i=1;i<=m-1;i++) cout<<-i<<" ";
		cout<<-(n*(n+1)/2-(m-1)*(m)/2);
	}
	else if(m>n){
		for(int i=1;i<=n-1;i++) cout<<i<<" ";
		for(int i=1;i<=m;i++) cout<<-i<<" ";
		cout<<-((n)*(n-1)/2-(m+1)*m/2);
	}
	else for(int i=1;i<=n;i++) cout<<i<<" "<<-i<<" ";
	return 0;
}


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

int main()
{
    int numa, numb;
    cin >> numa >> numb;
    cout << numa* 2 + 100 - numb;
    return 0;
}

#include <iostream>
#include<bits/stdc++.h>
#define pb(x) push_back(x)
#define ll long long
#define fr(i, n) for(int i=0; i<n; i++)
#define fr1(i, a, b) for(int i=a; i<=b; i++)
#define fr2(i, a, b) for(int i=a; i>=b; i--)
#define srt(a) sort(a.begin(), a.end())
#define frit(it, m) for(auto it=m.begin(); it!=m.end(); it++)
#define fritr(it, m) for(auto it=m.rbegin(); it!=m.rend(); it++)
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<long>
#define vll vector<long long>
#define MAX(a,b) (a>=b)?a:b
#define MIN(a,b) (a<=b)?a:b

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b;
    cin>>a>>b;
    cout<<(2*a + 100)-b;
	return 0;
}


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

int main(){
  int x,y; cin>>x>>y;
  if(x>y){
    if(y+3>x) cout<<"Yes";
    else cout<<"No";
  }
  else if(y>x){
    if(x+3>y) cout<<"Yes";
    else cout<<"No";
  }
}

#include<bits/stdc++.h>
#define ll long long int
#define mii map<int,int>
#define qi queue<int>
#define pqi priority_queue<int>
#define pqgi priority_queue<int,vector<int>,greater<int>>
#define si set<int>
#define vi vector<int>
#define vll vector<long long int>
#define vii vector<pair<int,int>>
#define mii map<int,int>
#define ii pair<int,int>
#define SYNC ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define f(i,a,b) for(int i=a;i<b;i++)
#define rf(j,c,d) for(int j=c;j>d;j--)
#define mod 1000000007
#define mo 998244353
#define inf 1e18
#define F first
#define S second
#define ld long double
#define INF (int)INT_MAX
#define PI 3.1415926535898
using namespace std;
const int N=1e5+5;
clock_t timeStart, timeFinish;
void timeBegin(){
    timeStart = clock();
}
void timeEnd() {
    timeFinish = clock();
}
void timeDuration() {
    double time_taken = double(timeFinish - timeStart) / double(CLOCKS_PER_SEC);
    cout << "Time taken by program is : " << fixed << time_taken << setprecision(5);
    cout << " sec " << endl;
}
/*ll po(ll A,ll B)
{
    ll RES=1;
    while(B)
    {
        if(B&1)
            RES*=A;
        B>>=1;
        A*=A;
    }
    return RES;
}*/
/*void sieve(int P)
{
    prime[0]=0;prime[1]=0;
    f(i,2,P+1)
        prime[i]=1;
    f(i,2,P+1)
    {
        if(prime[i]==1)
        {
            for(int j=i*i;j<P+1;j+=i)
            {
                prime[j]=i;
            }
        }
    }
}*/
void solve()
{
    ll x,y;
    cin>>x>>y;
    if(x<y)
        swap(x,y);
    if(x-y<3)
        cout<<"Yes\n";
    else cout<<"No\n";
    return;
}
int main()
{
    SYNC
    //sieve();
    int t=1;
    //cin>>t;
    f(i,0,t)
        //cout<<"Case #"<<i+1<<":"
        solve();
    //timeDuration();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n],b[n];
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  int ans=0;
  int mx=0;
  rep(i,n){
    mx=max(mx,a[i]);
    ans=max(ans,mx*b[i]);
    cout<<ans<<endl;
  }

  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<P> x(n);
  bool ok = false;
  rep(i, n) cin >> x[i].first >> x[i].second;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = j+1; k < n; k++) {
        P a = P(x[i].first-x[j].first, x[i].second-x[j].second);
        P b = P(x[i].first-x[k].first, x[i].second-x[k].second);
        if (a.first*b.second == a.second*b.first) {
          ok = true;
          break;
        }
      }
    }
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
#define repc(i,f,n) for(char i=(f); (i) <= (n); i++)
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define Pl pair<ll, ll>
#define dvec vector<vector<ll>>
#define OUT(x) cout << x << endl; return 0;
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmaxe(T& a, T b){if (a <= b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
const ll MOD = 1000000007ll;
const ll INF = 1e+18;
const int iINF = 1e9;
const double EPS = 1e-8;

int main()
{
  int N, W; cin >> N >> W;
  cout << N / W << endl;

}

#include<bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef long double f128;
using namespace std;

template<u64 mod>
class modint{
public:
  u64 val;
  constexpr modint(const u64 x=0) noexcept:val(x%mod){}
  constexpr u64 &value() noexcept{
    return val;
  }
  constexpr const u64 &value() const noexcept{
    return val;
  }
  constexpr modint operator+(const modint rhs) const noexcept{
    return modint(*this)+=rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept{
    return modint(*this)-=rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept{
    return modint(*this)*=rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept{
    return modint(*this)/=rhs;
  }
  constexpr modint operator^(const u64 rhs) const noexcept{
    return modint(*this)^=rhs;
  }
  constexpr bool operator==(const modint rhs) const noexcept{
    return (*this).val==rhs.val;
  }
  constexpr bool operator!=(const modint rhs) const noexcept{
    return (*this).val!=rhs.val;
  }
  constexpr modint &operator+=(const modint rhs) noexcept{
    val+=rhs.val;
    if(val>=mod){
      val-=mod;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept{
    if(val<rhs.val){
      val+=mod;
    }
    val-=rhs.val;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept{
    val=val*rhs.val%mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept{
    u64 exp=mod-2;
    while(exp){
      if(exp&1){
        (*this)*=rhs;
      }
      rhs*=rhs;
      exp>>=1;
    }
    return *this;
  }
  constexpr modint &operator^=(u64 rhs) noexcept{
    modint a=(*this);
    (*this)=1;
    while(rhs){
      if(rhs&1){
        (*this)*=a;
      }
      a*=a;
      rhs>>=1;
    }
    return *this;
  }
  friend constexpr ostream &operator<<(ostream &os,const modint &x) noexcept{
    return os<<(x.val);
  }
  friend constexpr istream &operator>>(istream &is,modint &x) noexcept{
    u64 t;
    is>>t;
    x=t;
    return is;
  }
};

template<typename T>
void scan(T& n){
  cin>>n;
}

template<typename T,typename U>
void scan(pair<T,U>& p){
  cin>>p.first>>p.second;
}

void scan(){}

template<typename T,class... Args>
void scan(T& n,Args&... args){
  scan(n);
  scan(args...);
}

template<typename T>
void scanall(T start,T end){
  for(;start!=end;++start){
    scan(*start);
  }
}

template<typename T>
void print(T n){
  cout<<n;
}

template<typename T,typename U>
void print(pair<T,U> p){
  cout<<'{'<<p.first<<','<<p.second<<'}';
}

void print(){}

template<typename T,class... Args>
void print(T n,Args... args){
  print(n);
  print(args...);
}

template<typename T>
void println(T n){
  print(n);
  cout<<endl;
}

template<typename T,class... Args>
void println(T n,Args... args){
  print(n,' ');
  println(args...);
}

template<typename T>
void printall(T start,T end){
  if(start!=end){
    print(*start);
    for(++start;start!=end;++start){
      print(' ',*start);
    }
  }
  cout<<endl;
}

template<typename T>
T chmax(T& n,T m){
  return n=max(n,m);
}

template<typename T>
T chmin(T& n,T m){
  return n=min(n,m);
}

template<typename T,typename U>
T power(T a,U n){
  T res=1;
  while(n){
    res*=(n&1)?a:1;
    a*=a;
    n>>=1;
  }
  return res;
}

template<typename T>
struct combination{
  vector<T> fact;
  combination(const int Max=10000000):fact(Max+1,1){
    for(int i=2;i<=Max;++i){
      fact[i]=fact[i-1]*(T)i;
    }
  }
  template<typename U>
  T nCk(U n,U k){
    if(n<k||n<0||k<0){
      return 0;
    }
    return fact[n]/fact[k]/fact[n-k];
  }
};

void solve();

int main(){
  cout<<fixed<<setprecision(15);
  bool is_multitestcase=0;
  int T=1;
  if(is_multitestcase){
    scan(T);
  }
  for(int i=0;i<T;++i){
    solve();
  }
  return 0;
}

void solve(){
  typedef modint<1000000007> mint;
  combination<mint> COM(3000000);
  i64 N,M,K;
  scan(N,M,K);
  if(M+K<N){
    println(0);
    return;
  }
  println(COM.nCk(N+M,N)-COM.nCk(N+M,N-(K+1)));
}


#include <bits/stdc++.h>

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S[3]; cin >> S[0] >> S[1] >> S[2];
    map<char, int> mp;
    int idx = 0;
    rep(i, 3){
        rep(j, S[i].length()){
            if(!mp.count(S[i][j])){
                mp[S[i][j]] = idx;
                idx++;
            }
        }
    }
    if(mp.size() > 10) cout << "UNSOLVABLE" << endl;
    else{
        vector<int> vec(10, 0);
        rep(i, 10) vec[i] = i;
        do{
            bool cont = true;
            ll v[3];
            rep(i, 3){
                string val = "";
                rep(j, S[i].length()){
                    val += ('0' + vec[mp[S[i][j]]]);
                }
                if(val[0] == '0'){
                    cont = false;
                    break;
                }
                v[i] = stoll(val);
            }
            if(cont){
                if(v[0] + v[1] == v[2]){
                    cout << v[0] << endl;
                    cout << v[1] << endl;
                    cout << v[2] << endl;
                    return 0;
                }
            }
        }while(next_permutation(vec.begin(), vec.end()));
        cout << "UNSOLVABLE" << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll i = s; i < e; i++)
#define rrep(i, s, e) for (ll i = s; i > e; i--)

int main() {
  ll A, B, W;
  cin >> A >> B >> W;
  W *= 1000;
  ll cnt_a = W / A, cnt_b = W / B;
  if (cnt_a != cnt_b) cout << cnt_b + (W % B != 0) << " " << cnt_a;
  else if ((W % A) * (W % B) == 0) cout << cnt_a << " " << cnt_a;
  else cout << "UNSATISFIABLE";
}


#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <numeric>
#include <iomanip>
#include <algorithm>
using namespace std;

string rus;
int point = 0;

void move(vector<vector<int>> &mdata, vector<vector<int>> &pdata, vector<int> cdata,int x,int y,int p,int dir, string sdata){
	if (point < p) {
		rus = sdata;
		point = p;
	}
	if (x > 50 || y > 50 || x <= 0 || y <= 0) {
		return;
	}
	if (cdata.at(mdata.at(y).at(x)) == 0) {
		return;
	}
	cdata.at(mdata.at(y).at(x)) = 0;
	p = p + pdata.at(y).at(x);

	if (dir == 1)
		sdata += 'D';
	else if (dir == 2)
		sdata += 'U';
	else if (dir == 3)
		sdata += 'R';
	else if (dir == 4)
		sdata += 'L';

	map<int, int> hp;
	int cnt = 0;
	if(cdata.at(mdata.at(y + 1).at(x)) != 0)
		hp[pdata.at(y + 1).at(x)] = 1;
	if (cdata.at(mdata.at(y - 1).at(x)) != 0)
		hp[pdata.at(y - 1).at(x)] = 2;
	if (cdata.at(mdata.at(y).at(x + 1)) != 0)
		hp[pdata.at(y).at(x + 1)] = 3;
	if (cdata.at(mdata.at(y).at(x - 1)) != 0)
		hp[pdata.at(y).at(x - 1)] = 4;

	for (auto i = hp.rbegin();i != hp.rend();i++) {
		if (i->second == 1) {
			move(mdata, pdata, cdata, x, y + 1, p, 1, sdata);
		}
		else if (i->second == 2) {
			move(mdata, pdata, cdata, x, y - 1, p, 2, sdata);
		}
		else if (i->second == 3) {
			move(mdata, pdata, cdata, x + 1, y, p, 3, sdata);
		}
		else {
			move(mdata, pdata, cdata, x - 1, y, p, 4, sdata);
		}

		//cout << i->second << endl;
		cnt++;
		if (cnt == 1 && dir != 0) break;
	}
}

int main(void) {
	int sx, sy;
	string sdata;

	cin >> sy >> sx;

	vector<int> cdata(52 * 52, 0);
	vector<vector<int>> mdata(52, vector<int>(52));
	vector<vector<int>> pdata(52, vector<int>(52));
	for (int i = 1;i <= 50;i++) {
		for (int j = 1;j <= 50;j++) {
			cin >> mdata.at(i).at(j);
			cdata.at(mdata.at(i).at(j)) = 1;
		}
	}
	for (int i = 1;i <= 50;i++) {
		for (int j = 1;j <= 50;j++) {
			cin >> pdata.at(i).at(j);
		}
	}
	move(mdata,pdata, cdata, sx+1, sy+1,pdata.at(sy+1).at(sx+1),0,sdata);

	cout << rus << endl;
}

#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
    char c=getchar();bool f=0;x=0;
    while(!isdigit(c)) f|=c=='-',c=getchar();
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
    if(f) x=-x;return x;
}
template<class t> inline void write(t x){
    if(x<0) putchar('-'),write(-x);
    else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=505;
int n,a[N],b[N],c[N][N];

signed main(){
	read(n);
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) read(c[i][j]);
	for(int i=1;i<=n;i++) a[i]=c[i][1]-c[1][1];
	for(int i=1;i<=n;i++) b[i]=c[1][i];
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(a[i]+b[j]!=c[i][j]) return puts("No"),0;
	int ma=*min_element(a+1,a+1+n),mb=*min_element(b+1,b+1+n);
	if(ma+mb<0) return puts("No"),0;
	puts("Yes");
	for(int i=1;i<=n;i++) write(a[i]-ma),putchar(' ');puts("");
	for(int i=1;i<=n;i++) write(b[i]+ma),putchar(' ');
}


#include <bits/stdc++.h>
using namespace std;
// typedef
using ll  = long long;
using str = string;
using PL  = pair<ll, ll>;
using P   = pair<int, int>;
using VL  = vector<ll>;
using VI  = vector<int>;
using VS  = vector<str>;
using VP  = vector<P>;
using VPL = vector<PL>;
using VVL = vector<VL>;
using VVI = vector<VI>;

// const num
const ll INF         = 1e18 + 18;
const ll MAX         = 100005;
const ll MOD         = 1000000007;
const long double PI = acosl(-1.0);

// loop
#define REP(i, a, b) for(ll(i) = (a); (i) < (b); (i)++)
#define RREP(i, a, b) for(ll(i) = (a); (i) >= (b); (i)--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)

// YesNo
#define Yes(n) cout << ((n) ? "Yes": "No") << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
// All
#define ALL(v) v.begin(), v.end()
#define deduplicate(v) (v).erase(unique(ALL(d)), (v).end())

int main(void){
    int a,b;
    int asum = 0;
    int bsum = 0;
    cin >> a >> b;
    rep(i,3){
        asum += (a%10);
        bsum += (b%10);
        a/=10;
        b/=10;
    }
    cout << max(asum,bsum) << endl;
    return 0;
}

#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <iostream>
#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;

int main()
{
	string s, t;
	cin >> s >> t;
	int a = 0, b = 0;
	for (int i = 0; i < 3; i++) {
		a += s[i] - '0';
		b += t[i] - '0';
	}
	cout << max(a, b) << endl;

	return 0;
}


// WIP

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

#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
namespace std {
template<class ...Ts>        istream& operator>>(istream& i,       tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; auto s = ""; apply([&](auto&&... y){ ((o << s << y, s = ", "), ...); }, x); return o << ")"; }
template<class T1, class T2> istream& operator>>(istream& i,       pair<T1, T2>& x) { return i >> tie(x.first, x.second); }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { return o << tie(x.first, x.second); }
template<class T, class = decltype(begin(declval<T>())), class = enable_if_t<!is_same<T, string>::value>>
istream& operator>>(istream& i,       T& x) { for (auto& y : x) { i >> y; } return i; }
template<class T, class = decltype(begin(declval<T>())), class = enable_if_t<!is_same<T, string>::value>>
ostream& operator<<(ostream& o, const T& x) { o << "{"; auto s = ""; for (auto& y : x) { o << s << y; s = ", "; } return o << "}"; }
}

#ifdef DEBUG
#define dbg(...) do { cout << #__VA_ARGS__ ": " << make_tuple(__VA_ARGS__) << endl; } while (0)
#define dbg2(X) do { cout << #X ":\n"; for (auto& __x : (X)) { cout << __x << endl; } } while (0)
#else
#define dbg(...)
#define dbg2(X)
#endif

using Real = long double;

// Main
void mainCase() {
  int n;
  cin >> n;
  vector<Real> xs(n);
  cin >> xs;

  array<Real, 3> res = {};
  for (auto x : xs) {
    res[0] += abs(x);
    res[1] += x * x;
    res[2] = max(res[2], abs(x));
  }
  res[1] = sqrt(res[1]);

  FOR(i, 0, 3) {
    cout << setprecision(numeric_limits<Real>::digits10 + 1) << res[i] << "\n";
  }
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  mainCase();
  return 0;
}

/*
python misc/run.py atcoder/abc180/b/main.cpp

{{TESTS}}
*/

#include <cstdio>

using ll = long long int;
int cnt[405];
int N;

int main(){
    scanf("%d",&N);

    for(int i=0;i<N;i++){
        int tmp;
        scanf("%d",&tmp);
        cnt[tmp+200]++;
    }
    ll ans=0ll;
    for(int i=0;i<=400;i++){
        for(int j=i+1;j<=400;j++){
            ll diff=j-i;
            // if (cnt[i]&&cnt[j])
            //     printf("diff=%lld\n",diff);
            ans+=(diff*diff*cnt[i]*cnt[j]);
        }
    }

    printf("%lld\n",ans);

    return 0;
}


#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
using Graph = vector<vector<int>>;
const ll INF = 1LL << 62;
const double PI = acos(-1);
const ll mod = 998244353;
const ll MOD = 1000000007;
template<class T> void chmin(T &a,T b){if(a>b)a=b;}
template<class T> void chmax(T &a,T b){if(a<b)a=b;}

int main(){
  int N;cin >> N;
  int ans;
  if(N%100 == 0) ans = N/100;
  else ans = N/100+1;
  cout << ans << endl;
}

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// #include <atcoder/all>
/*
cd $dir && g++ -std=c++17 -Wall -Wextra -O2 -DATCODERDEBUG
-I/mnt/d/MyProjects/atcoder/lib/ac-library $fileName && echo 'compilation ok!'
&&  ./a.out
*/
using namespace std;
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define ALL(x) x.begin(), x.end()
#define dame(a)        \
  {                    \
    cout << a << endl; \
    return 0;          \
  }
typedef long long ll;

ll __per__(ll a, ll b) {
  if (a >= 0) return a % b;
  return (((-a - 1LL) / b) + 1LL) * b + a;
}

class dstream : public ostream {};

template <typename T>
dstream &operator<<(dstream &os, const T &v) {
#ifdef ATCODERDEBUG
  cout << "\033[1;31m" << v << "\033[0m";
#endif
  return os;
}

ostream &endd(std::ostream &out) {
#ifdef ATCODERDEBUG
  out << std::endl;
#endif
  return out;
}
dstream dout;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[ ";
  for (auto const &x : v) {
    os << x;
    if (&x != &v.back()) {
      os << " : ";
    }
  }
  os << " ]";
  return os;
}

ostream &operator<<(ostream &os, const vector<bool> &v) {
  os << "[ ";
  for (size_t i = 0; i < v.size(); i++) {
    os << v[i];
    if (i != v.size() - 1) {
      os << " : ";
    }
  }
  os << " ]";
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  os << "[" << endl;
  for (auto const &x : v) {
    os << " ";
    os << x;
    os << endl;
  }
  os << "]";
  return os;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &v) {
  os << "{" << endl;
  for (auto const &x : v) {
    os << " ";
    os << x;
  }
  os << "}" << endl;
  return os;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const unordered_map<T, U> &v) {
  os << "{" << endl;
  for (auto const &x : v) {
    os << " ";
    os << x;
  }
  os << "}" << endl;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "{";
  for (auto const &x : v) {
    os << " ";
    os << x;
  }
  os << " }" << endl;
  return os;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const unordered_set<T, U> &v) {
  os << "{";
  for (auto const &x : v) {
    os << " ";
    os << x;
  }
  os << " }" << endl;
  return os;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
  os << v.first << " : " << v.second << endl;
  return os;
}

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {}) {
  if (comp(xmax, x)) {
    xmax = x;
    return true;
  }
  return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {}) {
  if (comp(x, xmin)) {
    xmin = x;
    return true;
  }
  return false;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  ll ans = (N + 99) / 100;
  cout << ans << endl;
  // cout << std::fixed << std::setprecision(15) << sqrt(ans) << endl;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
#define per(i,n) for(ll (i)=(n)-1;(i)>=0;--(i))
#ifdef LOCAL
#define debug(x) cerr<<__LINE__<<": "<<#x<<"="<<x<<endl;
#define debugALL(x) cerr<<__LINE__<<": "<<#x<<"=";for(auto i=(x).begin();i!=--(x).end();i++)cerr<<*i<<" ";cerr<<*--(x).end()<<endl;
#else
#define debug(x) true
#define debugALL(x) true
#endif
using namespace std;

long long mod=1e9+7;
struct mint{
    long long x;
    mint(long long 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(long long t)const{
        if(!t)return 1;
        mint a=pow(t>>1);
        a*=a;
        if(t&1)a*=*this;
        return a;
    }
    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;}
};
istream& operator>>(istream& is,mint& a){return is>>a.x;}
ostream& operator<<(ostream& os,const mint& a){return os<<a.x;}

int main(){
    ll n;
    cin>>n;
    vector<vector<P>> g(n,vector<P>());
    rep(i,n-1){
        ll u,v,w;
        cin>>u>>v>>w;
        u--;v--;
        g[u].emplace_back(v,w);
        g[v].emplace_back(u,w);
    }
    stack<P> sta;
    sta.emplace(0,0);
    vector<bool> used(n,false);
    used[0]=true;
    V sum(n);
    while(sta.size()){
        ll now=sta.top().first;
        ll w=sta.top().second;
        sta.pop();
        sum[now]=w;
        for(auto next:g[now]){
            if(used[next.first])continue;
            used[next.first]=true;
            sta.emplace(next.first,next.second^w);
        }
    }
    V cnt(60,0);
    rep(i,n){
        rep(k,60){
            if(sum[i]&1ll<<k)cnt[k]++;
        }
    }
    V ans(60,0);
    rep(i,n){
        rep(k,60){
            if(sum[i]&1ll<<k){
                ans[k]+=n-cnt[k];
            }else{
                ans[k]+=cnt[k];
            }
        }
    }
    mint tmp=0;
    rep(i,60){
        tmp+=mint(ans[i]/2)*mint(2).pow(i);
    }
    cout<<tmp<<endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, m;
  cin >> n >> m;
  vector<vector<P>> cond(n + 1);
  REP(i, m) {
    ll x, y, z;
    cin >> x >> y >> z;
    cond[x].push_back({y, z});
  }
  ll N = 1LL << n;
  vector<ll> dp(N, 0);
  dp[0] = 1;
  REP(bit, N) if (dp[bit] > 0) {
    vector<ll> a;
    REP(i, n) {
      if (bit & (1LL << i)) {
        a.push_back(i + 1);
      }
    }
    REP(i, n) {
      if (bit & (1LL << i)) {
        continue;
      }
      bool ok = true;
      for (P p : cond[SZ(a) + 1]) {
        ll y = p.first, z = p.second;
        ll cnt = 0;
        for (ll x : a) {
          if (x <= y) {
            cnt++;
          }
        }
        if (i + 1 <= y) {
          cnt++;
        }
        if (cnt > z) {
          ok = false;
          break;
        }
      }
      if (ok) {
        ll nxt = bit | (1LL << i);
        dp[nxt] += dp[bit];
      }
    }
  }

  cout << dp[N - 1] << endl;
}


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

#define ll long long
#define pb push_back
#define pii pair <int, int>
#define vi vector<int>

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define FORd(i, a, b) for (int i=a-1; i>=b; i--)
#define F0Rd(i, a) for (int i=a-1; i>=0; i--)
#define F0R(i, a) for (int i=0; i<a; i++)

#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
long double PI = 4*atan(1);
/*std::cout << std::fixed << std::setprecision(2);
ll po (ll b, ll p) return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD;
ll inv (ll b) { return po(b,MOD-2); }*/

ll n,a[50],frq[50],x,ans=1;
vi v[50];
bool visited[50];

void solve() {
	cin >> n;
	F0R(i,n) {
		cin >> x;
		FOR(j,2,50) {
			if (x%j == 0) v[i].pb(j);
			while (x%j == 0) x /= j;
		}
	}
	// F0R(i,n) {
	// 	for (int j:v[i]) cout << j << " ";
	// 	cout << "\n";
	// }
	while (1) {
		int flag = 0,MxF = 0,MxN = -1;
		F0R(i,50) frq[i] = 0;
		F0R(i,n) {
			if (visited[i]) continue;
			flag = 1;
			for (int j:v[i]) frq[j]++;
		}
	    if (!flag) break;
	    F0R(i,50) if (frq[i] > MxF) MxF = frq[i],MxN = i;
	    ans = ans*(ll)(MxN);
	    F0R(i,n) {
	    	if (!visited[i]) {
	    		for (int j:v[i]) {
	    			if (j == MxN) visited[i] = true;
	    		}
	    	}
	    }
	}
	cout << ans;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    int test_cases = 1;
    //cin >> test_cases;
    F0R(i,test_cases) {
    	solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long ans;
void noanswer() {
	puts("-1");
	exit(0);
}
int a[100005], b[100001];
struct info {
	int cnt, p;
};
info seq[100001];
int tot;
void solve(int l, int r) {
	int p = l-1;
	while (p < r && a[p+1] > b[p+1]) ++p;
	for (int i = p+1; i <= r; i++)
		if (a[i] > b[i]) noanswer();
	for (int i = l-1; i <= p; i++) {
		if (seq[tot].p + seq[tot].cnt == a[p]) ++seq[tot].cnt;
		else ++tot, seq[tot].cnt = 1, seq[tot].p = a[i];
	}
	for (int i = p; i >= l; i--) {
		int num = 0;
		while (tot > 1 && seq[tot].p + seq[tot].cnt - 1 + num > b[i]) num += seq[tot].cnt, --tot;
		if (seq[tot].p + seq[tot].cnt - 1 + num != b[i]) noanswer();
		ans += num, seq[tot].cnt += num-1;
	}
	tot = 0;
	for (int i = r+1; i > p; i--) {
		if (seq[tot].p - seq[tot].cnt == a[p]) ++seq[tot].cnt;
		else ++tot, seq[tot].cnt = 1, seq[tot].p = a[i];
	}
	for (int i = p+1; i <= r; i++) {
		int num = 0;
		while (tot > 1 && seq[tot].p - seq[tot].cnt + 1 - num < b[i]) num += seq[tot].cnt, --tot;
		if (seq[tot].p - seq[tot].cnt + 1 - num != b[i]) noanswer();
		ans += num, seq[tot].cnt += num-1;
	}
}
int main() {
	int n, l;
	cin >> n >> l;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	a[0] = 0, a[n+1] = l+1;
	int last = 1;
	for (int i = 1; i <= n; i++)
		if (a[i] == b[i]) {
			if (last != i) solve(last, i-1);
			last = i+1;
		}
	if (last <= n) solve(last, n);
	cout << ans << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define REPA(i,j) for(int i=1;i<=j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const int INF=1<<30;
//const ll INF=1ll<<60;
const ll MOD=1e9+7;
inline void read(int &x){
//	short neg=1;
	x=0;
	char c=getchar();
	/*while(c<'0'||c>'9'){
		if(c=='-')neg=-1;
		c=getchar();
	}*/
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+(c^48),c=getchar();
	}
//	x*=neg;
}
ll quick_mod(ll A,ll B){//A^B
    ll ret=1;
    A%=MOD;
    while(B)
    {
        if(B&1)ret=ret*A%MOD;
        B>>=1;
        A=A*A%MOD;
    }
    return ret;
}
const int MAXN=1e5+10;
ll N;
ll A[MAXN];
int main(void){
	cin>>N;
	REP(i,N)cin>>A[i];
	if(N==1){
		cout<<A[0];
		return 0;
	}
	ll X=A[0]+A[1],Y=A[0]-A[1];
	ll K1=1,K2=1;
	for(int i=2;i<N;i++){
		ll x,y;
		x=(X+A[i]*K1+Y+A[i]*K2)%MOD;
		y=(MOD*1000+X-A[i]*K1)%MOD;
		X=x;
		Y=y;
		ll k1,k2;
		k1=K1+K2;
		k2=K1;
		K1=k1%MOD;
		K2=k2%MOD;
	}
	cout<<(ll)(MOD*3+X+Y)%MOD;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long b,c,x,y;
unsigned long long ans=0;
int main(){
	scanf("%lld%lld",&b,&c);
	if(c==1){
		if(b==0)printf("1");
		else printf("2");
		return 0;
	}
	if(b==0)printf("%lld",c);
	else if(b>0){
		x=c%2;
		y=c/2;
		if(y>=b)ans=2*b+1;
		else if(x)ans=2*y+2;
		else ans=2*y+1;
		x=(c-1)%2;
		y=(c-1)/2;
		if(x)ans+=2*y;
		else ans+=2*y-1;
		printf("%llu",ans);
	}
	else{
		x=(c-1)%2;
		y=(c-1)/2;
		b=-b;
		if(y>=b)ans=2*b+1;
		else if(x)ans=2*y+2;
		else ans=2*y+1;
		b=-b;
		x=c%2;
		y=c/2;
		if(x)ans+=2*y;
		else ans+=2*y-1;
		printf("%llu",ans);
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAX = 10000;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> cnt(MAX);
    for (int i = 0; i < n + m; i++) {
        int x;
        cin >> x;
        ++cnt[x];
    }
    for (int i = 0; i < MAX; i++) {
        if (cnt[i] == 1) {
            cout << i << " ";
        }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

int keta(ll n) {
    return log10(n)+1;
}

ll f() {
    for (int i = 0; i< 10;i++) {}
    for (int j = 0; j< 10;j++) {}
    ll p = 3* 2e18;
    vector<ll> vec;
    vec.push_back(0);
    vec.back();
    vec.pop_back();
    for_each(vec.begin(), vec.end(), [](ll& elem) {
        elem = 4;
    });
    return 0;
}

int main(){
	ll N,M;
	cin>>N>>M;

    vector<ll> A,B;
    for (int i = 0; i< N;i++) {
        ll a;
        cin>>a;
        A.push_back(a);
    }
    for (int i = 0; i< M;i++) {
        ll b;
        cin>>b;
        B.push_back(b);
    }
    reverse(A.begin(),A.end());
    reverse(B.begin(),B.end());
    vector<ll> C;
    while (!A.empty() || !B.empty())
    {
        if (A.empty()) {
            ll b=B.back();
            C.push_back(b);
            B.pop_back();
        } else if (B.empty()){
            ll a =A.back();
            C.push_back(a);
            A.pop_back();
        } else {
            ll a =A.back();
            ll b=B.back();
            if (a<b){
                C.push_back(a);
                A.pop_back();
            } else if (a==b){
                A.pop_back();
                B.pop_back();
            } else {
                C.push_back(b);
                B.pop_back();
            }
        }
    }

    ll cl = C.size();

    for (int i = 0; i< cl;i++) {
        cout<<C[i]<<" ";
    }
    cout<<endl;
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x, y) CPP_CAT_I(x, y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x, y) x##y

#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'017LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

// util {{{
#define FOR(i, start, end) for (i64 i = (start), CPP_CAT(i, xxxx_end) = (end); i < CPP_CAT(i, xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f, c, ...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ##__VA_ARGS__); })(c))
#define ll long long int
#define VI vector<int>
template <typename C>
i64 SIZE(const C &c)
{
    return static_cast<i64>(c.size());
}

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

template <typename T, typename U, typename Comp = less<>>
bool chmax(T &xmax, const U &x, Comp comp = {})
{
    if (comp(xmax, x))
    {
        xmax = x;
        return true;
    }
    return false;
}

template <typename T, typename U, typename Comp = less<>>
bool chmin(T &xmin, const U &x, Comp comp = {})
{
    if (comp(x, xmin))
    {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit
{
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

bool isOK(int mid, double key)
{
}

int binary_search(double key)
{
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

bool isKaibun(string st)
{
    bool ans = true;
    int n = st.length();
    REP(i, n / 2)
    {
        if (st[i] != st[n - i - 1])
        {
            return false;
        }
    }
    return true;
}

int toInt(char a)
{
    return a - '0';
}

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

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

void solve()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N)
    cin >> A[i];

    ll ans = -1;
    ll mans = 2;
    FOR(i, 2, 1001)
    {
        ll sum = 0;
        REP(j, N)
        {
            if (A[j] % i == 0)
            {
                sum++;
            }
        }
        if (ans < sum)
        {
            ans = sum;
            mans = i;
        }
    }
    cout << mans;
}

signed main()
{

    solve();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int int_inf = 1e9;
const LL ll_inf = 1e18;
const int mod = 1000000009;

template <class T>
void sort(T &v) {
  std::sort(v.begin(), v.end());
}
template <class T>
void rsort(T &v) {
  std::sort(v.rbegin(), v.rend());
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;

  int ans = 2;
  int buf = 0;
  for (int i = 2; i <= 1000; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % i == 0) cnt++;
    }

    if (buf < cnt) {
      ans = i;
      buf = cnt;
    }
  }

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


#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF  = 1e9;
constexpr llong  LINF = 1e18;
constexpr double EPS  = 1e-12;
constexpr int    MOD  = 1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a)cerr<<(cnt++?' ':'>')<<elem;cerr<<endl;}

using vl   = vector<long long>;
using vvl  = vector<vl >;
using vvvl = vector<vvl >;
using pll  = pair<long long,long long>;

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

	vl cnt(200,0);
	REP(i,n){
		llong a;
		cin>>a;

		cnt[a%200]++;
	}

	llong ans=0;
	REP(i,200){
		ans+=cnt[i]*(cnt[i]-1)/2;
	}

	cout<<ans<<endl;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main(){
  int n;
  ll k;
  cin >> n >> k;
  vector<pair<ll,ll>> friends(n);
  for(int i=0;i<n;i++){
    ll a,b;
    cin >> a >> b;
    friends[i] = make_pair(a,b);
  }

  sort(friends.begin(), friends.end());

  ll place = 0;
  int vn = 0;
  while(k > 0){
    place += k;
    k = 0;

    for(int i=vn;i<n;i++){
      if(friends[i].first <= place){
        k += friends[i].second;
        vn = i+1;
      }else{
        break;
      }
    }
  }

  cout << place << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define IOS std::ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
using namespace std;

// DEBUG TEMPLATE
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}

void OFFLINE(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
        #define debug(x...) cout << "[" << #x << "] = ["; _print(x)
        #else
            #define debug(x...)
    #endif
}

const int MOD = 1e9 + 7;
int main(){

    IOS;
    OFFLINE();
    //check for corner test cases

    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    vector<vector<int>> brr(k);
    for(auto &x: arr)   cin >> x;
    sort(all(arr));

    if(arr[0] != 0) {
        cout << 0 << "\n";
        return 0;
    }

    int pos = 0, prev = 0, i = 0;
    while(i < n) {
        if(prev != arr[i]) {
            pos = 0;
        }
        if(brr[pos].empty()) {
            if(arr[i] == 0) {
                brr[pos].pb(arr[i]);
            }
        } else {
            if(brr[pos].back() + 1 >= arr[i]) {
                brr[pos].pb(arr[i]);
            }
        }
        prev = arr[i];
        i++;
        pos = (pos + 1) % k;
    }

    int ans = 0;
    for(int i = 0; i < k; i++) {
        if(!brr[i].empty()) {
            ans += brr[i].back() + 1;
        }
    }

    cout << ans << "\n";
    //check for corner test cases
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
using namespace std ;
typedef long long ll ;
const int mod=1000000007;
const int N=1e3 ;

void solve(){

	int n,k;
	cin>>n>>k ;

	vector<int> a(n) ;

	rep(i,n){
		cin>>a[i] ;
	}

	map<int,int> mp ;

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

	int mn=k ;

	ll ans=0 ;

	for(int i=0;i<=n;i++){
		mn=min(mn,mp[i]) ;
		ans+=mn ;
	}

	cout<<ans ;

}

int main(){

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

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

		int y ;

		y=1 ;
		//cin>>y ;

		while(y--){

			solve() ;

		}

		return 0 ;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int R, X, Y;
    cin >> R >> X >> Y;
    double D = hypot(X, Y);
    if (D == R) {
        cout << 1 << endl;
    } else if (D <= 2 * R) {
        cout << 2 << endl;
    } else {
        cout << ceil(D / R) << endl;
    }
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}

//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;

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

	int T;
	cin >> T;
	rep(t, T) {
		ll N, A, B;
		cin >> N >> A >> B;

		ll a = min(A, N - B + 1);
		ll b = min(A + B - 1, N - B + 1);

		ll are = (a + b) * (b - a + 1) + b * (N - A + 1 - (b - a + 1) * 2);
		ll atti = (N - A + 1) * (N - B + 1);

		ll kotae = (atti + are) % mod * ((atti - are) % mod) % mod;
		co(kotae);
	}

	Would you please return 0;
}


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

void solve(int _t)
{
    int n; cin >> n;
    while (n && n % 10 == 0)
        n /= 10;
    string s = to_string(n);
    if (equal(s.begin(), s.end(), s.rbegin()))
        cout << "Yes";
    else
        cout << "No";
}

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(nullptr);
	int T = 1;
	for (int t = 1; t <= T; t++) solve(t);
}

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

//Macros
#define ll long long
#define nl "\n"
#define gl " "
#define pf(x) for(auto a:x) cout<<a.first<<gl<<a.second<<nl;
#define af(x) for(auto a:x) cout<<a<<gl;

//functions

int check_palindrome(string s);

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

	string s;
	cin>>s;
	for(int i=0; i<20; i++){
		if(check_palindrome(s)){
			cout<<"Yes"<<nl;
			return 0;
		}
		s="0"+s;
	}
	cout<<"No"<<nl;
}

int check_palindrome(string s){
	for(int i=0,j=s.size()-1; i<s.size(); i++,j--){
		if(s[i]!=s[j]) return 0;
	}
	return 1;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()

const int N = 3e5 + 99 ;

int seg[4*N] , a[N] , n , q;
void build(int idx = 1 , int l = 0 , int r = n - 1){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if ( l == r ) seg[idx] = a[l];
    else{
        build( lf , l , mid );
        build( ri , mid + 1 , r);
        seg[idx] = seg[lf] ^ seg[ri];
    }
}
void update( int pos , int val , int idx = 1 , int l = 0 , int r = n - 1 ){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if ( l == r ){
        seg[idx] = val;
    }
    else{
        if ( pos <= mid ){
            update( pos , val , lf , l , mid );
        }
        else{
            update( pos , val , ri , mid + 1 , r);
        }
        seg[idx] = seg[lf] ^ seg[ri];
    }
}
int ask( int s , int e , int idx = 1 , int l = 0 , int r = n - 1 ){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if      ( s  > r || e  < l ) return 0;
    else if ( l >= s && r <= e ) return seg[idx];
    else{
        return ask(s,e,lf,l,mid) ^ ask(s,e,ri,mid+1,r);
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef CLion
    freopen("input.txt" , "r" , stdin);
//    freopen("output.txt", "w" , stdout);
#endif

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

    while ( q-- ){
        int t , x , y;
        cin >> t >> x >> y;
        if ( t == 1 ){
            update(x - 1 , ask(x-1,x-1) ^ y);
        }
        else{
            cout << ask(x - 1 , y - 1) << "\n";
        }
    }
    return 0;
}

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

#define R register
#define LL long long

inline int read() {
	int x = 0, f = 1; char a = getchar();
	for(; a > '9' || a < '0'; a = getchar()) if(a == '-') f = -1;
	for(; a <= '9' && a >= '0'; a = getchar()) x = x * 10 + a - '0';
	return x * f;
}

const int N = 20;

int n, m;
int ok[N][N];
int dp[1 << 18];
int stk[N], top;

inline int check(int S) {
	top = 0;
	for(R int i = 1; i <= n; i ++)
		if(S & (1 << (i - 1))) stk[++ top] = i;
	for(R int i = 1; i <= top; i ++)
		for(R int j = i + 1; j <= top; j ++)
			if(ok[stk[i]][stk[j]] == 0) return 0;
	return 1;
}

#define min(x,y) (x) < (y) ? (x) : (y)

signed main() {
	#ifdef IN
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	#endif
	n = read(); m = read();
	for(R int i = 1; i <= m; i ++) {
		int x = read(), y = read();
		ok[x][y] = ok[y][x] = 1;
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	int tot = 0;
	for(R int S = 1; S < (1 << n); S ++) {
		if(check(S)) { dp[S] = 1; continue; }
		if((S & -S) == S) { dp[S] = 1; continue; }
		for(R int T = S & (S - 1); T; T = (T - 1) & S)
			dp[S] = min(dp[S], dp[T] + dp[S ^ T]);
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int n, k;
	cin >> n >> k;
	int t[n][n];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
			cin >> t[i][j];
	}
	vector<int> p(n);
	for (int i = 0; i < n; i++)
		p[i] = i;
	int ans = 0;
	do
	{
		int cur = 0;
		for (int i = 0; i < n - 1; i++)
			cur += t[p[i]][p[i + 1]];
		cur += t[p[n - 1]][0];
		if (cur == k)
			ans++;
	} while (next_permutation(p.begin() + 1, p.end()));
	cout << ans;
	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<pair<int, int>>> X(N + 1);
    rep(i, M) {
        int x, y, z;
        cin >> x >> y >> z;
        X[x].push_back({y, z});
    }

    int n = 1 << N;
    vector<ll> dp(n);
    dp[0] = 1;
    vector<int> mask(N + 1);
    rep(i, N) mask[i + 1] = mask[i] << 1 | 1;
    rep(s, n) {
        int cnt = __builtin_popcount(s);

        for (auto p : X[cnt]) {
            if (__builtin_popcount(s & mask[p.first]) > p.second) dp[s] = 0;
        }

        rep(j, N) {
            if (~s >> j & 1) dp[s | 1 << j] += dp[s];
        }
    }

    cout << dp[n - 1] << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <stack>
#include <map>
#include <functional>
#include <queue>
#include <set>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

void boolflip(bool &a){
    a = !a ;
    return ;
}

int main(){
    int64_t n,m ;
    cin >> n >> m ;
    set<int> can ;
    can.insert(n) ;
    vector<pair<int,int> > black(m,pair<int,int>()) ;
    int x,y ;
    for (int i = 0; i < m; i++)
    {
        cin >> x >> y ;
        black.at(i) = make_pair(x,y) ;
    }
    sort(black.begin(),black.end()) ;
    int j = 0 ;
    int nowx ;
    if (j < m)
    {
        nowx = black.at(j).first ;
    }

    while (j < m)
    {
        vector<int> next(0) ;
        while(j < m){
            if (black.at(j).first == nowx)
            {
                next.push_back(black.at(j).second) ;
            }else
            {
                break ;
            }
            j ++ ;

        }
        set<int> ok ;
        set<int> stop ;
        for (int i = 0; i < next.size(); i++)
        {
            int t = next.at(i) ;
            if (t == 0)
            {
                if (can.count(t+1))
                {
                    ok.insert(t) ;
                }

            }else if (t == 2*n)
            {
                if (can.count(t-1))
                {
                    ok.insert(t) ;
                }
            }else
            {
                if (can.count(t+1) || can.count(t-1))
                {
                    ok.insert(t) ;
                }

            }

        }
        for (int i = 0; i < next.size(); i++)
        {
           int t = next.at(i) ;
           if (can.count(t))
           {
               if (ok.count(t) == 0)
               {
                   stop.insert(t) ;
               }

           }

        }
        for(set<int>::iterator itr = ok.begin(); itr != ok.end(); ++itr) {
            can.insert(*itr) ;
        }
        for(set<int>::iterator itr = stop.begin(); itr != stop.end(); ++itr) {
            can.erase(*itr) ;
        }
        if (j < m)
        {
            nowx = black.at(j).first ;
        }

    }

    cout << can.size() << endl;

}

#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 998244353;
const int INF = 1e18;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

signed main(){
  int A, B;
  cin >> A >> B;
  int C = 2*A+100;
  if( B < C ) cout << C-B << endl;
  else cout << 0 << endl;
}


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

#define LL long long
const int N = 2005, mod = 1e9 + 7;
char c[N][N];
int h, w, s, p[N*N], d[N][N], r[N][N], l[N][N], u[N][N], ans;

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

    p[0] = 1;
    for(int i = 1; i < N*N; i++) p[i] = p[i-1] * 2 % mod;

    cin >> h >> w;
    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            cin >> c[i][j];
            if(c[i][j] == '#') continue;
            u[i][j] = u[i-1][j] + 1, l[i][j] = l[i][j-1] + 1;
            s++;
        }
    }

    for(int i = h; i > 0; i--) {
        for(int j = w; j > 0; j--) {
            if(c[i][j] == '#') continue;
            d[i][j] = d[i+1][j] + 1, r[i][j] = r[i][j+1] + 1;
            int x = u[i][j] + r[i][j] + l[i][j] + d[i][j] - 3;
            ans += (1LL * p[s-x] * ((p[x] - 1 + mod) % mod)) % mod;
            ans %= mod;
        }
    }

    cout << ans;
}

#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

template<int M>
class ModInt {
   public:
    ll value;
    constexpr ModInt(ll v = 0) { value = v % M; if (value < 0) value += M; }
    constexpr ModInt pow(ll n) const { if (!n) return 1; ModInt a = pow(n >> 1); a *= a; if (n & 1) a *= *this; return a; }
    constexpr ModInt inv() const { return this->pow(M - 2); }
    constexpr ModInt operator + (const ModInt &rhs) const { return ModInt(*this) += rhs; };
    constexpr ModInt operator - (const ModInt &rhs) const { return ModInt(*this) -= rhs; };
    constexpr ModInt operator * (const ModInt &rhs) const { return ModInt(*this) *= rhs; };
    constexpr ModInt operator / (const ModInt &rhs) const { return ModInt(*this) /= rhs; };
    constexpr ModInt &operator += (const ModInt &rhs) { value += rhs.value; if (value >= M) value -= M; return *this; };
    constexpr ModInt &operator -= (const ModInt &rhs) { value -= rhs.value; if (value <  0) value += M; return *this; };
    constexpr ModInt &operator *= (const ModInt &rhs) { value = value * rhs.value % M; return *this; };
    constexpr ModInt &operator /= (const ModInt &rhs) { return (*this) *= rhs.inv(); };
    constexpr bool operator == (const ModInt &rhs) { return value == rhs.value; }
    constexpr bool operator != (const ModInt &rhs) { return value != rhs.value; }
    friend ostream &operator << (ostream &os, const ModInt &rhs) { os << rhs.value; return os; }
};

using mint = ModInt<MOD>;

int main() {
    int H, W; cin >> H >> W;
    vector<string> S(H);
    REP(i, 0, H) cin >> S[i];

    int tot = 0;
    vector<vector<int>> R(H, vector<int>(W, 0)), C(H, vector<int>(W, 0));
    REP(i, 0, H) REP(j, 0, W) {
        if (S[i][j] == '#') continue;
        R[i][j] = 1 + ((j > 0) ? R[i][j - 1] : 0);
        C[i][j] = 1 + ((i > 0) ? C[i - 1][j] : 0);
        tot++;
    }
    REP(i, 0, H) for (int j = W - 1; j > 0; j--) if (R[i][j] && R[i][j - 1]) R[i][j - 1] = R[i][j];
    REP(j, 0, W) for (int i = H - 1; i > 0; i--) if (C[i][j] && C[i - 1][j]) C[i - 1][j] = C[i][j];

    // mint ans = 0;
    mint ans = (mint)tot * mint(2).pow(tot);
    REP(i, 0, H) REP(j, 0, W) {
        if (S[i][j] == '#') continue;
        // cout << "#(" << i << "," << j << ") : " << R[i][j] << ", " << C[i][j] << endl;
        int cnt = R[i][j] + C[i][j] - (R[i][j] && C[i][j]);
        ans -= mint(2).pow(tot - cnt);
        // ans += (mint(2).pow(cnt) - 1) * mint(2).pow(tot - cnt);
    }
    cout << ans << endl;

    return 0;
}


#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

// clang-format off
typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FOREACH(i,c) for(__typeof((c).begin())i = (c).begin();i!=(c).end(); ++i)

//v5
int cond = 1;string to_string(char c){return'\''+string(1,c)+'\'';}string to_string(const string&s){return'"'+s+'"';}string to_string(const char*s){return to_string((string)s);}string to_string(bool b){return(b?"true":"false");}string to_string(std::vector<bool>::reference&r){return to_string((bool)r);}template<typename A,typename B>string to_string(const pair<A,B>&p){return"("+to_string(p.first)+", "+to_string(p.second)+")";}template<typename A>string to_string(A v){int f=1;string r="{";for(auto x:v){if(!f){r+=", ";}f=0;r+=to_string(x);}r+="}";return r;}template<typename A,typename B>string to_string(map<A,B>v){int f=1;string r="{";for(auto x:v){if(!f){r+=", ";}f=0;r+=to_string(x.first)+" -> "+to_string(x.second);}r+="}";return r;}void __db(int i,const vector<string>&s){cerr<<endl;}template<typename T,typename... A>void __db(int i,const vector<string>&s,T t,A... a){if(i)cerr<<", ";cerr<<s[i]<<" = "<<to_string(t);__db(i+1,s,a...);}string __cl(string s){while(!s.empty()&&s[0]==' ')s.erase(0,1);while(!s.empty()&&s.back()==' ')s.pop_back();return s;}vector<string>__vars(string s){vector<string>r;s+=",";string n="";int d=0;for(auto x:s)if(x==','&&d==0){if(!n.empty())r.push_back(__cl(n));n="";}else{n+=x;if(x=='('||x=='[')d++;else if(x==')'||x==']')d--;}return r;}
#define DB(...){if(cond){cerr<<"Line:"<<__LINE__<<" ";__db(0,__vars(#__VA_ARGS__),__VA_ARGS__);}}
// clang-format on

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d\n", a - b + c);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b;
	cin >> n >> a >> b;
	cout << n - a + b << "\n";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#include <random>
#include <chrono>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const int MAX=1e4;

int N;
vector<int> X,Y,R;

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

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

    cin>>N;
    X.resize(N);
    Y.resize(N);
    R.resize(N);
    rep(i,N) cin>>X[i]>>Y[i]>>R[i];

    vector<int> ord(N);
    rep(i,N) ord[i]=i;
    sort(all(ord),[&](int a,int b){
        if(X[a]!=X[b]) return X[a]<X[b];
        if(Y[a]!=Y[b]) return Y[a]<Y[b];
        return a<b;
    });

    auto getScore = [](int r,const vector<int> &len)->double{
        int s=(len[0]+len[2]+1)*(len[1]+len[3]+1);
        double p = 1.0-(1.0-min(r,s)/(double)max(r,s))*(1.0-min(r,s)/(double)max(r,s));
        return p;
    };

    vector<vector<int>> length(N,vector<int> (4,0));
    vector<int> completed(N,0);
    int lastChanged=-1;
    for(int t=0;;t++){
        if(lastChanged+4<t) break;
        bool no_changed=true;
        auto duplicated = [&](int a,int b) ->bool{
            if(a==b) return false;
            if(Y[b]+length[b][0]<Y[a]-length[a][2]) return false;
            if(X[b]+length[b][1]<X[a]-length[a][3]) return false;
            if(Y[b]-length[b][2]>Y[a]+length[a][0]) return false;
            if(X[b]-length[b][3]>X[a]+length[a][1]) return false;
            return true;
        };

        for(auto now:ord){
            //if(completed[now]) continue;

            length[now][t%4]++;
            bool outOfRange=false;
            if(t%4==0&&Y[now]+length[now][0]>=MAX) outOfRange=true;
            if(t%4==1&&X[now]+length[now][1]>=MAX) outOfRange=true;
            if(t%4==2&&Y[now]-length[now][2]<0) outOfRange=true;
            if(t%4==3&&X[now]-length[now][3]<0) outOfRange=true;
            if(outOfRange){
                length[now][t%4]--;
                continue;
            }

            /*bool improved=false;
            {
                double nex_p=getScore(R[now],length[now]);
                length[now][t%4]--;
                double pre_p=getScore(R[now],length[now]);
                length[now][t%4]++;
                if(pre_p<=nex_p) improved=true;
            }
            if(improved==false){
                length[now][t%4]--;
                continue;
            }*/

            int s=(length[now][0]+length[now][2]+1)*(length[now][1]+length[now][3]+1);
            if(s>R[now]){
                //completed[now]=1;
                length[now][t%4]--;
                continue;
            }

            bool ok=true;
            for(auto tar:ord){
                if(now==tar) continue;
                if(duplicated(now,tar)){
                    ok=false;
                    break;
                }
            }
            if(ok==false) length[now][t%4]--;
            else no_changed=false;
        }
        if(no_changed==false) lastChanged=t;
    }

    vector<int> A(N),B(N),C(N),D(N);
    rep(i,N){
        A[i]=X[i]-length[i][3];
        B[i]=Y[i]-length[i][2];
        C[i]=X[i]+length[i][1]+1;
        D[i]=Y[i]+length[i][0]+1;
    }

    rep(i,N) cout<<A[i]<<" "<<B[i]<<" "<<C[i]<<" "<<D[i]<<"\n";

    auto calcS = [&](const vector<int> &len)->int{
        return (len[0]+len[2]+1)*(len[1]+len[3]+1);
    };

    //rep(i,N) cout<<i<<": "<<calcS(length[i])<<" "<<R[i]<<" "<<getScore(R[i],length[i])<<"\n";

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 1010;

int a[N], b[N], n, m, t;
set<int> odd, even;
int res[N * N], cnt;

void swa(int x) {
    res[cnt ++] = x;
    int l = a[x], r = a[x + 1];
    swap(a[x], a[x + 1]);
    swap(b[l], b[r]);
    t ^= 1;
}

void sol(int x, int y) {
    for (int i = x; i < y; i ++)    swa(i);
}

int get(int x, int y) {
    for (int i = y; i < 5; i ++) {
        if (a[i] != x && a[i + 1] != x) return i;
    }
}

int main() {
    int T;
    cin >> T;
    while (T --) {
        cnt = 0;
        t = 1;
        cin >> n;
        for (int i = 1; i <= n; i ++)   {
            cin >> a[i];
            b[a[i]] = i;
        }
        for (int i = n; i >= 5; i --) {
            int x = b[i];
            if (i == x) continue;
            if ((x & 1) ^ t)   {
                int  tt = get(i, t == 0 ? 2 : 1);
                swa(tt);
            }
            sol(x, i);
        }
        if (n >= 4 && a[4] != 4) {
            if ((b[4] & 1) ^ t) {
                if (b[4] == 1)  swa(2);
                else if (b[4] == 2) swa(3);
                else if(b[4] == 3)  swa(2), swa(3);
            }
            sol(b[4], 4);
        }
        if (n >= 3 && a[3] != 3) {
            if ((b[3] & 1) ^ t) {
                if (b[3] == 1)  swa(2);
                else if (b[3] == 2) swa(1), swa(2);
            }
            sol(b[3], 3);
        }
        if (n >= 2 && b[2] == 1) {
            if (t == 1) swa(1);
            else {
                swa(2), swa(1), swa(2), swa(1), swa(2);
            }
        }
        cout << cnt << endl;
        for (int i = 0; i < cnt; i ++)  printf("%d ", res[i]);

        puts("");
    }
    return 0;
}


//   *    Author :   Debapriya010   :  DEBAPRIYA CHANDRA
//   *    Jalpaiguri  Government  Engineering  College

#include<algorithm>
#include<bits/stdc++.h>
#define ll  long long int
#define dbl long double
#define loop(i,n) for(int i=0;i<n;i++)
#define test(t) int t;cin>>t;while(t--)
#define debo ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define vi vector<ll>
#define sz size()
#define iss is_sorted
#define bs binary_search
#define mod 1000000007
#define c1_Bin  __builtin_popcountll
#define yos cout<<"YES"<<endl
#define nos cout<<"NO"<<endl
#define pb push_back
#define mp map<ll,ll>
#define fmax(v) *max_element(v.begin(),v.end())
#define fmin(v) *min_element(v.begin(),v.end())
#define tos to_string
using namespace std;

bool isPrime(ll  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 = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}
bool IsPalindrome( string  str)
{
    if (str.empty())
        return false;

    ll i = 0;                // first characters
    ll j = str.length() - 1; // last character

    while (i < j)
    {
        if (str[i] != str[j])
        {
            return false;
        }
        i++;
        j--;
    }
    return true;
}
// Binary Exponentiation fun to calculate pow in 0(logN)
ll binpow(ll a, ll b) {
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    if (b % 2)
        return (res * res * a)%mod;
    else
        return (res * res)%mod;
}

 signed main(){
     debo;
    // test(t){
     ll k;
     cin>>k;
     ll a=0,g=-1;
     for(ll i=0;i<=k;i++)
     {
         a+=i;
         if(a>=k)
         {
             g=i;
             break;
         }
     }
     cout<<g;

  //   }
     return 0;
 }

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

#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>

#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
ll mypow(ll a, ll n) {
    ll ret = 1;
    rep(i, n) {
        if (ret > (ll)(1e18 + 10) / a) return -1;
        ret *= a;
    }
    return ret;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    set<int> s;
    s.insert(6);
    s.insert(10);
    s.insert(15);
    for(int x = 6; x <= 10000; x += 6){
        if(s.size()==n)break;
        s.insert(x);
    }
    for(int x = 10; x <= 10000; x += 10){
        if(s.size()==n)break;
        s.insert(x);
    }
    for(int x = 15; x <= 10000; x += 15){
        if(s.size()==n)break;
        s.insert(x);
    }
    for(auto e : s)cout << e << " ";
    cout << endl;
    return 0;
}


/*
Author: Zcus
Blog: https://cnblogs.com/zcus
*/

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

#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define debug(x) cout << #x << " = " << x << endl
#define For(i, x, y) for (int i = x; i <= y; i++)
#define Rep(i, x, y) for (int i = x; i >= y; i--)
#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout)
#define filein(FILE_NAME) freopen(FILE_NAME".in", "r", stdin);
#define fileout(FILE_NAME) freopen(FILE_NAME".out", "w", stdout);

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

#define I int
inline I ri() {
	I s = 0, w = 1;
	char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') w = -1; c = getchar();}
	while (c >= '0' && c <= '9') { s = (s << 1) + (s << 3) + (c ^ 48); c = getchar();}
	return s * w;
}
#undef I

#define int long long

const int maxn = 2e5 + 50;
int k;

int tong[maxn];

int calc(int k) {
	int res = 0;
	for (int l = 1, r; l <= k; l = r + 1) {
		r = k / (k / l);
		res = res + (k / l) * (r - l + 1);
	}
	return res;
}
signed main() {

	cin >> k;

	int ans = 0;
	for (int i = 1; i <= k; i++) {
		ans += calc(k / i);
	}

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

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

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define FastIO()            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define read()              freopen("in.txt","r",stdin)
#define write()             freopen("out.txt","w",stdout)

typedef long long           ll;
typedef unsigned long long  ull;
typedef double              dbl;
typedef float               flt;

typedef pair<int, int>      pii;
typedef pair<ll, ll>        pl;

typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vpii;
typedef vector<pl>          vpl;

#define pie                 acos(-1)

#define mp                  make_pair
#define pb                  push_back
#define eb                  emplace_back
#define ff                  first
#define ss                  second

#define MAX                 300005
#define MOD                 1000000007
#define INF                 1000000100

#define for0(i, n)          for(ll i=0; i<n; i++)
#define for1(i, n)          for(ll i=1; i<=n; i++)
#define forab(i, a, b)      for(ll i=a; i<=b; i++)
#define forabx(i, a, b, x)  for(ll i=a; i<=b; i+=x)
#define forinv(i, a, b)     for(ll i=a; i>=b; i--)

#define clr0(a)             memset(a, 0, sizeof(a))
#define ceil(x, y)          (x+y-1) / (y)
#define max3(a, b, c)       max(a, max(b, c))
#define min3(a, b, c)       min(a, min(b, c))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a * b) / __gcd(a, b))
#define sort1(a, x, y)      sort(a+x, a+y+1)
#define debug(x)            cout << "DEBUG " << x << endl;

#define Y()                 cout << "YES" << endl;
#define N()                 cout << "NO" << endl;
#define inArr(a, x, y)      forab(i, x, y) { cin >> a[i]; }
#define outArr(a, x, y)     forab(i, x, y) { cout << a[i] << " "; } cout << endl;

void solve() {
    ll n;
    cin >> n;
    char a[n+10], b[n+10];
    cin >> a;
    cin >> b;
    vl a0, b0;
    ll ca=0, cb=0;
    for0(i, n) {
        if (a[i]=='0') {
            ca ++;
            a0.pb(i);
        }
        if (b[i]=='0') {
            cb++;
            b0.pb(i);
        }
    }
    ll ans = 0;
    if (ca!=cb) {
        ans = -1;
    }
    else {
        for0(i, ca) {
            if (a0[i]!=b0[i]) {
                ans ++;
            }
        }
    }
    cout << ans << endl;
}

void testcase() {
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
}

int main () {
    FastIO()

    //testcase();
    solve();

    return 0;
}


//============================================================================
// Name        : B.cpp
// Author      : NewtonGn
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>

using namespace std;

#define R >>
#define W <<
#define F first
#define S second
#define ALL(v) v.begin(), v.end()
#define Pb push_back
#define EMPB emplace_back
#define MKP make_pair
#define FOR(i,a,n) for(int i = (int)a; i< (int)n; i++)
#define rFOR(i,n,a) for(int i = (int)n; i>=(int)n; i--)
#define ACCELERATE ios::sync_with_stdio(0); cin.tie(0);
#define inf  (int)1e9
#define infLL (ll)1e18
#define nl '\n'
#define ll long long

/*/-----------------------Modular Arithmetic---------------/*/

const long long mod = 998244353;

ll ch(ll x, ll n){
    x--;
    return max( 0ll, x -max(0ll, 2*(x-n)));
}
bool srt(pair<pair<ll,ll>,ll> a, pair<pair<ll,ll>,ll> b){
    if(a.F.F == b.F.F) return a.F.S <  b.F.S;
    return a.F.F < b.F.F ;
}
void solve(){
    double  n, a, b,k, w, d, c,h, m, ans;

       cin R n R  w;
 ll x ,y;
     d =  sqrt( n*n/4 - w);
     x = ( ll) (n/2 + d);
     y =  (ll) (n/2 -d);
    if(x+y == (ll) n && x*y == (ll) w) cout W "Yes";
    else cout W "No";

}

int main(){
  ACCELERATE;

  int t=1;
 //cin R t;

  while(t--){
     // auto start = clock();

      solve();

      // start = clock() - start;
      // cout W "it took " W fixed W  setprecision(20)  W double(start) W '\n';
  }

    return 0;
}

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
#include<numeric>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  ll sum=0;
  vector<ll> s(n);
  for(int i=0;i<n;i++){
    sum+=a[i];
    s[i]=sum;
  }
  vector<ll> ss(n);
  ll ssum=0;
  for(int i=0;i<n;i++){
    ssum+=s[i];
    ss[i]=ssum;
  }

  ll tmp=a[0];
  ll ans=0;
  cout << 2*a[0] << endl;
  for(int i=1;i<n;i++){
    tmp=max(tmp,a[i]);
    ll x=tmp*(i+1);
    //cout << s[i] << ' ' << ss[i-1] << ' ' << x << endl;
    cout << s[i]+ss[i-1]+x << endl;
  }
}


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

typedef long long LL;
const int mod = 998244353;
const int N = 3000 + 10;

LL dp[N][N];

LL f(LL n, LL k) {
	if(n < k) return 0;
	if(n == k) return 1;
	if(!n) return 0;
	if(!k) return 0;
	if(dp[n][k] != -1) return dp[n][k];
	return dp[n][k] = (f(n - 1, k - 1) + f(n, 2 * k)) % mod;
}

void solve() {
	memset(dp, -1, sizeof dp);
	LL n, k;
	scanf("%lld%lld", &n, &k);
	printf("%lld\n", f(n, k));
}

int main() {
	// freopen("in.txt", "r", stdin);
	solve();
	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<long long int, long long int>, null_type,less<pair<long long int, long long int> >, rb_tree_tag,tree_order_statistics_node_update>

#define iOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define ppf pop_front
//#define mp make_pair
#define L(x) x.length()
#define B(x) x.begin()
#define E(x) x.end()
#define F(x) x.front()
#define SZ(x) x.size()
#define CLR(x) x.clear()
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define FOR(i,x,y) for(int i=x;i<y;i++)
#define S(x) scanf("%d",&x)
#define SL(x) cin>>x
#define SD(x) scanf("%lf",&x)
#define SC(x) scanf("%1s",&x)
#define SS(x) scanf("%s",x)
#define DUM() scanf("%c",&dum)
#define READ(x) freopen(x,"r",stdin)
#define WRITE(x) freopen(x,"w",stdout)
#define FILL(x,y) memset(x,y,sizeof(x))
#define IT iterator
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
//#define ld long double

using namespace std;
typedef long long int lli;
typedef long double ld;
typedef unsigned long long int llu;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< pii > vpii;
typedef vector< vpii > vvpii;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef map<int,int> mapii;

long long int mod=998244353;
#define all(c) c.begin(),c.end()

lli dp[3001][3001];
lli solve(int n, int k)
{
    if(k>n)
        return 0;
    if(n==0 || k==0)
        return 0;
    if(dp[n][k]!=-1)
        return dp[n][k];

    dp[n][k]=(solve(n-1,k-1)+solve(n,2*k))%mod;
    return dp[n][k];
}

int main()
{
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    iOS;
    lli test=1;
    //factcalc();
    //cin>>test;
    while(test--)
    {
        int n,k;
        cin>>n>>k;
        for(int i=0;i<=n;++i)
        {
            for(int j=0;j<=n;++j)
                dp[i][j]=-1;
        }
        dp[1][1]=1;
        lli t=(solve(n,k))%mod;
        /*for(int i=0;i<=n;++i)
        {
            for(int j=0;j<=n;++j)
                cout<<dp[i][j]<<" ";
            cout<<endl;
        }*/
        cout<<t;
    }
    /* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/

    return 0;
}


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

int main(){
	int index = 0;
	long long n,count = 0;
	cin>>n;
	long long tem = n;
	while(n>0){
		index++;
		n/=1000;
	}
	long long base = 1;
	for (int i=1;i<index;i++) base *=1000;
	base--;
	count = (tem-base)*(index-1);
	switch (index){
		case 1:case 2: break;
		case 3: count += 999000; break;
		case 4:count += 999000+999000000*2; break;
		case 5:count += 999000+999000000*2+999000000000*3; break;
		case 6: count += 999000+999000000*2+999000000000*3+999000000000000*4; break;
	}
	cout<<count;
	return 0;
}

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

int main() {
  long long n; cin >> n;
  int n_digits = to_string(n).size();
  long long ans = 0;
  for (int d = 1; d < n_digits; d++) {
    ans += (d - 1) / 3 * 9 * pow(10, d - 1);
  }
  ans += (n_digits - 1) / 3 * (n - pow(10, n_digits - 1) + 1);
  cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

int h,w,a,b;

long long dp[(1 << 17) + 10][20];

long long f(int mask, int da) {

    if(da == a)
        return 1;

    long long &ans = dp[mask][da];
    if(ans != -1) return ans;

    ans = 0;

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            int pos = w * i + j;
            int next = w * i + j + 1;
            if(!(mask & (1 << pos)) and j + 1 < w and !(mask & (1 << next))) {
                ans += f(mask | (1 << pos) | (1 << next), da + 1);
            }
            next = w * (i + 1) + j;
            if(!(mask & (1 << pos)) and i + 1 < h and !(mask & (1 << next))) {
                ans += f(mask | (1 << pos) | (1 << next), da + 1);
            }
        }
    }
    return ans;
}

int main() {
    memset(dp, -1, sizeof dp);
    cin >> h >> w >> a >> b;

    long long ft = 1;

    for (int i = 1; i <= a; ++i)
        ft *= i;

    cout << f(0, 0) / ft << "\n";
    return 0;
}

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

#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define precise(x) fixed << setprecision(x)

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    if(a == 0) return 0;
    b %= (M - 1);  //M must be prime here

    int res = 1;

    while(b > 0)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }

    return res;
}

const int N = 1e5 + 10;
const int K = 17;

int dp[K][(1<<K)];
int dis[K][(1<<K)];

vi g[N];
int n,m;

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

   int u,v;

   f(i,m)
   {
       cin >> u >> v;
       g[u].pb(v);
       g[v].pb(u);
   }

   int k;
   cin >> k;

   int a[k];
    f(i,k) cin >> a[i];

   f(i,k)
   {
       f(j,n+1) dis[i][j] = N;

       queue<pii> q;
       q.push({0,a[i]});

       while(!q.empty())
       {
           auto x = q.front();
           q.pop();

           if(dis[i][x.S] != N) continue;
           dis[i][x.S] = x.F;

           for(auto v : g[x.S])
               if(dis[i][v] > x.F + 1)
                 q.push({x.F + 1,v});
       }
   }

   f(i,k) f(j,(1<<k)) dp[i][j] = N;
   f(i,k) dp[i][0] = 0;

   f(i,(1<<k))
   {
       f(j,k) if(i & (1<<j))
       {
           f(v,k) if(i & (1<<v))
           {
               dp[j][i] = min(dp[j][i] , dp[v][i^(1<<j)] + dis[j][a[v]]);
           }
       }
   }

   int res = N;
   f(i,k) res = min(res,dp[i][(1<<k)-1]);

   if( res == N) res = -2;

   cout << res + 1;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;

#define FIO() ios_base::sync_with_stdio(0);cin.tie(NULL);
#define endl '\n'

const ll MOD = 1e9 + 7;
const int mx = 2009;

string g[mx];
int h, w;

ll val[mx][mx][3];
ll dp[mx][mx];

ll solve(int r, int c) {
    ll& ans = dp[r][c];
    if (ans != -1) return ans;

    if (r == h - 1 and c == w - 1) {
        val[r][c][0] = val[r][c][1] = val[r][c][2] = 1;
        return ans = 1;
    }

    ans = 0;
    if (c + 1 < w and g[r][c + 1] == '.') {
        solve(r, c + 1);
        val[r][c][0] += val[r][c + 1][0];
        ans += val[r][c][0];
    }

    if (r + 1 < h and g[r + 1][c] == '.') {
        solve(r + 1, c);
        val[r][c][1] += val[r + 1][c][1];
        ans += val[r][c][1];

    }
    if (r + 1 < h and c + 1 < w and g[r + 1][c + 1] == '.') {
        solve(r + 1, c + 1);
        val[r][c][2] += val[r + 1][c + 1][2];
        ans += val[r][c][2];
    }

    for (int i = 0; i < 3; i++) {
        val[r][c][i] += ans;
        val[r][c][i] %= MOD;
    }

    ans %= MOD;
    return ans;
}

int main() {
    FIO();

    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> g[i];

    memset(dp, -1, sizeof dp);
    cout << solve(0, 0) << '\n';
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define all(a) (a).begin(),(a).end()
#define ODD(x) ( ((x)&1)==0?0:1 )
#define SIGN(x) ( ((x) > 0) - ((x) < 0)  )
#define dbg(...) cerr << #__VA_ARGS__ << ": " << (__VA_ARGS__) << endl
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll lcm(ll a, ll b) { return a / __gcd(a,b) * b; }

void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

#define SI() (cout << "Yes\n")
#define NO() (cout << "No\n")

void solve(){

}

int main() {
    READ(0);
    int n,k;cin>>n>>k;
    vvi a(n,vi(n));
    vi b(n*n);
    FOR(i,n){
        FOR(j,n) {
            cin>>a[i][j];
            b[i*n+j]=a[i][j];
        }
    }
    sort(all(b));
    int lo=0,hi=n*n-1;
    const int A=(k*k+1)/2;
    while(lo<hi){
        int mid=(lo+hi)/2;
        vvi x(n,vi(n));
        FOR(i,n)FOR(j,n) x[i][j]=a[i][j]<=b[mid];
        for(int j=1;j<n;++j) x[0][j] += x[0][j-1];
        for(int i=1;i<n;++i) x[i][0] += x[i-1][0];
        for(int i=1;i<n;++i){
            for(int j=1;j<n;++j){
                x[i][j] += x[i-1][j] + x[i][j-1] - x[i-1][j-1];
            }
        }
        int cnt=-1;
        for(int i=k-1;i<n && cnt<A;++i){
            for(int j=k-1;j<n;++j){
                cnt = x[i][j];
                if (i-k>=0) cnt -= x[i-k][j];
                if (j-k>=0) cnt -= x[i][j-k];
                if (i-k>=0 && j-k>=0) cnt += x[i-k][j-k];
                if (cnt>=A) break;
            }
        }
        if (cnt>=A) hi=mid;
        else lo=mid+1;
    }
    cout << b[lo];

    return 0;
}


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

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vpii=vector<pair<int,int>>;
using vpll=vector<pair<ll,ll>>;
using vs=vector<string>;
using vvc=vector<vector<char>>;

const ll INF=1e18;
const int inf=1e9;
const double eps=1e-10;
const double pi=acos(-1);
const ll mod=1e9+7;
const ll MOD=998244353;

//数学関連
int num_order(ll N){
  int res=0;

  while(N>0){
    N/=10;
    res++;
  }

  return res;
}
ll GCD(ll A,ll B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
ll LCM(ll A,ll B){
  ll g=GCD(A,B);
  return A/g*B;
}
vpll prime_factorize(ll N){
  vpll res;

  for(ll i=2;i*i<=N;i++){
    if(N%i!=0){
    continue;
    }

    ll ex=0;
    while(N%i==0){
      ex++;
      N/=i;
    }

    res.push_back({i,ex});
  }

  if(N!=1){
  res.push_back({N,1});
  }

  return res;
}
ll modpow(ll x,ll p,ll y){
  ll res=1;

  while(p>0){
    if(p&1) res=res*x%y;
    x=x*x%y;
    p>>=1;
  }

  return res;
}
ll small_nCk(ll n,ll k){
  ll res=1,fact=1;

  for(int i=0;i<k;i++){
    res=res*(n-i)/fact;
    fact++;
  }

  return res;
}

//データ構造
struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;

    UnionFind(int N){
        r=vector<int>(N,-1);
    }

    int root(int x){
        if (r[x]<0) return x;
        return r[x]=root(r[x]);
    }

    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(r[x]>r[y]) swap(x,y);
        r[x]+=r[y];
        r[y]=x;
        return true;
    }

    int size(int x){
        return -r[root(x)];
    }
};

int main(){

  int N,X;
  cin>>N>>X;

  vpii vec(N);
  for(int i=0;i<N;i++) cin>>vec[i].first>>vec[i].second;

  int sum=0;

  for(int i=0;i<N;i++){
    sum+=(vec[i].first*vec[i].second);

    if(sum>X*100){
      cout<<i+1<<endl;
      return 0;
    }
  }

  cout<<-1<<endl;
}

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)

constexpr int INF = 0x3f3f3f3f;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> w(n);
  for (int& x : w) cin >> x;

  int maxw = *max_element(w.begin(), w.end());
  vector<int> cost(1 << n);
  for (int i = 0; i < m; ++i) {
    int l, v;
    cin >> l >> v;
    if (maxw > v) {
      cout << -1 << '\n';
      return 0;
    }
    for (int bit = 0; bit < 1 << n; ++bit) {
      int s = 0;
      for (int j = 0; j < n; ++j)
        if (bit >> j & 1) s += w[j];
      if (s > v) cost[bit] = max(cost[bit], l);
    }
  }

  vector<int> p(n);
  iota(p.begin(), p.end(), 0);
  // らくだの集合を考えるとこれ以上血がづいてはいけないという制約がたくさん
  // 蟻本によるとグラフの辺と同義っぽい
  // らくだが数直線上にいるとして、pos[i]に位置が入ってるとする
  // らくだiとjがl離れていないといけない → pos[i] + l <= pos[j]
  // 一方グラフの辺は最短経路を考えたときにv[from] + cost >= v[to]
  // みたいな感じになってる　蟻本より
  // pos[i] + l <= pos[j] <=> pos[j] - l >= pos[i]
  // なのでj -> iに-lの辺を張ったのと同じ
  // 並び順を維持するので
  // 0<= i < j < nに対してpos[i] <= pos[j] <=> pos[j] + 0 >= pos[i]
  // j -> iにコスト0の辺を張る
  int ans = INF;
  using tii = tuple<int, int, int>;
  do {
    // 後ろ側から見て、前に辺を張っていく
    vector<tii> es;
    for (int r = 1; r < n; ++r) {
      int s = 1 << p[r];
      for (int l = r - 1; l >= 0; --l) {
        s |= 1 << p[l];
        es.emplace_back(r, l, -cost[s]);
      }
    }
    for (int i = 0; i < n - 1; ++i) es.emplace_back(i + 1, i, 0);

    // べるまん・フォード]]
    vector<int> d(n, INF);
    d[n - 1] = 0;
    for (int i = 0; i <= n; ++i)
      for (auto& [f, t, c] : es)
        if (d[f] != INF && d[t] > d[f] + c) d[t] = d[f] + c;

    if (d[0] != INF) ans = min(ans, -d[0]);
  } while (next_permutation(p.begin(), p.end()));
  cout << ans;
  return 0;
}


#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include<vector>
#include<random>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using lli = long long int;
int main(){
    lli n;
    cin>>n;
    ll ans=0;
    if(n>=1000) ans+=n-999;
    if (n>=1000000) ans+=n-999999;
    if (n>=1000000000) ans+=n-999999999;
    if (n>=1000000000000) ans+=n-999999999999;
    if (n>=1000000000000000) ans+=n-999999999999999;
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }
const ll inf = 1e10;
ll powx(ll a, ll b){
    ll ret = 1;
    FOR(i, b){
        if (ret > inf / a)
            return inf+1;
        ret *= a;
    }
    return ret;
}

int main(int argc, char** argv) {
    //ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    ll n;
    cin >> n;

    set<ll> S;
    for(int b=2; b<=60; b++){
        ll a = 2;
        while(1){
            ll ab = powx(a, b);
            if (ab <= n)
                S.insert(ab);
            else
                break;
            a++;
        }
    }
    cout << n-S.size() << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define PI acos(-1)
#define int long long
bool gt(string s,string t){
	vector<int>cnt1(10,0),cnt2(10,0);
	for(auto u:s)cnt1[u-'0']++;
	int a=0;
	for(int i=1;i<=9;i++)a+=i*pow(10,cnt1[i]);
	for(auto u:t)cnt2[u-'0']++;
	int b=0;
	for(int i=1;i<=9;i++)b+=i*pow(10,cnt2[i]);
	return a>b;
}
int32_t main(){
	IOS;
	int k;
	cin>>k;
	string s,t;
	cin>>s>>t;
	vector<int>cnt(10,k);
	for(int i=0;i<4;i++){
		cnt[s[i]-'0']--;
		cnt[t[i]-'0']--;
	}
	int scorea=0;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			s.back()=i+'0';
			t.back()=j+'0';
			//cout<<temp1<<" "<<temp2<<endl;
			if (gt(s,t))scorea+=cnt[i]*(cnt[j]-(i==j));
		}
	}
	//cout<<scorea<<" "<<scoreb<<endl;
	cout<<fixed<<setprecision(12)<<1.0*scorea/(9*k-8)/(9*k-9)<<endl;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 1e18;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using V = vector<ll>;
using P = pair<ll,ll>;
using Graph = vector<V>;

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

  ll n, m, t;
  cin >> n >> m >> t;
  V a(m);
  V b(m);
  rep(i,m) {
    cin >> a[i] >> b[i];
  }
  ll N = n;
  rep(i,m) {
    if (i == 0) {
      n -= a[i];
    }
    else {
      n -= a[i];
      n += b[i-1];
    }
    if (n <= 0) {
      cout << "No\n";
      return 0;
    }
    n += (b[i] - a[i]);
    n = min(n,N);
  }
  if (n - (t-b[m-1]) <= 0) {
    cout << "No\n";
  }
  else {
    cout << "Yes\n";
  }
 }