/**
*    author:  ekusiadadus
*    created: 11.04.2021 03:33:32
**/

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  int n;
  cin >> n;
  vector<int> v(2*n);
  for(int i = 0; i < 2*n; ++i){
    cin >> v[i];
  }
  multiset<int> s;
  int l = 0;
  int r = 2*n -1;
  i64  ans = 0;
  while(l<r){
    s.insert(v[l]);
    s.insert(v[r]);
    auto it = prev(s.end());
    ans += *it;
    s.erase(it);
    l += 1;
    r -= 1;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  rep(j, v.size()) i >> v[j];
  return i;
}

template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}

template <class T>
void chmin(T& a, const T& b) {
  if (b < a) a = b;
}

signed main() {
  init();
  ll N;
  cin >> N;
  vll V(2 * N);
  cin >> V;
  priority_queue<ll, vll, greater<ll>> q;
  ll ans = 0;
  rep(i, N) {
    q.push(V[N - 1 - i]);
    q.push(V[N + i]);
    ans += q.top();
    q.pop();
  }
  ans = SUM(V) - ans;
  ANS;

  return 0;
}


#include <iostream>
#include <vector>

using namespace std;

class Solution{

public:
    long long solve(int L){

        vector<vector<long long>> dp(L, vector<long long>(12, -1ll));
        return C(L - 1, 11, dp);
    }

private:
    long long C(int N, int K, vector<vector<long long>>& dp){

        if(K == 0) return 1ll;
        if(N == K) return 1ll;
        if(dp[N][K] != -1ll) return dp[N][K];

        return dp[N][K] = C(N - 1, K, dp)  + C(N - 1, K - 1, dp);
    }
};

int main() {

    int L; cin >> L;
    cout << Solution().solve(L) << endl;

    return 0;
}

    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld long double
    #define MOD 1000000007
    #define mod9 1000000009
    #define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #define mp make_pair
    #define pb push_back
    #define ct ll t;cin>>t;while(t--)
    #define bi begin()
    #define ei end()
    #define fi first
    #define se second
    #define foe(i,a,b) for(ll i=a;i<b;i++)
    #define rfoe(i,a,b) for(ll i=a;i>=0;i--)
    #define sz(s) s.size()
    #define mem(a,s) memset(a,s,sizeof(a))
    #define all(v) v.bi,v.ei
    #define MAX             8000000000000000064LL
    #define MIN            -8000000000000000064LL

    typedef pair<ll,ll> pii;

    ll add(ll a, ll b){return (a%MOD + b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll sub(ll a, ll b){return (a%MOD - b%MOD + ((MAX)/MOD)*MOD)%MOD;}
    ll mul(ll a, ll b){return ((a%MOD)*(b%MOD) + ((MAX)/MOD)*MOD)%MOD;}
    long long binpow(long long a, long long b)
    {
        long long res = 1;
        while (b > 0) {
            if (b & 1)
                res = res*a;
            a = a*a;
            b >>= 1;
        }
        return res;
    }

    ll lcm(ll a,ll b){return(a*b)/__gcd(a,b);}
    ll fact[1000007 ]={0};
    ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
    y=y>>1;x=(1ll*x*x)%MOD;} return res;}
    void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%MOD;}
    ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],MOD-2)))%MOD; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res;}
    ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
    int const N=1e5+9;
    ll const INF = 2e18+5;
    ll dx[8]={0,0,1,-1,1,1,-1,-1};
    ll dy[8]={1,-1,0,0,-1,1,-1,1};

    void solve()
    {
       ll n;
       cin>>n;
      ll ans=1;
      foe(i,0,11)
      {
          ans=ans*(n-(i+1))/(i+1);
      }
      cout<<ans<<"\n";

    }
    int main()
    {
        fast

        facto();
        // Sieve();
        // ct
        {
            solve();
        }
    }


// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x)cout << a << ' '; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pair<int, pii> &p1, const pair<int, pii> &p2)const {
        if (p1.F == p2.F)
            return p1.S.F > p2.S.F;
        return p1.F > p2.F;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 2e5 + 5, inf = 2e18;
