#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ff               first
#define ss               second
#define pb               push_back
#define all(x)           (x).begin(), (x).end()
#define mem0(x)          memset(x, 0, sizeof (x))
#define mem1(x)          memset(x, -1, sizeof (x))

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector <ii> vii;
typedef vector<vii> vvii;
typedef vector <ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T=1, n;
    while (T--){
        cin >> n;
        ll ans = 0;
        vll acum(n,0);
        vi mxpos(n,0);
        ll mx = -1e18;
        ll pos = -1;
        for (int i = 0; i < n; ++i) {
            int aux; cin >> aux;
            acum[i] = aux;
            if (i) acum[i] += acum[i-1];
            if (acum[i] > mx){
                pos = i;
                mx = acum[i];
            }
            mxpos[i] = pos;
        }
        ll curr = 0;
        for (int i = 0; i < n; ++i) {
            ans = max(ans, curr + acum[mxpos[i]]);
            curr += acum[i];
        }
        cout << ans << "\n";
    }
}

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;

int main() {
  lint N;
  cin >> N;
  vector<lint> A(N);
  for(auto& elem : A) cin >> elem;

  P ans = {0,0};
  for(lint i=2; i<=1000; i++) {
    lint counter = 0;
    for(auto a : A) {
      counter += (a%i == 0);
    }
    ans = max(ans, P(counter, i));
  }
  cout << ans.second << endl;
}


#include <array>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vpii = vector<pii>; using vpll = vector<pll>;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (const auto &x : v) os << x << " "; return os; }

void solve() {
	int n;
	cin >> n;
	vector<ll> a(n), b(n), x(n);
	ll suma = 0;
	for (int i=0; i<n; i++) {
		cin >> a[i] >> b[i];
		suma += a[i];
		x[i] = 2*a[i] + b[i];
	}
	sort(x.rbegin(), x.rend());
	ll score = -suma;
	int i = 0;
	while (score <= 0) {
		score += x[i];
		i++;
	}
	cout << i << endl;
}

int main() {
	solve();
	return 0;
}

//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
using namespace std;
#define Fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr)
#define f(i, n) for (long long int i = 0; i < n; i++)
#define ll long long int
#define fo(i, a, b) for (long long int i = a; i <= b; i++)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vl vector<long long int>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define mii map<int, int>
#define umii unordered_map<int, int>
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define newl cout<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll inf = 1e9 + 7;
const ll mod = 1e9 + 7;
#define MAX 100005

ll mini(ll a,ll b){
    if(a>=b)return b;
    return a;
}

ll maxi(ll a,ll b){
    if(a>=b)return a;
    return b;
}

bool cmp(pair<ll,ll> a,pair<ll,ll>b){
    return a.fi>b.fi;
}

int main(){
	Fio;
    ll n;
    cin>>n;
    vector<ll>A;
    ll ao = 0,taka = 0;
    fo(i,1,n){
        ll x,y;
        cin>>x>>y;
        A.pb(2*x+y);
        ao+=x;
    }
    sort(A.rbegin(),A.rend());
    ll ans = 0;
    fo(i,0,n-1){
        taka += A[i];
        ans++;
        if(taka>ao)break;
    }
    cout<<ans;

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> psl(N, vector<int>(2));
  vector<vector<int>> psr(N, vector<int>(2));
  for (int i = 0; i < N; ++i) {
    cin >> psr[i][0] >> psl[i][0];
    psr[i][1] = i;
    psl[i][1] = i;
    // cout << ps[i][0];
    // cout << ps[i][1];
    // cout << endl;
  }
  sort(psl.begin(), psl.end(),
       [](const vector<int> &alpha, const vector<int> &beta) {
         return alpha[0] < beta[0];
       });
  sort(psr.begin(), psr.end(),
       [](const vector<int> &alpha, const vector<int> &beta) {
         return alpha[0] < beta[0];
       });

    if (psr[0][1] == psl[0][1]) {
      if ((psr[0][0] + psl[0][0]) <= min(psr[1][0], psl[1][0])) {
        cout << psr[0][0] + psl[0][0] << endl;
      } else {
    	cout << min(max(psr[0][0],psl[1][0]), max(psr[1][0], psl[0][0]))  << endl;
      }
    } else {
    	cout << max(psr[0][0], psl[0][0])  << endl;
    }
}

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
#define all(v) v.begin(), v.end()
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, b) for (ll i = a; i < b; ++i)
#define rep_down(i, a, b) for (ll i = a; i > b; --i)

#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second

#define vvvvll vector<vector<vector<vector<ll>>>>
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>

#define vvvvdo vector<vector<vector<vector<double>>>>
#define vvvdo vector<vector<vector<double>>>
#define vvdo vector<vector<double>>
#define vdo vector<double>

#define maze(S, H, W) vector<vector<char>> S(H, vector<char>(W))

#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
// constexpr ll mod = 998244353;
// constexpr ll mod = 67280421310721;
// constexpr ll mod = 1e18+3;
ll mod = 1000000007;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
void pt(T val) {
    cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];

        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}
template <typename T>
void pt_vvll(vector<vector<T>> &v) {
    ll vs = v.size();
    rep(i, vs) pt_vll(v[i]);
}

template <typename X, typename Y>
void pt_pair(pair<X, Y> val) {
    cout << val.fi << " " << val.se << "\n";
}

template <typename X, typename Y>
void pt_vpair(vector<pair<X, Y>> &v) {
    rep(i, v.size()) pt_pair(v[i]);
}

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

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll x, ll n) {
    ll ret = 1;
    if (x < 0) return 0ll;
    while (n > 0) {
        if (n & 1) ret = ret * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ret;
}
ll minv(ll a, ll m) { return modpow(a, m - 2); }

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

    ll N;
    cin >> N;
    vll A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    ll ans = INF;
    rep(i, N) { rep(j, N) if (i != j) chmin(ans, max(A[i], B[j])); }
    rep(i, N) chmin(ans, A[i] + B[i]);
    pt(ans);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)

const ll MOD = 1000000007;
const ll INF = (ll) 4e18;

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

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

//! 方程式 ax = b (mod m) の解xを返す。
//! 見つからなかった場合 -1
long long mod_solver(long long a, long long b, long long m) {
    if (a < 0) {
        a = (m - (abs(a) % m)) % m;
    }
    if (b < 0) {
        b = (m - (abs(b) % m)) % m;
    }
    a %= m;
    b %= m;
    if (b == 0)
        return 0;
    if (a == 0)
        return -1;
    long long g0 = gcd(m, gcd(a, b));
    a /= g0;
    b /= g0;
    m /= g0;
    long long x, y;
    long long g1 = extGCD(a, m, x, y);
    if (g1 != 1) {
        return -1;
    }
    if (x < 0)
        x += m;
    return (x * b) % m;
}

ll solve() {
    ll X, Y, P, Q;
    cin >> X >> Y >> P >> Q;

    ll ret = INF;
    for (ll x = -Q + 1; x < Y; ++x) {
        // 電車から見た相対位置がxとなるような最小値
        //! 2*(X+Y)*t +X +x == P (mod P+Q)
        ll t = mod_solver(2LL * (X + Y), P - X - x, P + Q);
        if (t < 0)
            continue;
        ll ans = 2LL * (X + Y) * t + X;
        if (x >= 0) {
            ans += x;
        }
        ret = std::min(ret, ans);
    }
    if (ret == INF)
        ret = -1;
    return ret;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll Q;
    cin >> Q;
    REP(_, Q) {
        ll ans = solve();
        if (ans < 0) {
            cout << "infinity" << endl;
        }
        else {
            cout << ans << endl;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }
  reverse(A.begin(), A.end());
  for (ll i = 0; i < N; i++)
  {
    cin >> B.at(i);
  }

  priority_queue<ll, vector<ll>, greater<ll>> pque;
  ll AokiSum = 0;
  for (ll i = 0; i < N; i++)
  {
    pque.push(A.at(i));
    pque.push(B.at(i));

    AokiSum += pque.top();
    pque.pop();
  }

  ll S = accumulate(A.begin(), A.end(), 0LL) + accumulate(B.begin(), B.end(), 0LL);
  ll ans = S - AokiSum;
  cout << ans << endl;
}

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

using   ll  =       long long int;
using   pll =       pair<ll, ll>;
using   vll =       vector<ll>;
#define endl        "\n"
#define space       " "
#define TLE_na_ho   ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MAX_SIZE    1024
#define MOD         1000000007
#define pb          push_back
#define ff          first
#define ss          second
#define all(v)      v.begin(),v.end()
#define f(n)        for(ll i=0;i<n;i++)
#define rep(i,a,n)  for(ll i=a;i<n;i++)
#define repe(i,a,n) for(ll i=a;i<=n;i++)
#define repr(i,a,n) for(ll i=a;i>=n;i--)
#define ain(arr,n)  for(ll i1=0;i1<n;i1++ ) cin>>arr[i1]
#define aout(arr,n) for(ll i1=0;i1<n;i1++ ) cout<<arr[i1]<<space

ll testcases;

int main()
{
    TLE_na_ho;
    //READ THE QUESTION PROPERLY!!
    testcases = 1;
    //cin>>testcases;
    while(testcases--)
    {
        ll n;
        cin >> n;
        ll a[n];
        ll md = 0, cd = 0;
        double ed = 0;
        f(n)
        {
            cin >> a[i];
            md += abs(a[i]);
            cd = max(cd, abs(a[i]));
            ed += a[i] * a[i];
        }
        cout << fixed << setprecision(9) << md << endl << sqrt(ed) << endl << cd << endl;

    }

}


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

#define ll long long

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

	char ch[3];
	for(ll i=0;i<3;i++) cin>>ch[i];

    char c = ch[0];
    if(ch[1]==c && ch[2]==c) cout<<"Won\n";
    else cout<<"Lost\n";

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s[0]==s[1]&&s[1]==s[2])
    cout<<"Won";
  else
    cout<<"Lost";
}


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

const int MAX_N = 41;
typedef long long LL;

LL a[1 << (MAX_N / 2)], b[1 << (MAX_N / 2)];
LL item[MAX_N];

int generate_item(LL* s, int beg, int end) {
    int len = 1 << (end - beg);
    for (int i = 0; i < len; i++) {
        for (int j = beg; j < end; j++)
            s[i] += (1 << (j - beg)) & i ? item[j] : 0;
    }
    sort(s, s + len);
    return len;
}

LL GCD(LL x, LL y) {
    return y == 0 ? x : GCD(y, x % y);
}

LL LCM(LL x, LL y) {
    return x * y / GCD(x, y);
}

const int MAX_CHAR_NUM = 4 * 1e5 + 10;
char tmp[MAX_CHAR_NUM];

char get_char(LL p) {
    return p % 3 == 2 ? '0' : '1';
}

vector<int> getNext(const string& s) {
	vector<int> ret(s.length(), 0);
	if (ret.empty()) return ret;
	for (size_t k1(1), kt(0); k1 < ret.size(); ++k1) {
		while (kt && s[kt] != s[k1]) kt = ret[kt - 1];
		if (s[kt] == s[k1]) ++kt;
		ret[k1] = kt;
	}
	return ret;
}

vector<int> kmp(const string& s1, const string& s2) {
	vector<int> ret;
	int sl1(s1.length()), sl2(s2.length());
	if (!(sl1 && sl2)) return ret;
	vector<int> nv2(getNext(s2));
	for (int k1(0), k2(0); k1 < sl1;) {
		if (s1[k1] == s2[k2]) ++k1, ++k2;
		else if (k2) k2 = nv2[k2 - 1];
		else ++k1;
		if (k2 == sl2) ret.push_back(k1 - k2), k2 = nv2[k2 - 1];
	}
	return ret;
}

int match_num(const string& s, const string& t) {
    return kmp(s, t).size();
}

LL get_result(LL l, LL r, const string& t) {
    int len = t.length();

    if (r - l <= len) {
        string s(1, get_char(l));
        return match_num(s, t);
    }

    LL m = (l + r) / 2;

    LL left_result = get_result(l, m, t);
    LL right_result = get_result(m, r, t);
    LL mid_result = 0;

    int left_idx = max(l, m - len);
    int right_idx = min(r, m + len);
//    if (right_idx - left_idx >= len) {
//        for (int i = left_idx; i < right_idx; i++)
//            tmp[i - left_idx] = get_char(i);
//
//        tmp[right_idx - left_idx] = 0;
//
//        string mid_string(tmp);
//
//        mid_result = match_num(mid_string, t);
//    }
//    return mid_result;
    return left_result + right_result + mid_result;
}