vector<int> adj[N];
int tin[N], tout[N], tim, height[N];
std::vector<int> have[N];
void dfs(int s, int p, int h)
{
    tin[s] = ++tim;
    height[s] = h;
    have[h].pb(tin[s]);
    for (auto x : adj[s])
    {
        if (x != p)
        {
            dfs(x, s, h + 1);
        }
    }
    tout[s] = ++tim;
}
void solve()
{
    int n, x, y, q;
    cin >> n;
    forn(i, 1, n)
    {
        cin >> x;
        x--;
        adj[x].pb(i);
        adj[i].pb(x);
    }
    dfs(0, -1, 0);
    cin >> q;
    forn(i, 0, q)
    {
        cin >> x >> y;
        x--;
        if (height[x] > y)
        {
            cout << 0 << '\n';
            continue;
        }
        cout << upper_bound(all(have[y]), tout[x]) - lower_bound(all(have[y]), tin[x]) << '\n';
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int test = 1;
    clock_t z = clock();
    // cin >> test;
    forn(tes, 0, test)
    {

        solve();
    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}

/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Train
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_M = 100000;
const long long LINF = 1LL << 62;

/* typedef */

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<pii> vpii;

/* global variables */

int ts[MAX_M], ks[MAX_M];
vpii nbrs[MAX_N];
ll ds[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m, st, gl;
  scanf("%d%d%d%d", &n, &m, &st, &gl);
  st--, gl--;

  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d%d%d", &a, &b, ts + i, ks + i);
    a--, b--;
    nbrs[a].push_back(pii(b, i));
    nbrs[b].push_back(pii(a, i));
  }

  fill(ds, ds + n, LINF);
  ds[st] = 0;

  priority_queue<pli> q;
  q.push(pli(0, st));

  while (! q.empty()) {
    pli u = q.top(); q.pop();
    ll ud = -u.first;
    int ui = u.second;
    if (ds[ui] != ud) continue;
    if (ui == gl) break;

    vpii &nbru = nbrs[ui];
    for (vpii::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
      int vi = vit->first, ei = vit->second;
      ll vd = (ud + ks[ei] - 1) / ks[ei] * ks[ei] + ts[ei];
      if (ds[vi] > vd) {
	ds[vi] = vd;
	q.push(pli(-vd, vi));
      }
    }
  }

  printf("%lld\n", (ds[gl] < LINF) ? ds[gl] : -1LL);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z,k;
    ll a,b;
        cin>>a>>b;
        cout<<2*a+100-b;

    return 0;
}

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    int a, b;
    cin >> a >> b;
    cout << 2 * a + 100 - b << endl;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using P = pair<int,int>;
#define F first
#define S second
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

int main() {
  int n, m; cin >> n >> m;
  vector<int> a(m);
  rep(i, m) cin >> a[i];
  a.push_back(0);
  a.push_back(n+1);
  sort(all(a));
  int b;
  b = n;
  rep(i, m+1) {
    if (a[i+1] - a[i] != 1) {
      chmin(b, a[i+1] - a[i] - 1);
    }
  }
  int ans = 0;
  rep(i, m+1) {
    if (a[i+1] - a[i] != 1) {
      ans += (a[i+1] - a[i] - 1 + b - 1) / b;
    }
  }
  cout << ans << endl;
}

#include <bits/stdc++.h>
#define gc() getchar()
using namespace std;
typedef long long ll;

template <typename T> void rd(T &x){
	ll f=1;x=0;char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	x*=f;
}

int main(){
	int a,b;
	rd(a),rd(b);
	printf("%g\n",1.0*a*b/100);
	return 0;
}


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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int h,w,a,b;

int dp[1 << 4][16][16][9];

int bit(int mask, int x) {
  return (mask >> x) & 1;
}

int solve(int mask, int x, int y, int c) {
  if(c < 0) {
    return 0;
  }

  if(x == h) {
    if(mask == 0 && c == 0) {
      return 1;
    }
    return 0;
  }

  int &res = dp[mask][x][y][c];

  int nx = x, ny = y + 1;
  if(ny == w) {
    nx = x + 1;
    ny = 0;
  }

  if(bit(mask, y)) {
    return res = solve(mask & (~(1 << y)), nx, ny, c);
  }

  res = solve(mask, nx, ny, c);
  if(y + 1 < w && bit(mask, y + 1) == 0) {
    res += solve(mask | (1 << (y + 1)), nx, ny, c - 1);
  }
  if(x + 1 < h) {
    res += solve(mask | (1 << y), nx, ny, c - 1);
  }
  return res;
}

int main() {
  scanf("%d%d%d%d",&h,&w,&a,&b);
  if(w > h) swap(w, h);
  memset(dp, -1, sizeof(dp));
  P(solve(0, 0, 0, a));
  return 0;
}

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define X first
#define Y second
using namespace std;

typedef long long int ll;
typedef vector <int> vi;
typedef pair <int,int> pii;
const int Size=1e6+10;
const int INF=0x3f3f3f3f;

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

struct node{
    int type,x,y;
};
int h,w,a,b;
node f[20];
int cnt=0;

bool check(int pos,int type,int x,int y)
{
    for (int i=1;i<=pos-1;++i)
    {
        if (f[i].type==0 && type==0 && f[i].y==y && f[i].x==x-1) return false;
        else if (f[i].type==0 && type==1 &&
                 ( (f[i].x==x-1 && f[i].y==y)
                  || (f[i].x==x && f[i].y==y)
                  || (f[i].x==x-1 && f[i].y==y+1)
                  || (f[i].x==x && f[i].y==y+1) ) ) return false;
        else if (f[i].type==1 && type==1 && f[i].x==x && f[i].y==y-1) return false;
    }
    return true;
}

void dfs(int pos,int pre)
{
    if (pos==a+1)
    {
        cnt++;
        return;
    }
    for (int k=pre+1;k<=(h-1)*w+(w-1)*h;++k)
    {
        int i,j;
        if (k<=(h-1)*w)
        {
            if (k%w!=0) {i=k/w+1; j=k%w;}
            else {i=k/w; j=w;}
            if (check(pos,0,i,j))
            {
                f[pos]=(node){0,i,j};
                dfs(pos+1,(i-1)*w+j);
            }
        }
        else
        {
            int kk=k-(h-1)*w;
            if (kk%(w-1)!=0) {i=kk/(w-1)+1; j=kk%(w-1);}
            else {i=kk/(w-1); j=w-1;}
            if (check(pos,1,i,j))
            {
                f[pos]=(node){1,i,j};
                dfs(pos+1,(h-1)*w+(i-1)*(w-1)+j);
            }
        }
    }
}

int main()
{
    h=read(),w=read(),a=read(),b=read();
    dfs(1,0);
    printf("%d\n",cnt);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i = a; i < (b);++i)
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

typedef long long ll;
const int MAX_N = 2e5+5;
const int M = 1e9+7;

inline int addM(ll a,ll b){return (a+b)%M;}
inline int mulM(ll a,ll b){return (a*b)%M;}

int main(){
    cin.tie(0)->sync_with_stdio(false);
    cin.exceptions(cin.failbit);
	int k;
	string s;
	cin>>s>>k;
	vector<int> num;
	for(auto c : s){
		if(c>='0' && c<= '9'){
			num.push_back(c-'0');
		}else{
			num.push_back(c-'A'+10);
		}
	}
	int n = sz(s);
	vector<vector<int> > dp(n+1,vector<int>(17));
	set<int> digitSet;
	dp[1][1] = num[0]-1;
	for(int i = 1;i < n;i++){
		digitSet.insert(num[i-1]);
		for(int j = 1;j <= 16;j++){
			dp[i+1][j]=addM(mulM(dp[i][j],j),dp[i+1][j]);
			dp[i+1][j+1]=addM(mulM(dp[i][j],16-j),dp[i+1][j+1]);
		}
		int j = sz(digitSet);
		for(int k = 0 ; k < num[i] ;k++){
			if(digitSet.find(k)!=digitSet.end()){
				dp[i+1][j] = addM(dp[i+1][j],1);
			}else{
				dp[i+1][j+1] = addM(dp[i+1][j+1],1);
			}
		}
		dp[i+1][1] = addM(dp[i+1][1],15);
	}
	int ans = dp[n][k];
	digitSet.insert(num[n-1]);
	if(sz(digitSet) == k)ans++;
	cout<<ans;
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin >> n;
    double x_0, y_0, xn, yn;
    cin >> x_0 >> y_0 >> xn >> yn;
    double midp_x = (x_0 + xn) / 2, midp_y = (y_0 + yn) / 2;
    const double pi = acos(-1.0);
    double ang = 2 * pi / n;
    double relx = x_0 - midp_x;
    double rely = y_0 - midp_y;
    double new_relx = relx * cos(ang) - rely * sin(ang);
    double new_rely = relx * sin(ang) + rely * cos(ang);
    cout << setprecision(15) << fixed << midp_x + new_relx << " " << midp_y + new_rely << endl;
    return 0;
}

#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define llrep(i,n) for(ll i=0; i<(ll)n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define fi first
#define se second
#define kiriage(x,y) (((x)+(y)-1)/(y))
typedef vector<int> vi;
typedef vector<ll> vll;

using C = complex<double>;

C inC(){
	double x,y; cin>>x>>y;
	return C(x,y);
}

int main(){
	int n; cin>>n;
	C s = inC();
	C t = inC();
	C center = (s+t)/2.0;
	double PI = acos(-1);
	double rad = 2*PI/n;
	C r(cos(rad), sin(rad));
	C ans = center + (s - center) * r;
	cout << setprecision(10) << ans.real() << " " << ans.imag() << endl;
}


#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
//Do DEBUG OR NOT
//#define DEBUG

#ifdef DEBUG
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#else
#define debug(...) true
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

//prototype declaration
ll pow_mod(ll n, ll k, ll m);//繰り返し二乗法 return val:(n^k)%m
ll gcd(ll a, ll b);//最大公約数 2引数
ll ngcd(vector<ll> a);
ll lcm(ll a, ll b);//最小公倍数 2引数
ll nlcm(vector<ll> numbers);
bool isPrime(ll x);//素数判定
ll digsum(ll n);//桁和
vector<ll> enum_div(ll n);//約数全列挙
int stringcount(string s, char c);//特定文字カウント

//__________________________main__________________________

int main(){
    int n;
    cin>>n;
    vector<ll> A;
    vector<ll> Asq;
    rep(i,n){
        ll x;
        cin>>x;
        A.emplace_back(x);
        Asq.emplace_back(x*x);
    }

    //AiAj
    ll Sumline=accumulate(A.begin(),A.end(),0)-A[0];
    debug(Sumline);
    ll sumAB=0;
    for(ll j=0;j<n-1;j++){
        if(j!=0) Sumline-=A[j];
        debug(j);
        debug(A[j]);
        debug(Sumline);
        sumAB+=A[j]*Sumline;
        debug(sumAB);
    }
    debug(sumAB);

    //Ai*Ai
    ll Asqi=0;
    debug(Asq);
    int len=Asq.size()-1;
    for(ll i=1;i<n;i++){
        debug(i);
        debug(Asq[i]);
        Asqi+=Asq[i]*i;
        debug(Asqi);
    }
    debug(Asqi);

    //Aj*Aj
    ll Asqj=0;
    len=Asq.size()-1;
    for(ll i=0;i<n-1;i++){
        debug(i);
        debug(Asq[i]);
        Asqj+=Asq[i]*len;
        len--;
    }
    debug(Asqj);

    cout<<Asqi+Asqj-(2*sumAB)<<endl;
    return 0;
}

//__________________________functions_____________Ctrl+K,Ctrl+0
//繰り返し二乗法関数
ll pow_mod(ll n, ll k, ll m){//r:(n^k)%m
    ll r=1;
    for(;k>0;k=k>>1){
        if(k&1) r=(r*n)%m;
        n = (n*n) % m;
    }
    return r;
}
//最大公約数 2引数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}
//最大公約数 n引数
ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
//最小公倍数 2引数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}
//最小公倍数 n引数
ll nlcm(vector<ll> numbers) {
    ll res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}
//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}
//桁和
ll digsum(ll n) {
    ll res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}
//約数全列挙
vector<ll> enum_div(ll n){
    vector<ll> ret;
    for(int i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}
//特定文字カウント
int stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}

#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 1<<30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PLI = pair<long long,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr) ;
    ios::sync_with_stdio(false) ;

    ll n, x;
    string s;
    cin >> n >> x >> s;
    ll res = x;
    rep(i,n){
        if (s[i] == 'o') res++;
        else
            res = max(res - 1, 0LL);
    }
    cout << res << "\n";
    return 0;
}


#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int c = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a >= 10) c += (a - 10);
  }
  cout << c;
  return 0;
}