int main() {
    LL SRC = 10000000000L;
    int N, p;
    string T;
    cin >> N >> T;

    if (N == 1) {
        cout << ((T[0] == '1') + 1) * SRC << endl;
        return 0;
    }

    tmp[N] = 0;
    for (p = 0; p < 3; p++) {
        for (int i = 0; i < N; i++) tmp[i] = get_char(p + i);
        string S(tmp);
        if (S == T) break;
    }

    if (p == 3) puts("0");
    else {
        cout << SRC - (p + N - 1) / 3 << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, M;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> M;
	map<int, vector<int>> pawns;
	rep(i, 0, M) {
		int X, Y; cin >> X >> Y;
		pawns[X].push_back(Y);
	}

	set<int> ans;
	ans.insert(N);

	fore(p, pawns) {
		set<int> ng;
		set<int> ok;
		fore(y, p.second) {
			if (ans.count(y - 1)) ok.insert(y);
			else if (ans.count(y + 1)) ok.insert(y);
			else ng.insert(y);
		}
		fore(i, ng) ans.erase(i);
		fore(i, ok)  ans.insert(i);
	}

	cout << ans.size() << endl;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include<atcoder/all>
using namespace atcoder;
#endif

typedef long long ll;
typedef long double ld;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;

#define all(x) x.begin(),x.end()
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
template<class... T>void input(T&... a){(cin >> ... >> a);};
#define INT(...) int __VA_ARGS__; input(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__; input(__VA_ARGS__)
#define STRING(...) string __VA_ARGS__; input(__VA_ARGS__)
void print(){cout << '\n';}
template<class T, class... Ts>void print(const T& a, const Ts&... b){cout << a; (cout << ... << (cout << ' ', b)); cout << '\n';}
template<class T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T1, class T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<typename T> ostream& operator << (ostream& os, set<T>& set_var) {os << "{"; for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {os << *itr;++itr;if(itr != set_var.end()) os << ", ";itr--;}os << "}";return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, map<T, U> &map_var) {os << "{";for(auto itr = map_var.begin(); itr != map_var.end(); itr++) {os << *itr;itr++;if (itr != map_var.end()) os << ", ";itr--;}os << "}";return os;}
#ifdef __LOCAL
void debug_out(){ cerr << endl;}
template < class Head, class... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
template<class T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
#define pb push_back
#define eb emplace_back
#define elif else if
#define mp make_pair
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template<typename T> T gcd(T x, T y){if(x%y == 0)return y;return gcd(y, x%y);}
template<typename T> T gcd(vector<T> a){T res = a[0];for(auto &x: a)res = gcd(res, x);return res;}
template <typename T>T mypow(T x, ll n){T ret = 1;while(n > 0){if(n & 1)(ret *= x);(x *= x);n >>= 1;}return ret;}
#define endl '\n'
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

void solve(){
    INT(a,b,c);
    print(max({a+b,a+c,b+c}));
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << setprecision(20);
    int codeforces = 1;
    //cin >> codeforces;
    while(codeforces--){
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
 int A,B,C;cin>>A>>B>>C;
 int a=A+B;
 int b=B+C;
 int c=A+C;
 if(A==B==C){
   cout<<A+B;
 }else{
 int z=max(max(a,b),c);
 cout<<z;
 }
}


#include <cstdio>

int N;
const int MAXN=2e5+7;
char buf[MAXN];

char pattern[MAXN];

using ll = long long int;
ll setu=1e10;

int main(){

    scanf("%d\n",&N);
    scanf("%s",buf);

    if (N==1&&buf[0]=='1') {
        puts("20000000000");
        return 0;
    }
    else if (N==1&&buf[0]=='0'){
        puts("10000000000");
        return 0;
    }

    for(int i=0;i<N+6;i++){
        if (i%3==0) pattern[i]='1';
        else if (i%3==1) pattern[i]='1';
        else pattern[i]='0';
    }

    int offset=0;
    while(offset<3){
        bool match=true;
        for(int i=0;i<N;i++)
            if (pattern[i+offset]!=buf[i]) {
                match=false;
                break;
            }
        if (match) break;
end:    offset++;
    }

out:

    if (offset==3){
        puts("0");
        return 0;
    }

    ll len=(N+offset+2)/3;
    ll ans=(setu-len)+1;

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

    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountint(x)
#define zrobits(x)      __builtin_ctzint(x)
#define mod             1000000007
#define INF             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define LCM(a,b)		((a*b)/__gcd(a,b))
#define PI              2*acos(0.0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

// If want to add duplicate values replace int with pair below
// and give the second pair value always unique in order to add duplicates in set.

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

// W,N,E,S
int dx[] = { -1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

// seive prime
void seive_prime(int N)
{
	vector<bool>prime(N + 1, true);
	vector<int>prime_no;

	prime[0] = false;
	prime[1] = false;

	for (int i = 4; i <= N; i += 2)
	{
		prime[i] = false;
	}

	for (int i = 3; i * i <= N; i += 2)
	{
		if (prime[i])
		{
			int m = i * i;

			while (m <= N)
			{
				prime[m] = false;
				m += i;
			}
		}
	}

	int i = 0;
	for (auto v : prime)
	{
		if (v)
			prime_no.push_back(i);

		i++;
	}

	// return prime_no;
}

// Primality Test
bool isPrime(int n)
{
	if (n == 2)
		return true;

	for (int i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
			return false;
	}

	return true;
}

// Modular Exponentiation
int modularExpo(int a, int b, int modVal)
{
	int res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res = (res * a) % modVal;
		}

		b = b >> 1;
		a = (a * a) % modVal;
	}
	return (res % modVal);
}

// Euler Totient function
void find_phi(vector<int>&phi)
{
	for (int i = 1; i < phi.size(); i++)
		phi[i] = i;

	for (int i = 2; i < phi.size(); i++)
	{
		if (phi[i] == i)
		{
			for (int j = i; j < phi.size(); j += i)
			{
				phi[j] = phi[j] - (phi[j] / i);
			}
		}
	}

	// for(int i=3; i<phi.size(); i++)
	// {
	// 	phi[i]+=phi[i-1];
	// }
}

int32_t main()
{
	c_p_c();

	// int case_no = 1;

	// w(t)
	// {

	// }

	int n;
	cin >> n;

	int cnt[n + 1] = {0};

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

		cnt[a] += 1;
	}

	int flag = 1;

	for (int i = 1; i <= n; i++)
	{
		if (cnt[i] > 1)
		{
			flag = 0;
			break;
		}
	}

	if (flag)
		cout << "Yes";

	else
		cout << "No";

#ifndef ONLINE_JUDGE
	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif

	return 0;

}


// chrono::system_clock::now().time_since_epoch().count()
#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

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

const int MAXN = (int)1e6 + 5;

ll dp[MAXN];
int L, R;
ll ans;

void solve() {
    cin >> L >> R;

    for (int g = R; g >= 1; g--) {
        int cnt = 0;

        for (int i = g; i <= R; i += g) {
            if (i >= L) {
                cnt++;
            }

            dp[g] -= dp[i];
        }

        dp[g] += cnt * 1ll * cnt;

        if (g > 1) {
            ans += dp[g];
        }
    }

    for (int a = L; a <= R; a++) {
        for (int b = a; b <= R; b += a) {
            if (a == 1 || b == 1) {
                continue;
            }

            if (a == b) {
                --ans;
            }
            else {
                ans -= 2;
            }
        }
    }

    cout << ans << '\n';
}

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

    int tt = 1;

    for (int i = 1; i <= tt; ++i) {
        solve();
    }

    return 0;
}

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

int main(){
  int l,r;
  cin>>l>>r;
  vector<ll> po(r+1,0);
  ll ans=0;
  for(int g=r;g>=2;g--){
    po[g]=r/g-(l-1)/g;
    po[g]*=po[g];
    for(int g2=2*g;g2<=r;g2+=g){
      po[g]-=po[g2];
    }
    ans+=po[g];
    if(g>=l)ans-=r/g*2-1;
  }
  cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
namespace Sakurajima_Mai{
    #define ms(a) memset(a,0,sizeof(a))
    #define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
    #define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
    #define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
    #define ce(i,r) i==r?'\n':' '
    #define pb push_back
    #define all(x) x.begin(),x.end()
    #define gmn(a,b) a=min(a,b)
    #define gmx(a,b) a=max(a,b)
    #define fi first
    #define se second
    typedef long long ll;
    typedef unsigned long long ull;
    typedef double db;
    const int infi=1e9;//infi较大，注意涉及inf相加时爆int
    const ll infl=4e18;
    inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
    inline ll pos_mod(ll a,ll b){ return (a%b+b)%b; }
    //std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
}
using namespace Sakurajima_Mai;
namespace Fast_Read{
    inline int qi(){
        int f=0,fu=1; char c=getchar();
        while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
        while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
        return f*fu;
    }
    inline ll ql(){
        ll f=0;int fu=1; char c=getchar();
        while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
        while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
        return f*fu;
    }
    inline db qd(){
        char c=getchar();int flag=1;double ans=0;
        while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
        if(c=='-') flag=-1,c=getchar();
        while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
        if(c=='.'){c=getchar();for(int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
        return ans*flag;
    }
}
namespace Read{
    #define si(a) scanf("%d",&a)
    #define sl(a) scanf("%lld",&a)
    #define sd(a) scanf("%lf",&a)
    #define ss(a) scanf("%s",a)
    #define rai(x,a,b) repi(i,a,b) x[i]=qi()
    #define ral(x,a,b) repi(i,a,b) x[i]=ql()
}
namespace Out{
    #define pi(x) printf("%d",x)
    #define pl(x) printf("%lld",x)
    #define ps(x) printf("%s",x)
    #define pc(x) printf("%c",x)
    #define pe() puts("")
}
namespace DeBug{
    #define MARK false
    #define DB if(MARK)
    #define pr(x) cout<<#x<<": "<<x<<endl
    #define pra(x,a,b) cout<<#x<<": "<<endl; \
            repi(i,a,b) cout<<x[i]<<" ";     \
            puts("");
    #define FR(a) freopen(a,"r",stdin)
    #define FO(a) freopen(a,"w",stdout)
}
using namespace Fast_Read;
using namespace Read;
using namespace Out;
using namespace DeBug;
const int MAX_N=2e5+5;
int n;
vector<int>ball[MAX_N];
int main()
{
    n=qi();
    repi(i,1,n){
        int x=qi(),c=qi();
        ball[c].pb(x);
    }
    ll resl=0,posl=0,resr=0,posr=0;
    repi(i,1,n)if(ball[i].size()){
        sort(all(ball[i]));
        ll pl=ball[i][0],pr=*ball[i].rbegin();
        ll nowl=min(abs(posl-pr)+pr-pl+resl,abs(posr-pr)+pr-pl+resr);
        ll nowr=min(abs(posl-pl)+pr-pl+resl,abs(posr-pl)+pr-pl+resr);
        resl=nowl,resr=nowr;
        posl=pl,posr=pr;
    }
    pl(min(resl+abs(posl),resr+abs(posr))),pe();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,x,y;
	cin>>a>>b>>x>>y;
	int y_=min(2*x,y);
	int kyori_=abs(2*b+1-2*a);
	cout<<kyori_/2*y_+x<<endl;
}


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

#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
#define DOR(i,s,t) for(int i=(s),_t=(t); i>=_t; --i)
#define EOR(i,x) for(int i=Head[x]; ~i; i=Nxt[i])

typedef long double db;
typedef long long ll;

namespace Eddd {
	inline char sc() {
		return getchar();
		static const int LEN=100000;
		static char Buf[LEN],*OP=Buf,*ED=Buf;
		if(OP==ED) ED=(OP=Buf)+fread(Buf,1,LEN,stdin);
		return *OP++;
	}
	template<class T> void rd(T &x) {
		static int c,f;x=f=0;
		while(c=sc(),c<48) if(c=='-') f=1;
		do x=(x<<3)+(x<<1)+(c^48);
		while(c=sc(),c>47);if(f) x=-x;
	}
	template<class T> void pt(T x) {
		if(x<0) putchar('-'),x=-x;
		else if(!x) putchar('0');
		static int Stk[30],tp=0;
		for(; x; x/=10) Stk[tp++]=x%10;
		while(tp) putchar(Stk[--tp]^48);
	}
	template<class T> void ptk(const T &x) {
		pt(x);putchar(' ');
	}
	template<class T> void ptn(const T &x) {
		pt(x);putchar('\n');
	}
	template<class T> bool chkmi(T &x,const T &y) {
		return x>y?x=y,true:false;
	}
	template<class T> bool chkmx(T &x,const T &y) {
		return x<y?x=y,true:false;
	}
}
using namespace Eddd;

int main() {
	int a,b;
	rd(a);rd(b);
	ptn(a*2+100-b);
	return 0;
}

#include <bits/stdc++.h>

#define yy cout<<"YES"<<endl;
#define nn cout<<"NO"<<endl;
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define mod 1000000007
#define cl cout <<endl

#define fi first
#define se second
#define int             long long
#define w(x)            int x; cin>>x; while(x--)
#define endl            ("\n")
#define f(i, a, n)      for(int i=a; i<n; i++)
#define pb              push_back
#define mi(a,b,c)       min(a,min(b,c))
#define cc(r)           cout<<r<<" "
#define ce(r)           cout<<r<<endl
#define cn              continue

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()

#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

#define present(c,x) ((c).find(x) != (c).end())

#define cpresent(c,x) (find(all(c),x) != (c).end())

#define sz(a) int((a).size())

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(6);
    cout << fixed;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin );
    //     freopen("output.txt" , "w" , stdout) ;
    // #endif
    int t =1 ;
    //cin >> t ;
    while (t--)
    {
        double a , b ;
        cin >> a >> b ;
        cout << a*b/100<< endl ;

    }
    return 0;
}


#include <bits/stdc++.h>
#define f(i,j,k) for(long long i=j;i<k;i++)
#define f2(i,j,k) for(long long i=j;i>=k;i--)
#define ll long long
using namespace std;
const long long mod=1e9+7;
void chmin(int& a, int b){ if(a > b) a = b; }
void chmax(int& a, int b){ if(a < b) a = b; }

int main(){
    ll n;
    cin>>n;
    ll x,c;
    map<ll, vector<ll>> num;
    f(i,0,n){
        cin>>x>>c;
        num[c].push_back(x);
    }
    vector<pair<ll,ll>> pairs;
    pairs.emplace_back(0,0);
    for(auto &[k, v]:num){
        sort(v.begin(),v.end());
        pairs.emplace_back(v[0],v.back());
    }
    pairs.emplace_back(0,0);
    ll dp_size=pairs.size();
    vector<vector<ll>> dp(dp_size,vector<ll>(2));
    dp[0][0]=0,dp[0][1]=0;
    f(i,1,dp_size){
        ll distance=pairs[i].second-pairs[i].first;
        ll now_left=pairs[i].first,now_right=pairs[i].second;
        ll pre_left=pairs[i-1].first,pre_right=pairs[i-1].second;
        ll left_sum=dp[i-1][0],right_sum=dp[i-1][1];
        dp[i][0]=min(left_sum+abs(now_right-pre_left),right_sum+abs(now_right-pre_right))+distance;
        dp[i][1]=min(left_sum+abs(now_left-pre_left),right_sum+abs(now_left-pre_right))+distance;

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

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

ll n,ans=0;
set<pair<ll,ll>> e,o;
pair<ll,ll> w,x,y,z;

int main(){
	cin>>n;
	ll a[n],b[n];
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++){
		if(i%2==0)e.insert({a[i]-b[i],i});
		else o.insert({a[i]-b[i],i});
	}
	for(int i=0;i<n/2;i++){
		w=*begin(e),x=*begin(o),y=*rbegin(e),z=*rbegin(o);
		if(-w.first-x.first>=y.first+z.first){ans+=b[w.second]+b[x.second];e.erase(w);o.erase(x);}
		else{ans+=a[y.second]+a[z.second];e.erase(y);o.erase(z);}
	}
	cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b;
  cin >> a >> b;
  REP(x,-333,333) {
    REP(y,-333,333) {
      if(x+y==a&&x-y==b) {
        pr(x,y);
        return;
      }
    }
  }
}

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

#include <bits/stdc++.h>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    auto x = (a + b) / 2;
    auto y = a - x;

    cout << x << " " << y << endl;
}


//abc192 a

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

int main() {
    int X;
    cin >> X;
    for(int i=1 ; i<=100 ; i++){
        int current_coin = X + i;
        if(current_coin % 100 == 0){
            cout << i << endl;
        }
    }
}

#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int n;
    cin>>n;
    if(n==1 )
    {
        cout<<0;
        return 0;
    }
    if(n==2)
    {
        cout<<1;
        return 0;
    }

    int l=1;
    int r=n-1;
    int count=0;
    while(l+r==n && r>0 && l>0)
    {
        l++;
        r--;
        count++;
    }
    cout<<count;
}


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

#include <iostream>
#include <cassert>

template<long long mod>
class modint{
private:
  using T = long long;
  T a;
public:
  constexpr modint(const long long x = 0) noexcept : a((x%mod+mod)%mod) {}
  constexpr T& value() noexcept { return a; }
  constexpr const T& value() const noexcept { return a; }
  constexpr modint operator-() const noexcept {
    return modint(0) -= *this;
  }
  constexpr modint operator+(const modint& rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint& rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint& rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint& rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint& rhs) noexcept {
    a += rhs.a;
    if(a >= mod) a -= mod;
    return *this;
  }
  constexpr modint &operator-=(const modint& rhs) noexcept {
    if(a < rhs.a) a += mod;
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint& rhs) noexcept {
    a = a*rhs.a%mod;
    return *this;
  }
  constexpr modint& operator/=(const modint& rhs) noexcept {
    return *this *= rhs.inv();
  }
  constexpr bool operator==(const modint& rhs) const noexcept {
    return a == rhs.a;
  }
  constexpr bool operator!=(const modint& rhs) const noexcept {
    return not (*this == rhs);
  }
  constexpr modint pow(long long k) const noexcept {
    modint ret(1);
    modint x = k > 0 ? *this : this->inv();
    k = abs(k);
    while(k > 0){
      if(k&1) ret *= x;
      x *= x;
      k >>= 1;
    }
    return ret;
  }
  constexpr modint inv() const noexcept {
    return pow(mod-2);
  }
  friend std::ostream& operator<<(std::ostream &os, const modint &X) noexcept {
    return os << X.a;
  }
  friend std::istream& operator>>(std::istream &is, modint &X) noexcept {
    is >> X.a;
    X.a %= mod;
    if(X.a < 0) X.a += mod;
    return is;
  }
};

int main(){
  using mint = modint<998244353>;
  int n;

  cin >> n;
  vector<long long> A(n);
  for(int i = 0; i < n; ++i)
    cin >> A[i];
  sort(A.begin(),A.end());
  mint t = 0;
  for(int i = n-1; i >= 0; --i){
    t *= 2;
    t += A[i];
  }
  mint ans = 0;
  for(auto a : A){
    t -= a;
    t /= 2;
    ans += t*a + a*a;
  }
  cout << ans << endl;
}

#define IOS ios::sync_with_stdio(false);
#define rep(i, a, n) for(ll i=a;i<=n;i++)

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double lb;
#define put(x) cout<< x << "\n"
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
ll n, m, t, k, l, r, ans, cnt, sum, flag;
double arr[N];

int main() {
    IOS;
    cin >> n;
    arr[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        arr[i] = arr[i + 1] + (1.0 * n / (n - i));
    }
    printf("%.6f\n", arr[0]-1);
    return 0;
}


#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int>
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size()
#define PI 3.14159265358979323846

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set;

 const int N=3e5+10;

 const int INF=1e18;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};

int po(int a, int b) {
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res%mod * a%mod) % mod;
		a =(a%mod*a%mod) % mod;
		b >>= 1;
	}
	 return res;
  }

int n;

void solve() {
 cin>>n;
 vi a(n,0);
 rep(i,0,n) cin>>a[i];
 sort(all(a));

 int sum=0;
 for(int i=n-1;i>=0;i--) {
		  sum+=(i*a[i]-(n-i-1)*a[i]);
		}
		cout<<sum<<endl;

}

int32_t main() {
	cool;
	int t=1;
	//~ freopen("input.txt","r",stdin);
	//~ freopen("output.txt","w",stdout);

	//cin>>t;
	while(t--)
	  solve();

  return 0;
}

//Water Heater

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

signed main (){
    int n,w;cin>>n>>w;
    vector<int>s(n),t(n),p(n);
    rep(i,0,n)cin>>s[i]>>t[i]>>p[i];
    vector<int>c(200001,0);
    rep(i,0,n){
        c[s[i]]+=p[i];
        c[t[i]]-=p[i];
    }
    int sum=0;
    rep(i,0,200001){
        sum+=c[i];
        if(sum>w){
            cout<<"No"<<nnn;
            return 0;
        }
    }
    cout<<"Yes"<<nnn;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(pow(2, n));
    for (int i = 0; i < pow(2, n); i++) {
        cin >> a.at(i);
    }
    vector<int> b;
    b = a;
    vector<int> copy;
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < a.size() / 2; j++) {
            if (a.at(j * 2) > a.at(j * 2 + 1)) {
                copy.push_back(a.at(j * 2));
            }
            if (a.at(j * 2) < a.at(j * 2 + 1)) {
                copy.push_back(a.at(j * 2 + 1));
            }
        }
        a = copy;
        copy = {};
    }
    int ans = min(a.at(0), a.at(1));
    for (int i = 0; i < pow(2, n); i++) {
        if (ans == b.at(i)) {
            cout << i + 1 << endl;
            break;
        }
    }
    return 0;
}

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

int winner(int i0, int k, int n, vector<int> &a){
    if(k==0) return i0;
    int w1 = winner(i0, k-1, n, a);
    int w2 = winner(i0+pow(2,k-1), k-1, n, a);
    //int w = a[w1]>a[w2]? w1 : w2;
    //cout << a[w1] << " " << a[w2] <<  " " << w << endl;
    if(k==n) return a[w1]>a[w2]? w2 : w1;
    return a[w1]>a[w2]? w1 : w2;
}

int main(){
    int n;
    cin >> n;
    int size = pow(2,n);
    vector<int> a(size);
    rep(i,size) cin >> a[i];
    cout << winner( 0, n, n, a)+1 << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
// clang-format off
using ll = int64_t;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& a : v) cin >> a;
    return is;
}
template <class T>
istream& operator>>(istream& is, vector<pair<T, T>>& v) {
    for (auto& a : v) cin >> a.first >> a.second;
    return is;
}
template <class T>
istream& operator>>(istream& is, vector<tuple<T, T, T>>& v) {
    for (auto& a : v) {
        T a1, a2, a3;
        cin >> a1 >> a2 >> a3;
        a = {a1, a2, a3};
    }
    return is;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
    for (auto& a : v) os << a << " ";
    os << endl;
    return os;
}
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true; }
    return false;
}
#define all(v) begin(v), end(v)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using veci = vector<int>;
using vecll = vector<ll>;
using Pi = pair<int, int>;
using Pll = pair<ll, ll>;
using Ti = tuple<int, int, int>;
// clang-format on
// cout << std::fixed << std::setprecision(15);

bool isd7(int d) {
    while (d > 0) {
        if (d % 10 == 7) return false;
        d /= 10;
    }
    return true;
}

int isd8(int d) {
    while (d > 0) {
        if (d % 8 == 7) return false;
        d /= 8;
    }
    return true;
}

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (isd7(i) && isd8(i)) ans++;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

bool f(int n){
  string s = to_string(n);
  for(auto c : s){
    if(c == '7') return false;
  }
  while(n != 0){
    int now = n % 8;
    if(now == 7) return false;
    n /= 8;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  n++;
  int ans = 0;
  rep2(i, 1, n){
    if(f(i) == true) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())
#define INT(...) int __VA_ARGS__; IN(__VA_ARGS__);
#define LL(...) ll __VA_ARGS__; IN(__VA_ARGS__);
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__);
#define CHR(...) char __VA_ARGS__; IN(__VA_ARGS__);
#define LD(...) ld __VA_ARGS__; IN(__VA_ARGS__);

/* const ll mod = 1e9 + 7; */
const ll mod = 998244353;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;

template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

void IN() {}

template <class Head, class... Tail>
void IN(Head &head, Tail &... tail) {
  cin >> head;
  IN(tail...);
}

class mint {
  private:
    ll x;

  public:
    constexpr mint(const ll x = 0) noexcept : x((x % mod + mod) % mod) {}
    constexpr ll value() noexcept { return x; }
    constexpr mint operator += (const mint right) noexcept {
      if ((x += right.x) >= mod) x -= mod;
      return *this;
    }
    constexpr mint operator -= (const mint right) noexcept {
      if ((x += mod - right.x) >= mod) x -= mod;
      return *this;
    }
    constexpr mint operator *= (const mint right) noexcept {
      x = x * right.x % mod;
      return *this;
    }
    constexpr mint operator /= (const mint right) noexcept {
      return *this *= right.inv();
    }
    constexpr mint operator + (const mint right) const noexcept {
      return mint(*this) += right;
    }
    constexpr mint operator - (const mint right) const noexcept {
      return mint(*this) -= right;
    }
    constexpr mint operator / (const mint right) const noexcept {
      return mint(*this) /= right;
    }
    constexpr mint operator * (const mint right) const noexcept {
      return mint(*this) *= right;
    }
    constexpr mint inv() const {
      return pow(mod-2);
    }
    constexpr mint pow(ll n) const {
      if (n == 0) return 1;
      mint a = pow(n>>1);
      a *= a;
      if (n & 1) a *= *this;
      return a;
    }
};

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

  LL(a, b, c);

  mint aa = (a * (a + 1)) / 2;
  mint bb = (b * (b + 1)) / 2;
  mint cc = (c * (c + 1)) / 2;

  cout << (aa * bb * cc).value() << endl;

}

#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;