#pragma GCC optimize ("trapv")
#include <bits/stdc++.h>
#include<algorithm>
#include <vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first
#define ss second
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll   n, a, b=-1,m=0, c=0,k=0, i, j, l=1e9+7;
  string s;
  cin>>n;
  ll ar[n];
  rep(i, 0,n)
  {
    cin>>ar[i];
    if(ar[i]>10) { ar[i]-=10;k+=ar[i];}
  }
  cout<<k;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // sieve();//pre();
 // cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     ll n;
   // cin >> tt;
  // while(tt--){
    cin>>n;
    string s,ans,t;
    map<string,int>m;
    int i;
    for( i=0;i<n;i++){
        cin>>s;
        if(s[0]=='!'){
            t=s;
            t.erase(t.begin());
            if(m[t]>=1){
                ans=t;
                break;
        }
        }
        else{
            t=s;
            t.insert(t.begin(),'!');
            if(m[t]>=1){
                ans=t;
                  t.erase(t.begin());
                break;
        }
        }
        m[s]++;
    }
    if(i==n)
    cout<<"satisfiable"<<endl;
    else{
        cout<<t;
    }
   // }
	return 0;
}

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

// Big two primes
#define X 1001100011100001111ll
#define mod 1000000007
#define int long long
#define ll long long
#define all(a) a.begin(),a.end()
#define sortall(a) sort(all(a))
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define nloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define arrip(a,n)  int a[n]; fo(i, n) cin >> a[i];
#define arrop(a,n)  fo(i,n) cout<<a[i]<<" ";
#define pb push_back
#define mp make_pair
#define itr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626

#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int>
#define fi first
#define se second
#define endl "\n"
#define pi pair<int, int>
#define vpi vector<pi>
#define sz(s) s.size()
#define bits(n) __builtin_popcount(n)
//const int MAXN = (int)((1e5) +` 100);
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}

int maxSubArraySum(int a[], int size)
{
	int max_so_far = a[0];
	int curr_max = a[0];

	for (int i = 1; i < size; i++)
	{
		curr_max = max(a[i], curr_max + a[i]);
		max_so_far = max(max_so_far, curr_max);
	}
	return max_so_far;
}
int32_t main()
{

	fio;

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

	int n;
	cin >> n;

	arrip(a, n);
	arrip(b, n);

	int c[n];

	c[0] = a[0] * b[0];
	int maxi = a[0];

	for (int i = 1; i < n; i++) {

		maxi = max(a[i], maxi);

		c[i] = max(max(c[i - 1], a[i] * b[i]), maxi * b[i]);
	}

	fo(i, n) {
		cout << c[i] << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

typedef pair<int, int> pii;
typedef pair<int, char> pic;

const int N = 82;
int mod = 998244353;

int n, m, a[N];

int main() {
    string s;
    cin >> s;
    map<int, int> ma;
    ma[1] = 1, ma[6] = 9;
    ma[9] = 6, ma[8] = 8;
    ma[0] = 0;
    for(int i = s.length() - 1; ~i; i --) {
        cout << ma[s[i] - '0'];
    }
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <cctype>
#include <cmath>
#include<deque>
#include<map>
#include<algorithm>
#include<iomanip>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,begin,end) for(int i = begin; i < end; i++)
#define all(c) c.begin(), c.end()
#define ll long long
#define INF 2e9
#define INFLL 9223372036854775807
#define cout(n) cout << fixed << setprecision(n)

int main() {
	string s;
	cin >> s;
	reverse(all(s));
	string news;
	rep(i, s.length()) {
		if (s[i] == '6') news += '9';
		else if (s[i] == '9')news += '6';
		else news += s[i];
	}
	cout << news << endl;
}


/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<18;
const int COMBINATION_SIZE = 1<<21;
long long mypow(long long x, long long y, long long mod = MOD){
    long long res=1;
    while(y){
        if(y&1) {
            res = res * x % mod;
        }
        y >>= 1;
        x = x * x % mod;
    }
    return res;
}
struct Combination {
    long long fac[COMBINATION_SIZE], inv[COMBINATION_SIZE];
    bool built = 0;
    void build(){
        assert(MOD >= COMBINATION_SIZE);
        fac[0] = 1;
        for(int i = 1; i < COMBINATION_SIZE; i++) {
            fac[i] = fac[i - 1] * i % MOD;
        }
        inv[COMBINATION_SIZE - 1] = mypow(fac[COMBINATION_SIZE - 1], MOD - 2);
        for(int i = COMBINATION_SIZE - 2; i >= 0; i--) {
            inv[i] = inv[i + 1] * (i + 1) % MOD;
        }
    }
    long long C(int x, int y){
        if(y < 0 || y > x) {
            return 0;
        }
        if(!built) {
            built = 1;
            build();
        }
        return fac[x] * inv[y] % MOD * inv[x-y] % MOD;
    }
} comb;
int N, M;
LL dp[SIZE][19];
LL s[19];
void solve() {
    FOR(i,1,M){
        dp[i][1]=1;
        for(int j = 1; j <= 18; j++){
            if(!dp[i][j]) { break; }
            ADD(s[j],dp[i][j]);
            for(int k = i + i; k <= M; k += i) {
                ADD(dp[k][j + 1], dp[i][j]);
            }
        }
    }
    LL an=0;
    FOR(i,1,18){
        if(N>=i){
            ADD(an,comb.C(N-1,i-1)*s[i]);
        }
    }
    W(an);
}
void input() {
    R(N,M);
}
int main(){
    MOD=998244353;
    input();
    solve();
    return 0;
}

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

const int M = 998244353;

struct mint {
	int x;

	mint(int x) : x(x) {}

	friend mint operator + (const mint &a, const mint b) {
		const int x = a.x + b.x;
		return mint(x >= M ? x - M : x);
	}

	friend mint operator - (const mint &a, const mint b) {
		const int x = a.x - b.x;
		return mint(x < 0 ? x + M : x);
	}

	friend mint operator * (const mint &a, const mint b) {
		return mint(1ll * a.x * b.x % M);
	}
};

int Pw(int a, int x = M - 2, int res = 1) {
	for (; x; x >>= 1, a = (mint(a) * a).x) {
		if (x & 1) {
			res = (mint(res) * a).x;
		}
	}
	return res;
}

const int N = 2e5 + 1, Nk = 20;
int n, nw, f[Nk][N], g[N], tmp[N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n >> nw;
	rep(i, 1, nw + 1) {
		f[0][i] = 1;
	}
	rep(k, 0, Nk - 1) {
		rep(i, 1, nw + 1) {
			rep(j, 1, nw / i + 1) {
				int &F = f[k + 1][i * j];
				F = (F + mint(f[k][i]) * f[k][j]).x;
			}
		}
	}
	g[1] = 1;
	rep(k, 0, Nk - 1) {
		if (n >> k & 1) {
			rep(i, 1, nw + 1) {
				rep(j, 1, nw / i + 1) {
					int &F = tmp[i * j];
					F = (F + mint(g[i]) * f[k][j]).x;
				}
			}
			rep(i, 1, nw + 1) {
				g[i] = tmp[i], tmp[i] = 0;
			}
		}
	}
	int res = 0;
	rep(i, 1, nw + 1) {
		res = (res + mint(g[i])).x;
	}
	cout << res << '\n';
	return 0;
}


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

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)

#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define inf32 2147483647
#define inf64 9223372036854775807
#define mod 1000000007
#define pi 3.141592653589793238462643383279

ld rad(ld radian) {return (radian * pi/180.0);}//角度をラジアンに変換
ld angle(ld x){return (x * 180) / pi;}//ラジアンを角度に変換
int Euclid_algorithm(int x, int y) {for(;;){x %= y;swap(x,y);if(y==0) break; }return x;}//ユークリッドの互除法

signed main() {
    ll num,K,N1,N2;
    string N;
    cin >> N >> K;
    rep(i,K){
        sort(N.begin(),N.end(),greater<ll>());
        N1 = stol(N);
        sort(N.begin(),N.end());
        N2 = stol(N);
        N = to_string(N1 - N2);
    }

    cout << N << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める
using Graph = vector<vector<int>>;

int main()
{
    int a,b;
    cin >> a >> b;
    cout << (a+b)/2 << " " << (a-b)/2 << endl;
    return 0;
}


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

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N, amax, bmin, ans;
  amax = 0;
  bmin = 1001;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);

  rep(i, N) {
    cin >> A[i];
  }
  rep(i, N) {
    cin >> B[i];
  }

  rep(i, N) {
    amax = max(amax, A[i]);
  }

  rep(i, N) {
    bmin = min(bmin, B[i]);
  }

  ans = bmin - amax + 1;

  if (ans < 0) ans = 0;

  cout << ans << endl;

}

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast","unroll-loops")
#define INF 2147483647
#define ll long long
#define ft first
#define sec second
#define pb push_back
#define pi pair<ll,int>
using namespace std;
ll t,n,a[100001],b[100001];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n; i++) cin >> b[i];
	ll sum=0;
	for(int i=0; i<n; i++) sum+=a[i]*b[i];
	cout << (sum?"No":"Yes");
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <tuple>