template <typename T>
inline T read() {
    T x = 0, f = 1; char c = getchar();
    while (!isdigit(c)) { if (c == '-') f = - f; c = getchar(); }
    while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
    return x * f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read <int> ()
#define readlint read <lint> ()
const int inf = 1e9 + 1e7, Mod = 998244353, Inv = 499122177;
const lint INF = 1e18 + 1e9;

lint Ans = 1ll;

lint Solve(lint x) { return (x + 1ll) * x % Mod * Inv % Mod; }

int main(void) {

    for (int i = 1; i <= 3; i ++) (Ans *= Solve(readlint)) %= Mod;
    printf("%lld\n", Ans);

    return 0;
}


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

#define f(i,n)			for(int i=0;i<n;i++)
#define fs(i,s,n)		for(int i=s;i<n;i++)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353;
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define PI              3.1415926535897932384626

mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int inv(int a) {
    int r = 1, t = a, k = MOD - 2;
    while (k) {
        if (k & 1) r = (long long) r * t % MOD;
        t = (long long) t * t % MOD;
        k >>= 1;
    }
    return r;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void sm25official()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main(){
    sm25official();
    string s;
    cin>>s;

    if(s[0]==s[1] && s[1]==s[2]) cout<<"Won"<<endl;
    else cout<<"Lost"<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll INFL = (1ll << 60);
//cout << setprecision(20) <<

int main() {
    ll n; cin >> n;
    ll pn = pow(2, n);
    vector<P> a(pn);
    for (int i = 0; i < pn; i++) {
        ll _a; cin >> _a;
        a[i] = P(i + 1, _a);
    }

    vector<P> next;
    vector<P> prev = a;
    while (prev.size() != 2) {
        for (int i = 0; i < prev.size(); i+=2) {
            P target = prev[i];
            if (prev[i].second < prev[i + 1].second) target = prev[i + 1];
            next.push_back(target);
            getchar();
        }
        prev = next;
        next = vector<P>();
    }
    if (prev[0].second < prev[1].second) {
        cout << prev[0].first << endl;
    }
    else {
        cout << prev[1].first << endl;
    }
}


//Author:RingweEH
#include <cstdio>
#include <algorithm>
#include <cstring>
#define ll long long
#define db double
using namespace std;
int min( int a,int b ) { return (a<b) ? a : b; }
int max( int a,int b ) { return (a>b) ? a : b; }
void bmin( int &a,int b ) { a=(a<b) ? a : b; }
void bmax( int &a,int b ) { a=(a>b) ? a : b; }
int read()
{
	int x=0,w=1; char ch=getchar();
	while ( ch>'9' || ch<'0' ) { if ( ch=='-' ) w=-1; ch=getchar(); }
	while ( ch<='9' && ch>='0' ) { x=x*10+ch-'0'; ch=getchar(); }
	return x*w;
}

int n,k;
int calc( int x )
{
	int res=0;
	for ( ; x; x-=((x)&(-x)) ) res++;
	return res;
}

int main()
{
//freopen( "exam.in","r",stdin );

	n=read(); int cnt=1<<n;
	printf( "%d\n",cnt-1 );
	for ( int i=1; i<cnt; i++ )
	{
		for ( int j=0; j<cnt; j++ )
			if ( calc(i&j)&1 ) printf( "B" );
			else printf( "A" );
		printf( "\n" );
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T1, class T2> inline bool chmin(T1 &a, const T2 &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T> void verr(const set<T> &st) { repa(a, st) cerr << a << " "; cerr << endl; }
template <class S, class T> void verr(const map<S, T> &mp) { repa(a, mp) cerr << "{" << a.first << ", " << a.second << "} "; cerr << endl; }
template <class S, class T, class N> void verr(const vector<pair<S,T>>& a, const N& n) { rep(i, n) cerr << "{" << a[i].first << ", " << a[i].second << "} "; cerr << endl; }
template <class T, class N> void verr(const vector<T>& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << endl; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << endl; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
// Binary Indexed Tree (Fenwick Tree)
template <typename T>
struct BIT {
    ll n;
    vector<T> d;
    BIT(ll n = 0) : n(n), d(n + 1) {}
    void add(ll i, T x = 1) {
        for (i++; i <= n; i += i & -i) {
            d[i] += x;
        }
    }
    T sum(ll i) {
        T x = 0;
        for (i++; i; i -= i & -i) {
            x += d[i];
        }
        return x;
    }
};

int main() {
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0;
    BIT<ll> bt(N);
    rep(i, N){
        bt.add(A[i]);
        ans += bt.sum(N - 1) - bt.sum(A[i]);
    }

    cout << ans << '\n';
    rep(i, N - 1){
        ans += N - 1 - A[i] * 2;
        cout << ans << '\n';
    }
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class A> ostream& operator<<(ostream &cout, vector<A> const &v) {cout << "["; for(int i = 0; i < (int)v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";};
template<class A, class B> ostream& operator<<(ostream &cout, const pair<A,B> &x) {return cout << "(" <<x.first << ", " << x.second << ")";};
template<class T> void pv(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;}cerr << "]\n";}
void _print() {cerr << "]\n";}
template<class T, class... V> void _print(T t, V... v) {cerr << t; if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "[" << #x << "] = [", _print(x)
#define fi first
#define se second
#define SZ(x) (int)((x).size())
#define pii pair<int,int>
#define uid(x,y) uniform_int_distribution<int>(x,y)(rng)
vector<array<int,2>> qu[25];
vector<int> msk[25];
ll dp[25][1<<20];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    for (int q = 0; q < m; q++) {
        int x,y,z;
        cin >> x >> y >> z;
        y--;
        qu[x].push_back({y,z});
    }
    for (int q = 1; q < (1<<20); q++) msk[__builtin_popcount(q)].push_back(q);
    dp[0][0] = 1;
    for (int q = 1; q <= n; q++) {
        for (int w : msk[q]) {
            bool ok = true;
            for (array<int,2> a : qu[q]) {
                int y = (1<<(a[0]+1))-1;
                if (__builtin_popcount(y&w) > a[1]) ok = false;
            }
            if (ok) {
                for (int e = 0; e < n; e++) {
                    if ((w>>e)&1) dp[q][w] += dp[q-1][w^(1<<e)];
                }
            }
        }
    }
    cout << dp[n][(1<<n)-1] << '\n';
    return 0;
}

#include<fstream>
#include<iostream>
#include<sstream>
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<tuple>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<set>
#include<array>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using graph = vector<vector<long long>>;
const long long MOD = 1000000007;
const long long INF = 1e18;
using ll = long long;
using P = pair<int,int>;

void chmin(int &x,int y){ x = min(x,y); }

int digit(ll x){
  int count = 1;
  while(x/10>0){
    count ++;
    x /= 10;
  }
  return count;
}

bool prime(ll x){
  if(x==1) return false;
  for(ll i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}

void decom(ll x,map<ll,int> &hatano){
  for(ll i=2;i*i<=x;i++){
    if(x%i==0&&prime(i)){
      while(x%i==0){
      x /= i;
      hatano[i] ++;
    }
    }
  }
  if(x!=1) hatano[x] ++;
}

ll speedpow(ll x,ll y){
  ll res = 1;
  ll test = x;
  for(int i=0;i<31;i++){
    if(y&(1<<i)) res *= test;
    res = res%MOD;
    test = (test*test)%MOD;
  }
  return res;
}

ll combination(ll x,ll y){
  ll test = 1;
  ll test1 = 1;
  for(ll i=0;i<y;i++){
    test = (test*(x-i))%MOD;
    test1 = (test1*(i+1LL))%MOD;
  }
  return (test * speedpow(test1,MOD-2))%MOD ;
}

int euclid(int x,int y){
  if(y==0) return x;
  return euclid(y,x%y);
}

int main(){
    int n,m;cin >> n >> m;
    int x[m],y[m],z[m];
    rep(i,m) cin >> x[i] >> y[i] >> z[i];

    ll k = (1LL<<n);

    vector<ll> dp(k,0);

    dp[0] = 1;

    for(ll bit=0;bit<k;bit++){
      rep(j,n){
        if(bit&(1LL<<j)) continue;
        bool ara = true;
        ll test = (bit|(1LL<<j));
        rep(l,m){
            int p = __builtin_popcount(test);
            if(x[l]!=p) continue;
            int count = 0;
            rep(m,n){
              if((test&(1LL<<m))&&(m+1<=y[l])) count ++;
            //  if(j+1<=y[l]) count ++;
            }
            if(count>z[l]) ara = false;
          //  cout << p << " " << x[l] << " " << bit <<endl;
        }
        if(ara) dp[bit|(1LL<<j)] += dp[bit];

      }
    }

//cout << pow(2,18)*18*100 << endl;
cout << dp[k-1] << endl;

}


#include<iostream>
using namespace std;
int main()
{
	int v,t,s,d,s1,s2;
	cin>>v>>t>>s>>d;
	s1=t*v;
	s2=v*s;

	if(d>=s1&&d<=s2)
		cout<<"No";
	else
		cout<<"Yes";

 return 0;
}

#include <iostream>
using namespace std;

int main()
{
  int a[4];
  char flag = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3];

  int sum = 0;
  for (int i = 0; i < 4; i++) {
    sum += a[i];
  }

  bool find = false;
  if (sum % 2 == 0)
  {
    for (int i = 0; i < 8; i++)
    {
      int sub = a[3];
      if ((i & (1 << 0)) != 0)
        sub += a[0];
      if ((i & (1 << 1)) != 0)
        sub += a[1];
      if ((i & (1 << 2)) != 0)
        sub += a[2];
      if (sub * 2 == sum)
        find = true;
      if (find)break;
    }
  }

  if (find)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }

  return 0;
}


#include <bits/stdc++.h>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using vi = vector<int>;
using si = set<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
template<typename T> using minpq = priority_queue <T,vector<T>,greater<T>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
#define V vector
#define P pair<int,int>
#define PLL pair<ll,ll>
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
#define rev(i,s,n) for(int i=(s);i>=(int)(n);i--)
#define reciv(v,n) vi (v)((n)); rep(i,0,(n))cin>>v[i]
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ci(x) cin >> x
#define cii(x) ll x;cin >> x
#define cci(x,y) ll x,y;cin >> x >> y
#define co(x) cout << x << endl
#define pb push_back
#define eb emplace_back
#define rz resize
#define pu push
#define sz(x) int(x.size())
#define vij v[i][j]
// ll p = 1e9+7;
// ll p = 998244353;
#define yn cout<<"Yes"<<endl;else cout<<"No"<<endl
#define YN cout<<"YES"<<endl;else cout<<"NO"<<endl
template<class T>void chmax(T &x,T y){x=max(x,y);}
template<class T>void chmin(T &x,T y){x=min(x,y);}

ll g(ll n, int now){
  ss s=to_string(n);

  if(now==0)sort(all(s));
  else sort(rall(s));

  ll x=stoll(s);
  return x;
}

ll f(ll n){
  return g(n,1)-g(n,0);
}

int main(){
  cci(n,k);
  while(k--)n=f(n);

  co(n);
}

#include<stdio.h>
#include<bits/stdc++.h>
#include<math.h>
#include<stdlib.h>
#include<stdbool.h>
#include<vector>
#define ll long long
#define pb push_back
#define inp(x) scanf("%d",&x);
#define input(x) scanf("%lld",&x);
#define tc int t;scanf("%d",&t);while(t--)
using namespace std;

//Functions

int MaxNum(int num)
{

    int count[10] = {0};

    string str = to_string(num);

    for (int i=0; i<str.length(); i++)
        count[str[i]-'0']++;
    int result = 0, multiplier = 1;
    for (int i = 0; i <= 9; i++)
    {
        while (count[i] > 0)
        {
            result = result + (i * multiplier);
            count[i]--;
            multiplier = multiplier * 10;
        }
    }
    return result;
}
int MinNum(int num)
{

    int count[10] = {0};

    string str = to_string(num);

    for (int i=0; i<str.length(); i++)
        count[str[i]-'0']++;
    int result = 0, multiplier = 1;
    for (int i = 9; i >= 0; i--)
    {
        while (count[i] > 0)
        {
            result = result + (i * multiplier);
            count[i]--;
            multiplier = multiplier * 10;
        }
    }
    return result;
}

int main()
{
    int n,k;
    cin >> n >>k;
    int temp = n;
    while(k--)
    {
        temp = MaxNum(temp) - MinNum(temp);
        if(temp == 0) break;
    }
    cout << temp;

}


/*ver 7*/
#include <bits/stdc++.h>
using namespace std;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using pll = pair<ll,ll>;
using mll = map<ll,ll>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
#define each(x,v) for(auto& x : v)
#define reps(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
const ll INF = 1LL << 60;
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<=b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){}
template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
template <typename T> void in1(T &s) {rep(i,s.size()){in(s[i]);}}
template <typename T> void in2(T &s,T &t) {rep(i,s.size()){in(s[i],t[i]);}}
template <typename T> void in3(T &s,T &t,T &u) {rep(i,s.size()){in(s[i],t[i],u[i]);}}
template <typename T> void in4(T &s,T &t,T &u,T &v) {rep(i,s.size()){in(s[i],t[i],u[i],v[i]);}}
template <typename T> void in5(T &s,T &t,T &u,T &v,T &w) {rep(i,s.size()){in(s[i],t[i],u[i],v[i],w[i]);}}
void out(){cout << endl;}
template <typename T,class... U> void out(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; out(u...);}
void die(){cout << endl;exit(0);}
template <typename T,class... U> void die(const T &t,const U &...u){cout << t; if(sizeof...(u)) cout << " "; die(u...);}
template <typename T> void outv(T s) {rep(i,s.size()){if(i!=0)cout<<" ";cout<<s[i];}cout<<endl;}
template <typename T> void out1(T s) {rep(i,s.size()){out(s[i]);}}
template <typename T> void out2(T s,T t) {rep(i,s.size()){out(s[i],t[i]);}}
template <typename T> void out3(T s,T t,T u) {rep(i,s.size()){out(s[i],t[i],u[i]);}}
template <typename T> void out4(T s,T t,T u,T v) {rep(i,s.size()){out(s[i],t[i],u[i],v[i]);}}
template <typename T> void out5(T s,T t,T u,T v,T w) {rep(i,s.size()){out(s[i],t[i],u[i],v[i],w[i]);}}
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
template <typename T> T allSum(vector<T> a){T ans=T();each(it,a)ans+=it;return ans;}
ll ceilDiv(ll a,ll b) {return (a+b-1)/b;}
ld dist(pair<ld,ld> a, pair<ld,ld> b){return sqrt(abs(a.fi-b.fi)*abs(a.fi-b.fi)+abs(a.se-b.se)*abs(a.se-b.se));} // ２点間の距離
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
#define YES(n) ((n) ? "YES" : "NO"  )
#define Yes(n) ((n) ? "Yes" : "No"  )
#define yes(n) ((n) ? "yes" : "no"  )

int main(){
	init();
    inl(n);
    ll cnt=0;
    reps(i,1,n+1){
        if(2*n<i*i+1){
            //out(i);
            break;
        }
        if((2*n)%i==0){
            if(((2*n)/i+1-i)%2==0)cnt++;
        }
    }
    out(cnt*2);
	return 0;
}

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

int main() {
    ll N; cin >> N;
    vector<vector<ll>> C(N, vector<ll>(N));
    vector<ll> A(N), B(N);
    // (最小値, 最小値が含まれる行数) を表す Pair
    P min_val(INF, 0);
    rep(i, N) rep(j, N) {
        ll val;
        cin >> val;
        if (min_val.first > val) {
            min_val = make_pair(val, i);
        }
        C[i][j] = val;
    }
    bool ok = true;
    A[min_val.second] = min_val.first;
    for (ll i = 0; i < N; i++) {
        B[i] = C[min_val.second][i] - A[min_val.second];
    }
    for (ll i = 0; i < N; i++) {
        A[i] = C[i][0] - B[0];
    }
    rep(i, N) rep(j, N) {
        if (C[i][j] != A[i] + B[j]) ok = false;
        // if (A[i] < 0 || B[j] < 0) ok = false;
    }
    if (ok) {
        cout << "Yes" << endl;
        rep(i, N) cout << A[i] << endl;
        rep(i, N) cout << B[i] << endl;
    }
    else cout << "No" << endl;

    return 0;
}


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

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << "\n";
int N;
vector<int> P, iP;

bool solve(int left, vector<int> &res){
    if(res.size() == N-1){
        rep(i, N){
            if(P[i] != i){
                return false;
            }
        }
        return true;
    }
    if(iP[left] <= left){
        return false;
    }
    for(int j = iP[left]; j > left; j--){
        res.push_back(j);
        swap(P[j], P[j-1]);
    }
    for(int j = left; j < iP[left]; j++){
        if(P[j] != j){
            return false;
        }
    }
    return solve(iP[left], res);
}

int main(){
    cin>>N;

    P.resize(N);
    iP.resize(N);
    rep(i, N){
        cin>>P[i], P[i]--, iP[P[i]] = i;
    }

    vector<int> res;
    if(!(solve(0, res))){
        cout<<-1<<endl;
    }else{
        for(auto r : res){
            cout<<r<<endl;
        }
    }
    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define heap_min priority_queue<int,vector<int>,greater<int>>
#define heap_max priority_queue<int>
#define precision(x) cout << setprecision(x) << fixed;
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " ";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

void solve()
{

  int n;
  cin >> n;
  if(n%2){
    cout << "Black";
  }
  else{
    cout << "White";
  }

}

int32_t main()
{
   fast;
   #ifndef ONLINE_JUDGE
   freopen("goodluckin.txt","r",stdin);
   freopen("goodluckout.txt","w",stdout);
   #endif
   clock_t beg = clock();
   solve();
   clock_t end = clock();
   fprintf(stderr, "Time taken : %.3f sec\n", double(end - beg) / CLOCKS_PER_SEC , 184);
   return 0;

}


#include <iostream>
#include <set>
#include <iterator>
#include <bitset>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
ll mod=1000000007;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        string s;
        for(int i=0;i<3;i++ )
        {
            cin>>s;
        }
        string ans;
        for(int i=0;i<n;i++)
            ans.push_back('0');

        for(int i=0;i<n;i++)
            ans.push_back('1');
            ans.push_back('0');
        cout<<ans<<endl;

    }
    return 0;
}

#pragma GCC optimize ("Ofast")
#pragma GCC optimization ("unroll-loops, no-stack-protector")
#pragma GCC target ("avx")
#pragma GCC target ("avx2")
#pragma GCC target ("fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
	ll n; cin >> n;
	string s1, s2, s3; cin >> s1 >> s2 >> s3;
	string ans; ans.resize(2 * n + 1);
	ans[0] = '1';
	for (ll i = 1; i <= n; i++) ans[i] = '0';
	for (ll i = n + 1; i <= 2 * n; i++) ans[i] = '1';
	cout << ans << "\n";
}
int main(){
	fastio;
	ll t; cin >> t;
	while (t--) solve();
}


#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>

typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef std::pair<ll, ll> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, _s) for (int i = (_s);i < (int)( n ); i++)
#define all(_l) _l.begin(), _l.end()
#define rall(_l) _l.rbegin(), _l.rend()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

# ifdef LOCAL_DEBUG
template<typename T>
void vdeb(const std::vector<T> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        if (i == bb.size() - 1) std::cout << bb[i];
        else std::cout << bb[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(const std::vector<std::vector<T>> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        std::cout << i << ' ';
        vdeb(bb[i]);
    }
    std::cout << '\n';
}
# endif

using namespace std;

void bfs(vector<vector<int>> &da, vector<int> &ans, vector<int> &c,int from) {
    int n = da.size();
    vector<int> used(n, -1);
    queue<Pii> q;
    q.push({from, 0});
    while(!q.empty()) {
        Pii now = q.front(); q.pop();
        if(used[now.first] != -1) {
            continue;
        }
        used[now.first] = now.second;
        rip(i,da[now.first].size(),0) {
            q.push({da[now.first][i], now.second+1});
        }
    }
    rip(i,c.size(),0) ans[i] = used[c[i]];
    return;
}

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> da(n, vector<int>(0));
    rip(i,m,0) {
        int a, b; cin >> a >> b;
        --a;--b;
        da[a].push_back(b);
        da[b].push_back(a);
    }
    int k; cin >> k;
    vector<int> c(k);
    rip(i,k,0) {
        cin>> c[i];
        c[i]--;
    }
    vector<vector<int>> dist(k, vector<int>(k, -1));
    rip(i, k, 0) bfs(da, dist[i], c, c[i]);
    rip(i,k,0) {
        rip(j,k,0) {
            if(dist[i][j] == -1) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    vector<vector<int>> dp(1<<k, vector<int>(k, INT_MAX/2));
    rip(i,k,0) {
        dp[1<<i][i] = 0;
    }
    rip(i,1<<k,0) {
        rip(j,k,0) {
            if((i>>j)&1) {
                rip(l,k,0) {
                    if((i>>l)&1) {
                        chmin(dp[i][j], dp[i^(1<<j)][l] + dist[l][j]);
                    }
                }
            }
        }
    }
    int ans = INT_MAX;
    rip(i,k,0) {
        chmin(ans, dp.back()[i]);
    }
    // vdeb(dp);
    cout << ans+1 << endl;
}

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

#ifdef LOCAL
    #include "debug.h"
    #define input freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
    #define debug(...) 4
    #define input 4
#endif

using ll = long long;
//const int mod = 998244353;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;
struct DSU {
    int par[N];
    int sz[N];
    int find(int x) {
        return x == par[x] ? x : par[x] = find(par[x]);
    } //path compression(logn)

    void merge(int a, int b) {
        a = find(a);
        b = find(b);
        if(a == b) return;
        if(sz[a] < sz[b])
            swap(a, b);

        sz[a] += sz[b];
        par[b] = a;
    }

    void init(int n) {
        for(int i = 0; i <= n; i++)
            par[i] = i, sz[i] = 1;
    }
};
DSU d;
vector<int> g[N];
vector<int> dist[N];
int a[N];
void bfs(vector<int> &dist, int src) {
    queue<int> q;
    q.push(src);
    dist[src] = 0;
    while(q.size()) {
        int at = q.front();
        q.pop();
        for(int j : g[at]) {
            if(dist[j] == -1) {
                dist[j] = dist[at] + 1;
                q.push(j);
            }
        }
    }
}
int dp[1 << 18][18];
int k;
int solve(int mask, int last) {
    if(mask == (1 << k) - 1) {
        return 0;
    }
    if(~dp[mask][last])
        return dp[mask][last];
    int ans = 1e9;
    for(int j = 0; j < k; j++) {
        if(mask & (1 << j))
            continue;
        ans = min(ans, dist[last][a[j]] + solve(mask ^ (1 << j), j));
    }
    return dp[mask][last] = ans;
}
signed main() {
    input;
    cin.tie(nullptr) -> sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while(t--) {
        int n, m;
        cin >> n >> m;
        d.init(n + 1);
        for(int i = 0; i < m; i++) {
            int x, y;
            cin >> x >> y;
            g[x].push_back(y);
            g[y].push_back(x);
            d.merge(x, y);
        }
        cin >> k;
        set<int> s;
        for(int i = 0; i < k; i++) {
            cin >> a[i];
            s.insert(d.find(a[i]));
        }
        if(s.size() > 1) {
            cout << "-1\n";
            return 0;
        }
        for(int i = 0; i < k; i++) {
            vector<int> temp(n + 1, -1);
            bfs(temp, a[i]);
            dist[i] = temp;
        }
        int ans = 1e9;
        for(int i = 0; i < k; i++)  {
            memset(dp, -1, sizeof dp);
            ans = min(ans, solve(1 << i, i));
        }

        cout << ans + 1;

    }
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <algorithm>
#include <set>

using namespace std;

#define rep(i,s,N) for(unsigned int i=s;i<N;i++)
typedef long long int lli;

int main(void)
{
	int N, S, D; cin >> N >> S >> D;
	vector<int> X(N), Y(N);
	rep(i, 0, N)cin >> X[i] >> Y[i];
	string ans = "No";

	rep(i, 0, N) {
		if (X[i]<S && Y[i]>D) {
			ans = "Yes";
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

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

const int INF = 1000000007;
const ll MOD = 1000000007;

vector<pii> graph[301];

int dist[301];
bool seen[301];

void dijkstra(int src)
{
    for(int i=0; i<300; i++)
    {
        dist[i] = INF;
    }
    dist[src] = 0;
    priority_queue<pair<int, int>> pq;
    pq.push({0, src});
    while(!pq.empty())
    {
        int u = pq.top().s;
        pq.pop();
        for(int i=0; i<graph[u].size(); i++)
        {
            int v = graph[u][i].f;
            int w = graph[u][i].s;
            if(dist[v] > dist[u] + w)
            {
                dist[v] = dist[u] + w;
                if(!seen[v])
                    pq.push({-dist[v], v});
            }
        }
    }
}

void solve_test()
{
    int a, b, x, y;
    cin >> a >> b >> x >> y;
    for(int i=1; i<=100; i++)
    {
        graph[i].PB({i+100, x});
        graph[i+100].PB({i, x});
        if(i<100)
        {
            graph[i+1].PB({i, y});
            graph[i].PB({i+1, y});
            graph[i+101].PB({i+100, y});
            graph[i+100].PB({i+101, y});
        }
        if(i>1)
        {
            graph[i].PB({i+99, x});
            graph[i+99].PB({i, x});
        }
    }
    dijkstra(a);
    cout << dist[b+100];
}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tests;
    tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve_test();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int A,B,C;
	cin >> A >> B >> C;
	if (A < 0 && C%2 == 0)
	{
		A *= (-1);
	}
	if(B < 0 && C%2 == 0)
	{
		B *= (-1);
	}

	if(A < B)
	{
		cout << "<" << endl;
	}
	else if(A > B)
	{
		cout << ">" << endl;
	}
	else if (A == B)
	{
		cout << "=" << endl;
	}
	return 0;
}

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

int main() {
    ll A, B, C;
    cin >> A >> B >> C;
    char ans;
    if(C % 2 == 0) {
        A = abs(A);
        B = abs(B);
    }
    if(A == B) ans = '=';
    else if(A > B) ans = '>';
    else if(A < B) ans = '<';
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

void dfs(int v, int other, vector<vector<pair<int, int>>>& Graph, vector<bool> &seen, vector<int> &color, int N) {
	if (v == 0) {
		if (Graph[v].size() > 0) color[0] = Graph[v][0].second;
	}
	else if (color[v] == -1) {
		color[v] = (other + 1) % N;
	}
	for (int i = 0; i < Graph[v].size(); i++) {
		if (seen[Graph[v][i].first]) continue;
		if (Graph[v][i].second == color[v]) {
			seen[Graph[v][i].first] = true;
			dfs(Graph[v][i].first, Graph[v][i].second, Graph, seen, color, N);
		}
		else {
			seen[Graph[v][i].first] = true;
			color[Graph[v][i].first] = Graph[v][i].second;
			dfs(Graph[v][i].first, N, Graph, seen, color, N);
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<pair<int, int>>> Graph(N);
	for (int i = 0; i < M; i++) {
		int u, v, c;
		cin >> u >> v >> c;
		u--; v--; c--;
		Graph[u].push_back(make_pair(v, c));
		Graph[v].push_back(make_pair(u, c));
	}

	vector<bool> seen(N, false);
	seen[0] = true;
	vector<int> color(N, -1);
	dfs(0, N, Graph, seen, color, N);

	for (int i = 0; i < N; i++) {
		cout << color[i] + 1 << endl;
	}
}

#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

namespace IO {
  char buf[1000000], *p1 = buf, *p2 = buf;
  inline char gc() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
    return p1 == p2 ? EOF : *(p1++);
  }
  template <class T> inline void read(T &n) {
    n = 0; RI ch = gc(), f;
    while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
    f = (ch == '-' ? ch = gc(), -1 : 1);
    while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
    n *= f;
  }
  char Of[105], *O1 = Of, *O2 = Of;
  template <class T> inline void print(T n, char ch = '\n') {
    if (n < 0) putchar('-'), n = -n;
    if (n == 0) putchar('0');
    while (n) *(O1++) = (n % 10) ^ 48, n /= 10;
    while (O1 != O2) putchar(*(--O1));
    putchar(ch);
  }
}

using IO :: read;
using IO :: print;

int const MAXN = 2e5 + 5;
struct Edges { int to, next, val; } e[MAXN << 1];
int vis[MAXN], a[MAXN];
int head[MAXN], tot;
int n, m;

inline void addedge(int from, int to, int val) {
  e[++tot] = (Edges){to, head[from], val};
  head[from] = tot;
  e[++tot] = (Edges){from, head[to], val};
  head[to] = tot;
}

void Dfs(int now) {
  vis[now] = 1;
  for (RI i = head[now]; i; i = e[i].next)
    if (!vis[e[i].to]) {
      if (a[now] == e[i].val)
        a[e[i].to] = n + 1 - e[i].val;
      else
        a[e[i].to] = e[i].val;
      Dfs(e[i].to);
    }
}

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  read(n), read(m);
  for (RI i = 1, x, y, z; i <= m; ++i)
    read(x), read(y), read(z), addedge(x, y, z);
  a[1] = 1;
  Dfs(1);
  for (RI i = 1; i <= n; ++i)
    if (!vis[i])
      return puts("No"), 0;
  for (RI i = 1; i <= n; ++i)
    printf("%d\n", a[i]);

  return 0;
}

// created by Daniel yuan
/*
     ________
    /        \
   / /      \ \
  / /        \ \
  \            /
   \  ______  /
    \________/
*/


#include <cstdio>
#include <algorithm>
const int Maxn=200000;
int n;
std::pair<int,int> a[Maxn<<1|5];
bool col[Maxn<<1|5];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=(n<<1);i++){
		scanf("%d",&a[i].first);
		a[i].second=i;
	}
	std::sort(a+1,a+1+(n<<1));
	for(int i=1;i<=n;i++){
		col[a[i].second]=1;
	}
	int num=0;
	for(int i=1;i<=(n<<1);i++){
		if(col[i]){
			if(num>=0){
				num++;
				putchar('(');
			}
			else{
				num++;
				putchar(')');
			}
		}
		else{
			if(num<=0){
				num--;
				putchar('(');
			}
			else{
				num--;
				putchar(')');
			}
		}
	}
	putchar('\n');
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
ll a[200050];
const int mod =998244353;
ll l[200050];
ll in[200050];
ll sum[200050];

ll pow_mod(ll a, ll n, ll m)
{
    long long ans = 1;
    while(n){
        if(n&1){
            ans = (ans * a) % m;
        }
        a = (a * a) % m;
        n >>= 1;
    }
    return ans;
}
void run()
{
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    ll ans=0ll;
    in[0]=1ll;
    in[1]=1ll;
    sum[0]=0;
    ll x=1;
    for(int i =1;i<=n;i++)
    {
        sum[i]=sum[i-1]+x*a[i]%mod;
        sum[i]%=mod;
        x =x*2;
        x%=mod;
    }
    ll inv = pow_mod(2,mod-2,mod);
    ll y =inv;
     for(int i=1;i<=n;i++)
    {
        ans+= a[i]*(sum[n]-sum[i]+mod)%mod*y%mod;
        ans%=mod;
        y*=inv;
        y%=mod;
    }
    for(int i=1;i<=n;i++)
        ans=(ans+a[i]*a[i]%mod)%mod;
    cout<<ans<<endl;

}
int main()
{

    int t=1;
    while(t--)
        run();
}


#include<iostream>
#include<vector>

int main(){
  int N, K;
  std::cin >> N >> K;
  std::vector<long long> sum(2*N+2,0);

  for(int a=1; a<=N; a++){
    sum[a+1] += 1;
    sum[a+N+1] -= 1;
  }

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

  long long ans = 0;
  if (K < 0) K *= -1;
  for(int i=0; i<2*N+1; i++){
    if (i+K > 2*N) break;
    ans += sum[i] * sum[i + K];
  }
  std::cout << ans << std::endl;
}

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long n;
    cin>>n;
    int k;
    cin>>k;

    for(int i=0;i<k;i++){
        if(n%200==0) n/=200;
        else{
            n*=1000;
            n+=200;
        }
    }
    cout<<n<<endl;
    return 0;
}


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

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

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

	ll N, X;
	cin >> N >> X;
	ll A[100];
	rep(i, N) cin >> A[i];

	ll kotae = 2e18;
	rep1(s, N) {
		ll wari = X / s;
		ll amari = X % s;

		ll dp[101][101] = {};
		rep(i, s + 1) rep(j, s + 1) dp[i][j] = -1;
		dp[0][0] = 0;
		rep(i, N) {
			for (int j = min(i, s); j >= 0; j--) rep(k, s) if(dp[j][k] >= 0) {
				chmax(dp[j + 1][(k + A[i]) % s], dp[j][k] + (k + A[i]) / s);
			}
		}
		if (dp[s][amari] >= 0) {
			chmin(kotae, wari - dp[s][amari]);
		}
	}
	co(kotae);

	Would you please return 0;
}


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

int main(){
    int N;
    std::cin >> N;
    vector<string> S_list(N);
    for(int i= 0; i < N; i++){
        std::cin >> S_list[i];
    }
    vector<long long> t_list(N+1), f_list(N+1);
    t_list[0] = 1;
    f_list[0] = 1;

    for(int i = 0; i < N; i++){
        if(S_list[i] == "OR"){
            t_list[i+1] = 2 * t_list[i] + f_list[i];
            f_list[i+1] = f_list[i];
        }else{
            t_list[i+1] = t_list[i];
            f_list[i+1] = t_list[i] + 2 * f_list[i];
        }
    }

    std::cout << t_list[N];

}

#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define pb         push_back
#define mp         make_pair
#define F          first
#define S          second
#define mod        1000000007
#define all(x)     x.begin(),x.end()
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
#define N 1000005
using namespace std;

ll power(ll x, ll y){ll out = 1;while (y > 0){if (y & 1) out=(out*x);y = y>>1;x = (x*x);}return out;}
ll inverse(ll a){return power(a,mod-2)%mod;}
void comp() {
	ll i,j,k,m,n;
	cin>>n;
	vector<string>v1;
	string s;
	fl(i,n) {
		cin>>s;
		v1.pb(s);
	}
	reverse(v1.begin(),v1.end());
	ll ans = 1;
	fl(i,n) {
		if(v1[i] == "OR") {
			ans += power(2,n-i);
		}
	}
	cout<<ans<<"\n";
}
int32_t main() {
    speedup;
    ll i=0,t;
    t=1;
    //cin>>t;
    while(t--) {
        comp();
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

ll gcd(ll x, ll y) {
    if(y == 0) {
        return x;
    }
    return gcd(y, x%y);
}

// nの約数を昇順に列挙したvectorを返す。計算量はO(√n)
vector<ll> yakusu(ll n) {
    vl res;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) {
            res.pb(i);
            if(i != n/i) {
                res.pb(n/i);
            }
        }
    }
    sort(all(res));
    return res;
}

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

    ll mi = INF;
    map<ll, ll> mp;
    rep(i, n) {
        ll a;
        cin >> a;
        chmin(mi, a);
        vl v = yakusu(a);
        for(ll d : v) {
            mp[d] = gcd(a, mp[d]);
        }
    }

    ll ans = 0;
    for(auto p : mp) {
        if(p.first > mi) {
            break;
        }
        if(p.first == p.second) {
            ans++;
        }
    }

    out(ans);
    re0;
}

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define rep(i,n,m) for(int i=n;i<m;i++)
void solve(){
    priority_queue<int>pq;
    rep(i,0,3){
        int a;
        cin>>a;
       // cout<<a;
        pq.push(a);
    }
    int sum=0;
    sum+=pq.top();
    pq.pop();
    sum+=pq.top();
    cout<<sum<<endl;
    return;

}
int32_t main()
{
    int t;

    t=1;
    while(t--){
        solve();
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int,int> II;
typedef priority_queue<int> pqD;//降順
typedef priority_queue<int,vector<int>,greater<int>> pqU;//昇順
LL MOD=1000000007;
LL MO2=998244353;
LL INF=1000000000000;
#define SP(x) cout<<setprecision(x)
#define RP(i,n) for(i=0;i<n;i++)
#define RPU(i,n,x) for(i=x;i<n+x;i++)
#define RPD(i,n) for(i=n-1;i<=0;i++)
#define RPDU(i,n,x) for(i=n+x-1;i<=x;i++)
int main(void){
    LL n,i,j,ans=0;
    LL a[4];
    RP(i,4)cin>>a[i];
    sort(a,a+4);
    cout<<a[0]<<endl;

}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

/* alias */
using ull = unsigned long long;
using ll = long long;
/* define short */
#define all(obj) (obj).begin(), (obj).end()
#define YESNO(bool) if(bool){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(bool) if(bool){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(bool) if(bool){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

/* REP macro */
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) reps(i, 1, n + 1)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define rrepd(i,n) for(ll i=n;i>=1;i--)

int main() {

    ll N,K,first,second;
    vector<pair<ll, ll>> AB;
    cin>>N>>K;
    rep(i,N){
        cin>>first>>second;
        AB.push_back({first,second});
    }
    sort(all(AB));
    rep(i,N){
        if(K<AB[i].first){
            break;
        }
        K += AB[i].second;
    }
    cout<<K<<endl;
    return 0;
}


#include<iostream>
#include<iomanip>

#include<cmath>
#include<algorithm>
#include<numeric>

#include<vector>
#include<string>
#include<set>
#include<map>
//#include<atcoder/all>

#define fi first
#define se second
#define pb(x) emplace_back(x)

using namespace std;
using ll = long long;
using v_ll = vector <ll>;

bool IS_TEST=false;
ll INF = ll(1e17);

ll max(ll x,ll y){return x>y?x:y;}
ll min(ll x,ll y){return x<y?x:y;}
template<class T> bool chmax(T& x,const T& y){ if (x>=y) return false; x=y; return true;}
template<class T> bool chmin(T& x,const T& y){ if (x<=y) return false; x=y; return true;}
template<class T> void quit(T x){std::cout << x << "\n"; exit(0);}

template<typename T> void vshow(T x){for(auto itr = x.begin();itr!=x.end();itr++){std::cerr << *itr << " ";} std::cerr << "\n";}
template<typename T> void vvshow(T x){for(auto itr = x.begin();itr!=x.end();itr++){vshow(*itr);} std::cerr << "\n";}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N,M;
  cin >> N >> M;
  v_ll X(M,0),Y(M,0),Z(M,0);
  for(ll i=0;i<M;i++) cin >> X[i] >> Y[i] >> Z[i];
  v_ll ans(1LL<<N,0);
  ans[0]=1;
  for(ll i=1;i<(1LL<<N);i++){
    ll c=0,ii=i;

    v_ll cnt(N+1,0);
    for(ll k=1;k<=N;k++){
      cnt[k]=cnt[k-1];
      if (ii&1){c++;cnt[k]++;}
      ii>>=1;
    }
    ll flg = true;
    for(ll j=0;j<M;j++){
      if (c!=Y[j]) continue;
      if (cnt[X[j]]>Z[j])flg = false;
    }
    if (flg){
      ll p=0;
      for(ll j=0;j<N;j++){
        p+=ans[i&(-1-(1LL<<j))];
      }
      ans[i]=p;
    }
  }
  cout << ans[(1LL<<N)-1] <<"\n";
}

#include <iostream>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <bits/stdc++.h>
#include <vector>
#include <array>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
typedef long long ll;

int main() {
  int N, p, t;
  cin >> N;
  ll l[N], r[N], y, z;
  ll ans;
  ans=0;
  for (int i=0; i<N; i++){
    cin >> t >> y >> z;
    if (t==1){
      l[i]=2*y;
      r[i]=2*z;
    }
    if (t==2){
      l[i]=2*y;
      r[i]=2*z-1;
    }
    if (t==3){
      l[i]=2*y+1;
      r[i]=2*z;
    }
    if (t==4){
      l[i]=2*y+1;
      r[i]=2*z-1;
    }
  }
  for (int i=0; i<N-1; i++){
    for (int j=i+1; j<N; j++){
      p=1;
      if (r[i]<l[j]){
        p=0;
      }
      if (r[j]<l[i]){
        p=0;
      }
      ans+=p;
    }
  }
  cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n)             for(ll i=1;i<=n;i++)
#define LOOP(i,n)            for(ll i=0;i<n;i++)
#define loop(a,b)            for(ll i=a;i<=b;i++)
#define sci(n)               scanf("%d",&n)
#define scl(n)               scanf("%lld",&n)
#define scl3(a,b,c)          scanf("%lld%lld%lld",&a,&b,&c);
#define scl2(a,b)            scanf("%lld%lld",&a,&b)
#define scd(n)               scanf("%lf",&n)
#define pf(n)                printf("%lld\n",n)
#define srt(g)               sort(g.begin(),g.end())
#define rvs(g)               reverse(g.begin(),g.end())
#define pl                   pair<long long,long long>
#define pll                  pair<long long,pair<long long,long long>>
#define ll long long
#define pb push_back
#define mp make_pair
#define pi acos(-1.0)
#define f first
#define s second
int main()
{
    ll n,m;
    scl2(n,m);
    vector<ll>a;
    ll x;
    if(m==0)
    {
        cout << "1\n";
        return 0;
    }
    LOOP(i,m)
    {
        scl(x);
        a.pb(x);
    }
    srt(a);
    ll mn=INT_MAX;
    vector<ll>v;
    if(a[0]!=1)
    {
        v.pb(a[0]-1);
        mn=min(mn,a[0]-1);
    }
    for(ll i=0;i<m-1;i++)
    {
        x=a[i+1]-a[i]-1;
        if(x!=0)
        {
            mn=min(mn,x);
            v.pb(x);
        }
    }
    if(a[m-1]!=n)
    {
        v.pb(n-a[m-1]);
        mn=min(mn,n-a[m-1]);
    }
    ll ans=0;
    if(v.size()==0)
    {
        cout << "0\n";
        return 0;
    }
    for(auto x:v)
    {
        //cout << "x" << "\n";
        ll y=x/mn;
        if(x%mn)y++;
        ans=ans+y;
    }
    pf(ans);
}

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

vector<int> seen;
vector<vector<int>> g;
vector<int> a, b;

void dfs(int node, int64_t& sum) {
    seen[node] = 1;
    sum += a[node];
    sum -= b[node];
    for (auto v : g[node])
        if (not seen[v])
            dfs(v, sum);
}

int main() {
    int n, m; cin >> n >> m;
    a = vector<int> (n, 0);
    b = vector<int> (n, 0);

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

    g = vector<vector<int>> (n);

    for (int i = 0; i < m; i += 1) {
        int c, d; cin >> c >> d;
        c -= 1, d -= 1;
        g[c].push_back(d);
        g[d].push_back(c);
    }

    seen = vector<int> (n, 0);

    for (int i = 0; i < n; i += 1) {
        if (not seen[i]) {
            int64_t tot = 0;
            dfs(i, tot);
            if (tot != 0) {
                cout << "No\n";
                return 0;
            }
        }
    }

    cout << "Yes\n";
}