using namespace std;
using lint = long long;

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

    vector<pair<lint, int>> xs, ys;
    for (int i = 0; i < n; ++i) {
        lint x, y;
        cin >> x >> y;
        xs.emplace_back(x, i);
        ys.emplace_back(y, i);
    }

    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());

    vector<tuple<lint, int, int>> ps;
    for (int l = 0; l < 2; ++l) {
        auto [xl, il] = xs[l];
        for (int r = 0; r < 2; ++r) {
            auto [xr, ir] = xs[n - r - 1];
            if (il == ir) continue;
            ps.emplace_back(xr - xl, il, ir);
        }
    }

    for (int l = 0; l < 2; ++l) {
        auto [yl, il] = ys[l];
        for (int r = 0; r < 2; ++r) {
            auto [yr, ir] = ys[n - r - 1];
            if (il == ir) continue;
            ps.emplace_back(yr - yl, il, ir);
        }
    }

    sort(ps.rbegin(), ps.rend());
    set<pair<int, int>> ss;
    for (auto [d, i, j] : ps) {
        if (i > j) swap(i, j);
        if (ss.count({i, j})) continue;

        if (!ss.empty()) {
            cout << d << "\n";
            return;
        }
        ss.emplace(i, j);
    }
}

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

    solve();

    return 0;
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<string.h>
#include<math.h>
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define F first
#define S second
#define MAX 500005
#define MOD (ll)(1e9+7)
#define INF (ll)(1e18)
#define AC ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
signed main(){
    AC;
    int n;
    cin>>n;
    vector<pair<ll,int> > x;
    vector<pair<ll,int> > y;
    FOR(i,0,n){
        ll a,b;
        cin>>a>>b;
        x.pb({a,i});
        y.pb({b,i});
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    vector<pair<ll,pair<int,int> > > aa;
    aa.clear();
    map<pair<int,int> ,bool> used;
    aa.pb({abs(x[0].F-x[n-1].F),{x[n-1].S,x[0].S}});
          aa.pb({abs(x[0].F-x[n-2].F),{x[n-2].S,x[0].S}});
                aa.pb({abs(x[1].F-x[n-1].F),{x[n-1].S,x[1].S}});
    aa.pb({abs(y[0].F-y[n-1].F),{y[n-1].S,y[0].S}});
          aa.pb({abs(y[0].F-y[n-2].F),{y[n-2].S,y[0].S}});
                aa.pb({abs(y[1].F-y[n-1].F),{y[n-1].S,y[1].S}});
    sort(aa.begin(),aa.end());
    if(aa[5].S.F==aa[4].S.F&&aa[5].S.S==aa[4].S.S){
        cout<<aa[3].F<<endl;
    }
    else if(aa[5].S.F==aa[4].S.S&&aa[5].S.S==aa[4].S.F){
        cout<<aa[3].F<<endl;
    }
    else{
        cout<<aa[4].F<<endl;
    }
}


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

int main(){
  vector<string> mt(100001, "");
  int N; cin >> N;

  for(int i=0; i<N; i++){
    string s;
    int t;
    cin >> s >> t;
    mt[t]=s;
  }
  bool f=false;
  for(int i=100000; i>0; i--){
    if(mt[i].size()>0){
      if(f){
        cout << mt[i] << endl;
        return 0;
      }else{
        f=true;
      }
    }
  }
}

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int MAX = 105;
int x[MAX], y[MAX];
int sq(int x) { return x * x; }
double dis(int i, int j) { return sqrt(1.0 * sq(x[i] - x[j]) + sq(y[i] - y[j])); }
int par[MAX], sz[MAX], n;
void init(int v) {
	par[v] = v;
	sz[v] = 1;
}
int find(int v) {
	return v == par[v] ? v : par[v] = find(par[v]);
}
void join(int u, int v) {
	u = find(u), v = find(v);
	if(u != v) {
		if(sz[u] < sz[v]) swap(u, v);
		par[v] = u;
		sz[u] += sz[v];
	}
}
bool f(double r) {
	for(int i = 1; i <= n + 2; i ++) init(i);
	// n+1 -> x=-100
	// n+2 -> x=100
	for(int i = 1; i <= n; i ++) {
		if(y[i] - 2 * r < -100) join(i, n + 1);
		if(y[i] + 2 * r > 100) join(i, n + 2);
		for(int j = i + 1; j <= n; j ++) {
			if(dis(i, j) < 2 * r) join(i, j);
		}
	}
	return find(n + 1) != find(n + 2);
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> x[i] >> y[i];
	double l = 0, r = 200;
	for(int i = 0; i < 60; i ++) {
		double m = (l + r) / 2;
		if(f(m)) l = m;
		else r = m;
	}
	cout << setprecision(10) << fixed << l;

	return 0;
}

// Hope for us because I believed


#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
//const int mod = 998244353;

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

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

ll mod_pow(ll n, ll k){
    ll res = 1;
    for(; k > 0; k >>= 1){
        if(k&1) res = (res*n)%mod;
        n = (n*n)%mod;
    }
    return res;
}

int main()
{
    ll n, p;
    cin >> n >> p;
    mint ans = mod_pow(p - 2, n - 1);
    ans *= p - 1;
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
#define ss second
#define ll long long
#define mod 1000000007
#define ff first
#define pb push_back
#define pll pair<ll,ll>
#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
}
ll powermod(ll x, ll y,ll p)
{
    int res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
int main()
{
    //cp();
	de(n);
	de(p);
	if(p==2)
	{
		if(n==1)
		cout<<"1";
		else{
			cout<<"0";
		}
	}
	else
	{
		ll ans=powermod(p-2,n-1,mod);
		ans=((ans%mod)*((p-1)%mod))%mod;
		cout<<ans;
	}
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int                 long long
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;++i)
#define loop(i,a,b)         for (int i=a ; i<b ;++i)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int MOD = 998244353;

int sol(int x)
{
	int c = 0;
	while (x > 0)
	{
		c += x % 10;
		x /= 10;
	}
	return c;
}
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;
	cout << fixed << setprecision(12);
	int a, b;
	cin >> a >> b;
	int s1 = sol(a);
	int s2 = sol(b);
	print(max(s1, s2))

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define SZ(x) (long long)x.size()
#define endl '\n'
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define tc                                                                     \
  int tc;                                                                      \
  cin >> tc;                                                                   \
  while (tc--)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define REPO(i, b, a) for (int i = b - 1; i >= a; i--)
#define REPI(i, a, b) for (int i = a; i <= b; i++)
#define MOD 1000000007

int32_t main() {
  FAST;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("output.txt", "w", stderr);
#endif
  int n;
  cin >> n;
  set<int> s;
  REPI(i, 1, sqrt(n)) {
    if (n % i == 0) {
      s.insert(i);
      s.insert(n / i);
    }
  }
  for (auto i : s)
    cout << i << endl;
  return 0;
}

/*
* @Author: wilson_t
* @Date:   2021-03-23 00:40:16
* @Last Modified by:   wilson_t
* @Last Modified time: 2021-03-23 01:28:27
*/
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, long long>;
using pll = pair<long long, long long>;
using pli = pair<long long, int>;

inline void speedio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

inline void readline(string& s) {
    getline(cin >> ws, s);
}

inline void read(vector<int>& v) {
    int number;
    while (cin >> number) {
        v.push_back(number);
        if (cin.get() == '\n')
            break;
    }
}

void solve() {
    int N;
    cin >> N;
    //1->2->3->4->5...
    //1 2 3 4 5 6 7 8 9 10
    //1 2 2 3 3 3 3 4 4 4
    int now = 0;
    for(int i = 1; i <= N; ++i) {
        if((i & (i - 1)) == 0) ++now;
        cout << now << " ";
    }
    cout << "\n";
}

int main() {
    speedio();
    // freopen("in.txt", "r", stdin);
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;

struct part {
    int v, l;
    part(int v=0, int l=0): v(v), l(l) {}
};

int main() {
    // 全探索、重さでソート、最長路、二分探索
    int N, M;
    cin >> N >> M;
    vector<int> W(N);
    rep(i, N) cin >> W[i];
    sort(W.begin(), W.end());
    vector<part> LV(M);
    int maxV = 0, minV = 1e9;
    rep(i, M) {
        int l, v;
        cin >> l >> v;
        maxV = max(maxV, v);
        minV = min(minV, v);
        LV[i].v = v;
        LV[i].l = l;
    }
    if (W[N-1] > minV) {
        cout << -1 << '\n';
        return 0;
    }
    sort(LV.begin(), LV.end(), [&] (const part& x, const part& y) { return x.v < y.v; });
    map<int, ll> mp;
    rep(i, M) {
        int key = LV[i].v;
        int value = LV[i].l;
        if (mp[key] < value) {
            mp[key] = value;
        }
    }
    int maxL = 0;
    for (auto &p : mp) {
        if (p.second > maxL) {
            maxL = p.second;
        }
        p.second = maxL;
    }
    mp[INF] = maxL;
    vector<int> pos(N);
    rep(i, N) pos[i] = i;
    ll ans = 1e16;
    do {
        vector<P> ws(N);
        rep(i, N) ws[i].first = W[pos[i]];
        vector<vector<ll>> dist(N, vector<ll> (N));
        rep(i, N) for (int j = i+1; j < N; j++) {
            // iからjまでの重さが十分の距離があるか
            int temp = 0;
            for (int k = i; k <= j; k++) {
                temp += ws[k].first;
            }
            if (temp <= minV) continue;
            auto it = mp.lower_bound(temp);
            if (it == mp.begin()) continue;
            it--;
            dist[i][j] = it -> second;
        }
        vector<ll> dp(N);
        rep(i, N) for (int j = i+1; j < N; j++) {
            dp[j] = max(dp[j], dp[i] + dist[i][j]);
        }
        ans = min(ans, dp[N-1]);
    } while (next_permutation(pos.begin(), pos.end()));
    cout << ans << '\n';
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vui = vector<ui>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
template <typename T>
using vv = vector<vector<T>>;
template <typename T>
using vvv = vector<vector<vector<T>>>;

int main()
{
	int N, M;
	cin >> N >> M;
	vi w(N);
	auto maxW = 0;
	for (auto& i : w)
	{
		cin >> i;
		maxW = max(maxW, i);
	}
	vector<pair<int, int>> list(M);
	auto valid = true;
	for (auto i = 0; i < M; ++i)
	{
		cin >> list[i].second >> list[i].first;
		if (list[i].first < maxW)
		{
			valid = false;
		}
	}

	auto ans = -1ll;

	if (valid)
	{
		ans = LLONG_MAX;

		sort(list.begin(), list.end());
		vl v(M);
		vl maxL(M + 1);
		for (auto i = 0; i < M; ++i)
		{
			v[i] = list[i].first;
			maxL[i + 1] = max(maxL[i], (ll)list[i].second);
		}

		vi index(N);
		for (auto i = 0; i < N; ++i)
		{
			index[i] = i;
		}

		auto calc = [&](int l, int r)
		{
			auto sumW = 0ll;
			for (auto i = l; i <= r; ++i)
			{
				sumW += w[index[i]];
			}
			auto indexL = lower_bound(v.begin(), v.end(), sumW) - v.begin();
			return maxL[indexL];
		};

		do
		{
			vl dp(N, 0);
			for (auto i = 0; i < N - 1; ++i)
			{
				for (auto j = i + 1; j < N; ++j)
				{
					dp[j] = max(dp[j], dp[i] + calc(i, j));
				}
			}
			ans = min(ans, dp[N - 1]);
		} while (next_permutation(index.begin(), index.end()));
	}

	cout << ans << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
  string S,s="";
  cin>>S;
  s+=S.at(1);
  s+=S.at(2);
  s+=S.at(0);
  cout<<s<<endl;

}

#include<bits/stdc++.h>

using namespace std;

int main(){
    double n;
    scanf("%lf",&n);
    int k=(int)(n*1.08);
    if(k<206)puts("Yay!");
    else if(k>206)puts(":(");
    else puts("so-so");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n";
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
#define nline cout<<"\n"
#define len(a) sizeof(a)/sizeof(a[0])
template<typename T> void debug(vector<T> &array, bool IsSorted) {if (IsSorted) sort(all(array)); for (auto &i : array) {cerr << i << " ";} cerr << '\n';}
template<typename T> void deb(T &i, T &j) { cerr << "{" << i << " , " << j << "}" << endl;}
void solve(); signed main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); freopen("debug.txt" , "w" , stderr);
#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); solve();
}
//----------------------------Harsh Samoliya.cpp-----------------------//
void solve() {
	string s;
	cin >> s;
	int count = 0;
	int ans = 0;
	string l = "ZONe";
	for (int i = 0; i < s.size() - 3; i++) {
		int count = 0;
		int val = i;
		for (int j = 0 ; j < l.size(); j++) {
			if (s[val] == l[j]) {
				val++;
				count++;
				if (count == 4) {
					ans++;
				}
			} else {
				break;
			}
		}
	}
	cout << ans << endl;
}

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

int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    string str;
    cin >> str;
    int cnt = 0;
    for (int i = 0; i < 9; i++)
        if (str[i] == 'Z' && str[i + 1] == 'O' && str[i + 2] == 'N' && str[i + 3] == 'e')
            cnt++;
    cout << cnt << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,f[N],c,sz;
pair<int,int>a[N];
int main(){
	cin>>n;n*=2;
	for(int i=1;i<=n;i++)scanf("%d",&a[i].first),a[i].second=i;
	sort(a+1,a+1+n);
	for(int i=1;i<=n/2;i++)f[a[i].second]=1;
	for(int i=1;i<=n;i++){
		if(!sz||c==f[i]){c=f[i];sz++;putchar('(');}
		else{sz--;putchar(')');}
	}
	return 0;
}

#include<set>
#include<queue>
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 400005
#define ENDL putchar('\n')
#define LL long long
#define DB double
#define lowbit(x) ((-x) & (x))
#define INF 0x3f3f3f3f
LL read() {
	LL f = 1,x = 0;char s = getchar();
	while(s < '0' || s > '9') {if(s=='-')f = -f;s = getchar();}
	while(s >= '0' && s <= '9') {x=x*10+(s-'0');s = getchar();}
	return f * x;
}
int n,m,i,j,s,o,k;
int a[MAXN];
struct it{
	int nm,id;
}b[MAXN];
bool cmp(it a,it b) {return a.nm == b.nm ? (a.id < b.id):(a.nm < b.nm);}
int main() {
	n = read();
	for(int i = 1;i <= 2*n;i ++) {
		a[i] = read();b[i].nm = a[i];b[i].id = i;
	}
	sort(b + 1,b + 1 + 2*n,cmp);
	for(int i = 1;i <= n;i ++) {
		a[b[i].id] *= -1;
	}
	int ct = 0;
	for(int i = 1;i <= 2*n;i ++) {
		if(a[i] < 0) {
			if(ct < 0) putchar(')');
			else putchar('(');
			ct ++;
		}
		else {
			if(ct > 0) putchar(')');
			else putchar('(');
			ct --;
		}
	}ENDL;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using V = vector<T>;
using VI = V<int>;
using VL = V<ll>;
using VS = V<string>;
template<class T> using PQ = priority_queue<T, V<T>, greater<T>>;
using graph = V<VI>;
template<class T> using w_graph = V<V<pair<int, T>>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#ifdef _DEBUG
#define line cout << "-----------------------------\n"
#define stop system("pause")
#endif
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, V<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline V<T> vec(size_t a) { return V<T>(a); }
template<class T>inline V<T> defvec(T def, size_t a) { return V<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return V<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return V<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const V<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const V<V<T>>& v) { for (auto& a : v)print(a); }
template<class T>inline T sum(const V<T>& a, int l, int r) { return a[r] - (l == 0 ? 0 : a[l - 1]); }
template<class T>inline void END(T s) { print(s); exit(0); }
void END() { exit(0); }

int main() {
    init();

    int n; cin >> n;
    VL a(n * 2); cin >> a;

    vector<char> c(n * 2);
    vector<pair<int, int>> b(n * 2);
    FOR(i, 0, n * 2)b[i] = { a[i],i };
    sort(all(b));
    FOR(i, 0, n * 2) {
        if (i < n)c[b[i].second] = 'o';
        else c[b[i].second] = 'x';
    }

    string ans(n * 2, '?');
    stack<pair<int, char>> st;
    FOR(i, 0, n * 2) {
        if (st.empty()) {
            st.emplace(i, c[i]);
        }
        else {
            if (st.top().second == c[i]) {
                st.emplace(i, c[i]);
            }
            else {
                ans[st.top().first] = '(';
                ans[i] = ')';
                st.pop();
            }
        }
    }

    print(ans);

    return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define rrep1(i, n) for (int i = n; i >= 1; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define eb emplace_back
#define fi first
#define se second
#define sz(x) (int)(x).size()
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
typedef long long int ll;
typedef pair<ll, ll> P;
// typedef modint1000000007 mint;

void speedUpIO() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
}

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/*--------------------------------------------------*/
const int INF = 1e9;
const ll LINF = 1e18;
const int MAX = 100010;

void solve() {
    ll n;
    cin >> n;
    V<ll> r, g, b;
    rep(i, 2 * n) {
        ll a;
        char c;
        cin >> a >> c;
        if (c == 'R') r.eb(a);
        if (c == 'G') g.eb(a);
        if (c == 'B') b.eb(a);
    }
    if (sz(r) % 2 == 0 && sz(g) % 2 == 0 && sz(b) % 2 == 0) {
        cout << 0 << "\n";
        return;
    }
    if (sz(r) % 2 == 0) swap(r, b);
    if (sz(g) % 2 == 0) swap(g, b);
    sort(all(r));
    sort(all(g));
    sort(all(b));
    ll ans = LINF;
    {
        ll m = sz(r);
        rep(i, m) {
            ll j = lower_bound(all(g), r[i]) - g.begin();
            if (j < sz(g)) chmin(ans, abs(g[j] - r[i]));
            if (j > 0) chmin(ans, abs(g[j - 1] - r[i]));
        }
    }
    if (sz(b) == 0) {
        cout << ans << "\n";
        return;
    }
    {
        V<P> rv, gv;
        rep(i, sz(r)) {
            V<P> rrv;
            ll j = lower_bound(all(b), r[i]) - b.begin();
            if (j < sz(b)) rrv.eb(abs(b[j] - r[i]), j);
            if (j + 1 < sz(b)) rrv.eb(abs(b[j + 1] - r[i]), j + 1);
            if (j - 1 >= 0) rrv.eb(abs(b[j - 1] - r[i]), j - 1);
            sort(all(rrv));
            set<ll> st;
            rep(k, sz(rrv)) {
                if (st.count(rrv[k].se) > 0) continue;
                st.insert(rrv[k].se);
                rv.eb(rrv[k]);
                if (sz(st) == 2) break;
            }
        }
        sort(all(rv));
        rep(i, sz(g)) {
            V<P> ggv;
            ll j = lower_bound(all(b), g[i]) - b.begin();
            if (j < sz(b)) ggv.eb(abs(b[j] - g[i]), j);
            if (j + 1 < sz(b)) ggv.eb(abs(b[j + 1] - g[i]), j + 1);
            if (j - 1 >= 0) ggv.eb(abs(b[j - 1] - g[i]), j - 1);
            sort(all(ggv));
            set<ll> st;
            rep(k, sz(ggv)) {
                if (st.count(ggv[k].se) > 0) continue;
                st.insert(ggv[k].se);
                gv.eb(ggv[k]);
                if (sz(st) == 2) break;
            }
        }
        sort(all(gv));
        rep(i, min(2, sz(rv))) rep(j, min(2, sz(gv))) {
            if (rv[i].se == gv[j].se) continue;
            ll t = rv[i].fi + gv[j].fi;
            chmin(ans, t);
        }
    }
    cout << ans << "\n";
}

int main() {
    speedUpIO();
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        // cout << solve() << "\n";
        // cout << (solve() ? "Yes" : "No") << "\n";
        // cout << fixed << setprecision(15) << solve() << "\n";
    }
    return 0;
}


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

using namespace std;

#define ll long long
#define reps(i, a, b) for(int i = a; i < b; i++)
#define rreps(i, a, b) for(int i = a-1; i >= b; i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define P pair<int, int>
#define vec vector<int>
#define mat vector<vec>

const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    int x;
    cin >> x;
    int ans = 100 - x % 100;
    cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  cout << (n - 1) / 100 + 1 << endl;
}


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

long long solve(vector<int>& a, vector<int>& b) {
    // cerr << "a = "; for (int x : a) cerr << ' ' << x; cerr << endl;
    // cerr << "b = ";for (int x : b) cerr << ' ' << x; cerr << endl;
    int k = 0;
    const int n = a.size();
    assert(a[0] != b[0]);
    long long ans = 0;
    for (int i = 0; i < n; ) {
        int prevk = k;
        while (k < n && b[i] + k - i != a[k]) k++;
        if (k == n) {
            if (b[i] + n - 1 == b[n-1] + i) {
                ans += n - i;
                break;
            } else {
                cout << "-1\n"; exit(0);
            }
        }
        if (k > prevk) ans += k - i;
        // cerr << i << " " << k << " " << ans << endl;
        i++;
    }
    // cerr << " => " << ans << endl;
    return ans;
}

int main() {
    int n, L; cin >> n >> L;
    int a[n], b[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    long long ans = 0;
    for (int i = 0;;) {
        while (i < n && a[i] == b[i]) i++;
        if (i == n) break;
        int j = i;
        while (j < n && a[j] != b[j] && ((a[i] < b[i]) == (a[j] < b[j]))) j++;
        vector<int> ta(j-i), tb(j-i);
        for (int k = i; k < j; k++) {
            ta[k-i] = a[k];
            tb[k-i] = b[k];
        }
        if (a[i] > b[i]) {
            if ((i == 0 && b[i] != 1) || (i > 0 && b[i] != b[i-1] + 1)) {
                ans = -1; break;
            }
        } else {
            if ((j == n && b[j-1] != L) || (j < n && b[j-1] != b[j] - 1)) {
                ans = -1; break;
            }
        }

        if (a[i] > b[i]) {
            for (int &x : ta) x = -x;
            for (int &x : tb) x = -x;
            reverse(ta.begin(), ta.end());
            reverse(tb.begin(), tb.end());
        }
        ans += solve(ta, tb);
        i = j;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

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

signed main(){
    int n;ll l;cin>>n>>l;
    vector<ll> a(n),b(n);
    cin>>a>>b;

    ll p=0;
    vector<ll> A,B;
    rep(i,n){
        A.push_back(a[i]-p-1);
        p=a[i];
    }
    A.push_back(l-a.back());
    p=0;
    rep(i,n){
        B.push_back(b[i]-p-1);
        p=b[i];
    }
    B.push_back(l-b.back());
    ll res=0;
    for(int i=0,ai=0;i<(int)B.size();i++)if(B[i]){
        while(A[ai]==0) ai++;
        ll sum=0;
        ll l=ai;
        while(sum<B[i]) sum+=A[ai++];
        res+=max(0ll,i-l);
        res+=max(0,ai-i-1);
        if(sum>B[i]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<res<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using ld=long double;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
using vp=vector<P>;
using vvp=vector<vp>;
const int inf=1e9+7;
const ll INF=9e18/2;
const long double PI = acosl(-1.0);
const long double EPS=1e-10;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[8] = {0,0,1,-1,1,1,-1,-1};
const int dy[8] = {1,-1,0,0,1,-1,1,-1};
void vecout(const vector<int> &a){
  int n=a.size();
  rep(i,0,n)cout<<a[i]<<(i==n-1 ? "":" ");
  cout<<endl;
}

int main(){//cout<<fixed<<setprecision(20);
  int n;
  cin>>n;
  int ans=0;
  rep(i,0,n){
    int a;
    cin>>a;
    if(a<=10)continue;
    else ans+=(a-10);
  }
  cout<<ans<<endl;
}

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

#define ll long long

void solve() {
	int n;
	cin >> n;
	vector<int> ar(n);
	for (int &x : ar) {
		cin >> x;
	}

	int ans = 0;
	for (int &x : ar) {
		if (x > 10) {
			ans += x - 10;
		}
	}
	cout << ans;
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using ll = long long;
using ld = long double;

#define mp make_pair

int p = 1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

mt19937 rnd(time(0));

const int N = 1000005;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}

/*struct DSU
{
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU (int n)
    {
        parent.resize(n);
        sz.resize(n);
        for (int i = 0; i<n; i++) make_set(i);
    }
};*/

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

    int n; cin>>n;
    string s;
    cin>>s;
    vector<char> a(2e5);
    int cur = 0;
    for (auto c: s)
    {
        a[cur] = c;
        if (cur>=2 && a[cur-2]=='f' && a[cur-1]=='o' && a[cur]=='x') cur-=3;
        cur++;
    }
    cout<<cur;
}

#include <iostream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define FOR(i,n,m) for(int i=n; i<(int)m; i++)
#define ROF(i,n,m) for(int i=n; i>(int)m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define ri(a) scanf("%d",&a)
#define rii(a,b) ri(a),ri(b)
#define riii(a,b,c) rii(a,b),ri(c)
#define lri(a) scanf("%lld",&a)
#define lrii(a,b) lri(a),lri(b)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define all(x) x.begin(),x.end()
#define debug true
#define dprintf debug && printf

const int INF = 0x3f3f3f3f;
const ll INFLL = 1e18;
const int MOD = 1e9+7;
const int MAXN = 2e5+5;

char s[MAXN];
int n;

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

    ri(n);
    scanf("%s", s);

    vector<char> ans;
    int sz = 0;
    FOR(i,0,n){
        ans.pb(s[i]); sz++;
        if(s[i] == 'x' && sz > 2
            && ans[sz-2] == 'o' && ans[sz-3] == 'f'){
                ans.pop_back();
                ans.pop_back();
                ans.pop_back();
                sz -= 3;
            }
    }

    printf("%d\n", sz);

    return 0;
}


#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	if (n == 3) {
		puts("6 10 15");
		return 0;
	}
	std::vector<int> res;
	for (int i = 1; i <= 10000 && (int) res.size() < n; i++) {
		if (!(i % 2) + !(i % 3) + !(i % 5) >= 2) res.push_back(i);
	}
	assert((int) res.size() == n);

	for (int i = 0; i < n; i++) {
		if (i) printf(" ");
		printf("%d", res[i]);
	}
	puts("");

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
typedef long long ll;
typedef vector<int> vi;
typedef vector<pair<ll , int> > vpli;
typedef set<char> st;
typedef stack<int> s;
typedef deque<int> dq;
typedef queue<int> q;
int main (){
  string s;
  cin >> s;
  reverse(all(s));
  for(int i = 0; i<sz(s); i++){
    if(s[i] == '6'){s[i] = '9';}
    else if(s[i] == '9'){s[i] = '6';}
  }
  cout<<s<<endl;
}


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

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

ll S,P;

void solve() {
	int i,j,k,l,r,x,y; string s;

	cin>>S>>P;
	for(ll a=1;a*a<=P;a++) if(P%a==0) {
		ll b=P/a;

		if(a+b==S) {
			cout<<"Yes"<<endl;
			return;
		}

	}
	cout<<"No"<<endl;
}

int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}

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

typedef long long LL;

#define FOR(i,a,b) for(int _n(b),i(a);i<_n;i++)
#define REP(i,n) FOR(i,0,n)

void setIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
}

const int MX = 200005;
int a[MX];
int n;
string s, x;
int M[MX][7];

int can(int p, int m) {
    if (p == n) return m == 0;

    int &r = M[p][m];
    if (r != -1) return r;

    // 0
    int nm = (m*10)%7;
    int r1 = can(p+1, nm);

    // Si
    nm = (m*10+s[p]-'0')%7;
    int r2 = can(p+1, nm);

    if (x[p] == 'T') {
        return r = r1 || r2;
    }

    return r = r1 && r2;
}

int main() {
    setIO();
    cin>>n>>s>>x;
    memset(M, -1, sizeof M);
    cout << (can(0, 0) ? "Takahashi" : "Aoki") << "\n";
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define fastboi cin.tie(0) -> sync_with_stdio(0)
using namespace std;
int main (void)
{
fastboi;
ll t;
cin >> t;
cout << 100 - (t%100) <<endl;
return 0;
}

//12252024832524
#include <cstdio>
#include <cstring>
#include <algorithm>
#define TT template<typename T>
using namespace std;

typedef long long LL;
const int MAXN = 100005;
int n,ans;

LL Read()
{
	LL x = 0,f = 1;char c = getchar();
	while(c > '9' || c < '0'){if(c == '-')f = -1;c = getchar();}
	while(c >= '0' && c <= '9'){x = (x*10) + (c^48);c = getchar();}
	return x * f;
}
TT void Put1(T x)
{
	if(x > 9) Put1(x/10);
	putchar(x%10^48);
}
TT void Put(T x,char c = -1)
{
	if(x < 0) putchar('-'),x = -x;
	Put1(x); if(c >= 0) putchar(c);
}
TT T Max(T x,T y){return x > y ? x : y;}
TT T Min(T x,T y){return x < y ? x : y;}
TT T Abs(T x){return x < 0 ? -x : x;}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	for(int i = 1;i <= 3;++ i) ans += 6-Read()+1;
	Put(ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
typedef long long int ll;
const int M=100009;
int cnt=0;
int prime[2555];
int flag[M+1];
void prim()
{
	for(int i=2;i<=M;i++)
	{
		if(!flag[i])
		{
			cnt++;
			prime[cnt]=i;
			if(cnt==2502)break;
		}
		for(int j=1;j<=cnt&&i*prime[j]<=M;j++)
		{
			flag[i*prime[j]]=1;
			if(i%prime[j]==0)break;
		}
	}
}
int main()
{
	int n;
//	memset(flag,0,sizeof(flag));
//	prim();
	//int sum=0;
/*	for(int i=4;i<=cnt;i++)
	{
		if(prime[i]<=10000/6)sum++;
	}
	cout<<sum;*/
//	cout<<cnt;
	scanf("%d",&n);
	int k1=n/3;
	int k2=n/3;
	int k4=n-k1-k2;
	int sum=0;
//	int i,j,k;
//cout<<"6 ";
		for(int j=1;j<=10000;j++)
		{
			if(j%5==0)continue;
			if(6*j>10000)break;
			cout<<6*j<<" ";
			sum++;
			if(sum==(n-2))break;
		}
		//cout<<sum<<"\n";
		for(int j=1;j<=10000;j++)
		{
			if(j%3==0)continue;
			if(10*j>10000)break;
			cout<<10*j<<" ";
			sum++;
			if(sum==(n-1))break;
		}
	//	cout<<sum<<"\n";
		for(int j=1;j<=10000;j++)
		{
			if(j%2==0)continue;
			if(15*j>10000)break;
			cout<<15*j<<" ";
			sum++;
			if(sum==n)break;
		}
		//cout<<sum<<"\n";
		for(int j=sum;j<n;j++)
		{
		//	cout<<j-sum+1<<" ";
			cout<<30*(j-sum+1)<<" ";
		//	cout<<sum<<"\n"<<n<<"\n";
		}
	//	cout<<sum;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;
/* DEBUGGING */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
/* R/W */
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(long long int &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const long long int &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
/* MACROS */
typedef long long int ll;

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef map<int,int> mii;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  all(x)      (x).begin(), (x).end()
#define  lcm(x, y)   ((x) * (y) / __gcd(x, y))
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcountll(x)
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)

/* CONSTANTS */
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

void solve(){
    int n; cin >> n;
    if(n>=0) cout << n;
    else cout << "0";
}

int main(){
    IOS;
    solve();
}

// Always take complete input
// Use MOD wisely


#include<bits/stdc++.h>

using namespace std;

#define int long long
const int mod=998244353;

signed main()
{

  	int a,b,c;

  	cin>>a>>b>>c;

  	int x=(a*(a+1))/2;
  	x%=mod;

  	int y=(b*(b+1))/2;
  	y%=mod;

  	int z=(c*(c+1))/2;
  	z%=mod;

  	int ans= ( ((x*y)%mod) * z)%mod;
  	cout<<ans<<"\n";

  	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
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;}
#ifdef LOCAL
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cerr<<(*i)<<" ";cerr<<endl;}
#else
template<class T>void pv(T a,T b){}
#endif

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  ll X = nextLong();
  ll Y = nextLong();
  ll A = nextLong();
  ll B = nextLong();

  ll ans = 0;
  for (ll a = 0; a <= 70; a++) {
    ll x = X;
    bool ok = true;
    REP(i, a) {
      if (x * A < Y && x < Y / A) {
        x *= A;
      } else {
        ok = false;
      }
    }
    if (!ok) continue;
    ll b = (Y - 1 - x) / B;
    ll val = a + b;
    chmax(ans, val);
  }

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

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


#include <bits/stdc++.h>
#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(12)
using namespace std;
using ll = long long;
#define sbc __builtin_popcount
#define pb push_back
void solve() {
	int n,m;
	cin>>n>>m;
	vector<vector<pair<int,int>>> v(n+1);
	for(int i=0,x,y,z;i<m;++i) {
		cin>>x>>y>>z;
		v[x].pb({y,z});
	}
	int M=(1<<n);
	ll dp[M]{};
	dp[0]=1;
	for(int i=0;i<M;++i) {
		int p=sbc(i);
		for(auto& [y,z]:v[p]) {
			int ms=(1<<y)-1;
			if(sbc(ms&i)>z)
				dp[i]=0;
		}
		for(int x=0;x<n;++x) {
			if(!(i>>x&1)) {
				dp[i|1<<x]+=dp[i];
			}
		}
	}
	cout<<dp[M-1]<<endl;
}
int main() {
	speedup;
	//int t; cin >> t; while (t--)
	solve();
}

#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    int n, m;
    cin >> n >> m;

    vector< vector<int> > v(n + 1, vector<int>(n + 1, IINF));
    rep(i, m){
        int x, y, z;
        cin >> x >> y >> z;
        chmin(v[x][y], z);
    }

    vector<lint> dp(1 << n, 0);
    dp[0] = 1;

    rep(bit, 1 << n){
        vector<int> cnt(n, 0);
        rep(i, n){
            cnt[i] += bit >> i & 1;
            if(i) cnt[i] += cnt[i - 1];
        }

        rep(i, n){
            if(v[cnt[n - 1]][i + 1] < cnt[i]){
                dp[bit] = 0;
                break;
            }
        }

        rep(i, n){
            if(bit >> i & 1){
                continue;
            }

            dp[bit | (1 << i)] += dp[bit];
        }
    }

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

    cout << flush;

    return 0;
}


#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

#define mp make_pair
#define x first
#define y second
typedef pair<int,int> pii;
typedef long long ll;

char dp[103][103],polje[103];
int modn[103],n;

char igra(char a,char b){
	if(a==b) return a;
	else if((a=='S' and b=='P') or (a=='P' and b=='S')) return 'S';
	else return min(a,b);
}
char rek(int pos,int i){
	if(i==0) return polje[pos];
	if(dp[pos][i]!='.') return dp[pos][i];
	int p2=(pos+modn[i-1])%n;
	return dp[pos][i]=igra(rek(pos,i-1),rek(p2,i-1));
}

int main(){
	int k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>polje[i];
	}
	modn[0]=1;
	for(int i=1;i<=k;i++){
		modn[i]=(modn[i-1]*2)%n;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<=k;j++){
			dp[i][j]='.';
		}
	}
	cout<<rek(0,k);

return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(998244353);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int multipf(vector<string>& s){
    if(s.size() == 0)return 0;
    cout << s[0];
    rep1(i, s.size() - 1)cout << " " << s[i];
    cout << endl;
    return 0;
}

int multipf(vector<ll>& n){
    if(n.size() == 0)return 0;
    cout << n[0];
    rep1(i, n.size() - 1)cout << " " << n[i];
    cout << endl;
    return 0;
}

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

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

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b, ll m){
    ll ans = 1;
    while(b) {
        if(b & 1LL) ans = ans * a % m;
        ans %= m;
        a = a * a;
        a %= m;
        b >>= 1;
    }
    return ans % m;
}

struct UnionFind {
    vector<ll> par;
    vector<ll> rank;
    vector<ll> Size;
    UnionFind(ll n) {
        init(n);
    }

    void init(ll n) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        rep0(i, n + 1){
            par[i] = i;
            rank[i] = 0;
            Size[i] = 1;
        }
    }

    ll root(ll x) {
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    bool merge(ll x, ll y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(ll x){
        return Size[root(x)];
    }
};

int main() {
    ll n,f;
    cin >> n;
    UnionFind u(n);
    rep0(i, n){
        cin >> f;
        --f;
        u.merge(i, f);
    }
    vector<bool> ff(n,true);
    ll cnt = 0;
    rep0(i, n){
        ll k = u.root(i);
        if(ff[k]){
            ff[k] = false;
            ++cnt;
        }
    }
    pf((power(2, cnt, mod) - 1 + mod) % mod);
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fin(a) { cout << a << endl; return 0; }
#define debug(a) { cerr << #a << ": " << a << endl; }
#define endl '\n'
#define fi first
#define se second
using lint = long long;
using ld = long double;
using P = pair<int,int>;
using Pl = pair<lint,lint>;
template<class T> using V = vector<T>;
template<class T> using priq     = priority_queue<T>;
template<class T> using priq_inv = priority_queue<T, vector<T>, greater<T>>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
template<class T> T ceil(const T &a, const T &b) { return ((a)+(b)-1)/b; }
template<class T> bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; }
template<class T> bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; }
template<class T> void YesorNo(T x) { printf(x ? "Yes\n" : "No\n"); }
struct INF { template<class T> operator T() { return numeric_limits<T>::max() / 2; } } INF;

template<class T, class U> istream& operator>>(istream &in, pair<T,U> &p) {
    return in >> p.first >> p.second;
}
template<class T, class U> ostream& operator<<(ostream &out, const pair<T,U> &p) {
    return out << '{' << p.first << ',' << p.second << '}';
}
template<class T> istream& operator>>(istream &in, vector<T> &v) {
    for(auto &&e : v) in >> e;
    return in;
}
template<class T> ostream& operator<<(ostream &out, const vector<T> &v) {
    for(const auto &e : v) out << e << ' ';
    return out;
}

/*----------------------------------------------------------------------------------------------------*/

int main(){
    int n;
    cin >> n;
    int idx = 1;
    int now = 1;
    V<int> ans(n); ans[0] = 1;
    for(int i = 2; i <= n; i++) {
        if(i % idx == 0) {
            idx = i;
            now++;
        }
        ans[i-1] = now;
    }
    cout << ans << endl;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

// Picasso didn't learn to paint by watching lectures

/*
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/

using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define ook order_of_key
#define fbo find_by_order
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define mod 1000000007
#define tot_time cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
//#define maxx 200006
#define fixed cout<<fixed<<setprecision(14);
#define ll long long
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long >
#define listi vector< int>
#define pii   pair<int , int>
#define pll pair<long long , long long >
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
#define memo(a,x ) memset( a, x ,sizeof ( a) )
#define randoms mt19937 rng(26);

template  < class  T >
vector< T > readvector  ( T  n ) {  vector < T > arr(n ) ;
	    for( int  i =0; i < n ; i ++ ) cin>>arr[i] ;
		return arr; }

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

ll power( ll a, ll n, ll m= 1000000007){
  ll ans = 1;
  while(n){
  if(n&1)
  {
  ans *= a;
  ans%=m;
  }
  a*=a;
  a%=m;
  n/=2;
  }
  return ans ;
}

vector< int > prm ;
vector < bool > vsp ;

void prime ( int nn = 100000 ) {
	vsp = vector < bool > ( nn+1, 0 );
	int size_prime = nn;
	for( ll i =2; i*i < size_prime ; i++){

		if( vsp[i] == 1)
		continue;
		for(ll j = i*i; j < size_prime ;j+=i){

			vsp[j] =1;

		}

	}

	for( int i= 2; i < size_prime ; i++)
	if (vsp[i] == 0)
	prm.pb(i);

}

//auto comparator = [] ( array < ll ,2 >  &a  , array < ll , 2  > &b ) {  return ( a[0] < b[0 ] || (a[ 0] == b[ 0] && a[1]  > b[1] ) ) ; } ;

//priority_queue< array <  ll  , 2> , vector< array< ll ,2 > > , decltype( comparator )  > pq ( comparator);

template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;
// oset< int > tree ;
// tree.ook ( val  )  return index of element ;
// tree.fbo ( idx )   return pointer at the element .

// end of #define

// define globals ...
const int maxx = 2e5+26;

//write function from here ...
// never forget  to recheck your predefined function in template ..
// already defined ::  prime , power , gcd : ( ll )..

int Main(int t ){

 int n ;
 cin>>n;

 vector< int > arr( n , 0 ) ;

 ll tw = 1 ;
 arr[ 0  ]=1 ;
 ll tt = 1 ;
 while( true ) {
	 int pre = tw +1  ;
	 tt*=2 ;
	 tw += tt;
	 if ( pre > n )
	 break;
	 int temp = pre ;
	 while ( temp <= tw && temp <= n ) {
		 arr[ temp-1] = arr[ pre-2] +1;
		 temp +=1;
	 }

 }

 for( int a : arr){
	 cout<<a<<" ";
 }

return 0;

}

int main(){
 quick;

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

int t =1;
//cin>>t;
while(t-- )
 Main(t);

 return 0;
}


#include <cmath>
#include <iostream>

int main() {
    long long n;
    std::cin >> n;
    long long ans {0};
    long long k {1};
    while (n >= pow(10, k*3)) {
        ans += n - pow(10, k*3) + 1;
        ++k;
    }
    std::cout << ans << std::endl;
}

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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N;
    cin >> N;

    ll res = 0;
    ll now = 1;

    REP(i, 6){
        now *= 1000;
        res += max(N - now + 1, 0ll);
    }
    cout << res << endl;

    return 0;
}