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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(int i=(l);i<int(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(int i=(l);i>=int(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
#pragma endregion

const int MOD = 1000000007;

const int MAX_N = 100010;
int N, Q;
V<> C;

class UnionFind2 {
    public:
        UnionFind2(){}
        // size: Union-Find で扱いたい要素の数
        void Init(int size, const V<>& c) {
            m_Data.resize(size);
            REP(i, size) {
                m_Data[i][c[i]] = 1;
                m_Data[i][-1] = i;
            }
        }

        // x と y の属する集合を併合
        // 既に一緒な集合内にいるなら false を
        // 新たに併合されたなら true を返す
        bool Unite(int x, int y) {
            x = Find(x), y = Find(y);
            if(x == y) { return (false); }
            if(x > y) { swap(x, y); }
            for(auto& p : m_Data[y]) {
                int key = p.first;
                int val = p.second;
                if(key == -1) { continue; }
                m_Data[x][key] += val;
                m_Data[y][key] = 0;
            }
            m_Data[y][-1] = x;
            return (true);
        }

        // 要素 k が属する集合の根を返す
        int Find(int k) {
            //DBG("  Find k: %lld\n", k);
            if(m_Data[k][-1] == k) {
                // k が根
                return (k);
            }
            // k の上をたどる
            int n_k = Find(m_Data[k][-1]);
            m_Data[k][-1] = n_k;
            return n_k;
        }

        // 要素 k と同じ集合のクラス l の要素数を返す
        int Size(int k, int l) {
            int root = Find(k);
            return m_Data[root][l];
        }

    private:
        // 根: 各クラスの要素数
        //     key: クラス val: クラスの数
        // 子: 根の id (key: -1 に入れる)
        vector< map<int, int> > m_Data;
};

signed main() {
    IOS;

    cin >> N >> Q;
    C.resize(N);
    REP(i, N) {
        cin >> C[i];
        C[i]--;
    }
    UnionFind2 uf;
    uf.Init(N, C);
    REP(i, Q) {
        int q, x, y;
        cin >> q >> x >> y;
        x--; y--;
        if(q == 1) {
            uf.Unite(x, y);
        }
        else {
            print(uf.Size(x, y));
        }
    }

    return 0;
}

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

const int N = 2e5 + 5;
int fa[N], n, q, siz[N];
map<int, int> m[N];
int find(int x) {
	if (x == fa[x]) return x;
	return fa[x] = find(fa[x]);
}

void merge(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (m[x].size() > m[y].size()) swap(x, y);
	fa[x] = y;
//	siz[y] += siz[x];
	for (auto p : m[x]) {
		m[y][p.first] += p.second;
	}
}

int main() {
    scanf("%d %d", &n, &q);
    for (int i = 1; i <= n; i++) {
    	int x;
    	scanf("%d", &x);
    	m[i][x] = 1;
    	fa[i] = i;
    }
    for (int i = 1; i <= q; i++) {
    	int op, x, y;
    	scanf("%d %d %d", &op, &x, &y);
    	if (op == 1) {
    		merge(x, y);
    	} else {
    		x = find(x);
    		if (m[x].count(y) == 0) {
    			puts("0");
    			continue;
    		}
    		printf("%d\n", m[x][y]);
    	}
    }
    return 0;
}


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

#define ll int64_t
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nl "\n"

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, n) FOR(i, 0, n)
#define ROF(i, n, a) for(int i = n; i >= a; --i)
#define R0F(i, n) ROF(i, n, 0)
#define trav(x, a) for (auto& x : a)

#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f

// read
template<class T> void read(T &x){cin >> x;}
template<class T, size_t S> void read(array<T, S> &a){trav(x, a) read(x);}
template<class H, class T> void read(pair<H, T> pht){cin >> pht.first >> pht.second;}
template<class T> void read(vector<T> &v){trav(x, v){read(x);}}
template<class H, class... T> void read(H &h, T &...t) { read(h); read(t...); }
// print
string to_string(char c) {return string(1, c);}
string to_string(bool b) {return b?"true":"false";}
string to_string(const char* s) {return string(s);}
string to_string(string s) {return s;}
template<class T> string to_string(T v) {bool f=1; string res;for(auto& x: v){if(!f){res+=' ';}f=0;res+=to_string(x);}return res;}
template<class A> void write(A x) {	cout << to_string(x);}
template<class H, class... T> void write(const H& h, const T&... t) { 	write(h);	write(t...);}
void print() {write("\n");}
template<class H, class... T> void print(const H& h, const T&... t) { write(h);if(sizeof...(t))write(' ');print(t...);}

// Check Limits
const int mxN = 1e5+3;

void solve(){
    int M, H; read(M, H);
    if(H%M==0){
        print("Yes");
    } else{
        print("No");
    }
}

int main(){
    cin.tie(0)->sync_with_stdio(0);
    solve();
}

#include<bits/stdc++.h>
#define int long long
#define rint regester int
const int maxn = 1e6 + 10;
const int INF = 1e9;
using std::ios;
using std::cin;
using std::cout;
using std::max;
using std::min;
using std::sort;
using std::unique;
using std::lower_bound;
using std::swap;
using std::abs;
using std::acos;
using std::queue;
using std::map;
using std::string;
int read(){int x = 0,f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){if(ch == '-')f = -1; ch = getchar();}while(ch >= '0' && ch <= '9'){x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar();} return x * f;}
int n, h;
signed main(){
	n = read(), h = read();
	if(h % n == 0)cout << "Yes\n";else cout << "No\n";
}


#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    long long k;
    long long x,y;
    vector<pair<long long ,long long>> a;

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        a.push_back({x,y});
    }

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

    for(int i=0;i<n;i++){
        if(a[i].first > k) break;
        k += a[i].second;
    }
    cout<<k<<endl;
    return 0;
}

#include <bits/stdc++.h>

#define kyou using
#define mo namespace
#define kawaii std

kyou mo kawaii; // hi honey~

#define ll long long
#define ld long double
#define endl "\n"
const int MX = 200005;
const int LG = (int)log2(MX) + 1;
const int BLOCK = 205;
const int inf = 1000000069;
const ll inf_ll = 8000000000000000069ll;
const ll mod = 1e9 + 7;
const int dxh[] = {1, 1, -1, -1, 2, 2, -2, -2};
const int dyh[] = {2, -2, 2, -2, 1, -1, 1, -1}; // horse
const int dx[] = {0, 1, 0, -1, 0, 0};
const int dy[] = {1, 0, -1, 0, 0, 0}; // adj
const int dz[] = {0, 0, 0, 0, 1, -1}; // 3d
const int dxd[] = {1, 1, 1, 0, -1, -1, -1, 0};
const int dyd[] = {1, 0, -1, -1, -1, 0, 1, 1}; // diag
#define min(x, y) (x < y ? x : y)
#define max(x, y) (x > y ? x : y)

bool untied = 0;
void setIn(string s){freopen(s.c_str(), "r", stdin);}
void setOut(string s){freopen(s.c_str(), "w", stdout);}
void unsyncIO(){cin.tie(0) -> sync_with_stdio(0);}
void setIO(string s = ""){
	if(!untied) unsyncIO(), untied = 1;
	if(s.size()){
		setIn(s + ".in");
		setOut(s + ".out");
	}
}

int n, m;
vector<int> ps[2 * MX + 2];
vector<int> adj[2 * MX + 2];
int dist[2 * MX + 2];
bitset<1000005> vis;

map<pair<int, int>, int> id;
map<int, int> rev;

int main(){
	setIO();

	cin >> n >> m;
  vector<pair<int, int> > thing(m);
	for(int x, y, i = 0; i < m; i ++){
		cin >> thing[i].first >> thing[i].second;
	}
  vector<int> cc;
  for(int i = 0; i < m; i ++){
	cc.push_back(thing[i].second);
	if(thing[i].second > 0) cc.push_back(thing[i].second - 1);
	if(thing[i].second < 2 * n) cc.push_back(thing[i].second + 1);
  }
  cc.push_back(n);
  sort(cc.begin(), cc.end());
  cc.erase(unique(cc.begin(), cc.end()), cc.end());
  for(int i = 0; i < cc.size(); i ++)
    rev[cc[i]] = i;

	ps[rev[n]].push_back(0);
  	for(int x, y, i = 0; i < m; i ++){
		ps[rev[thing[i].second]].push_back(thing[i].first);
	}

	int cnt = 0;
	vector<int> ends;
	for(int i = 0; i < cc.size(); i ++){
		sort(ps[i].begin(), ps[i].end());
		for(int j = 0; j < ps[i].size(); j ++)
			id[{i, ps[i][j]}] = cnt ++;
		if(ps[i].size()) ends.push_back(cnt - 1);
	}

	for(int i = 0; i < cc.size(); i ++){
		for(int j = 0; j < ps[i].size(); j ++){
			// cout << cc[i] << " " << ps[i][j] << endl;
			if(cc[i] > 0 && i > 0 && ps[i - 1].size() && cc[i] == cc[i - 1] + 1){
				int x = lower_bound(ps[i - 1].begin(), ps[i - 1].end(), ps[i][j]) - ps[i - 1].begin();
				if(x != 0){
					x --;
					//assert(ps[i - 1][x] < ps[i][j] && (x + 1 == ps[i - 1].size() || ps[i - 1][x + 1] >= ps[i][j]));
					//cout << cc[i - 1] << " " << ps[i - 1][x] << " " << cc[i] << " " << ps[i][j] << endl;
					adj[id[{i - 1, ps[i - 1][x]}]].push_back(id[{i, ps[i][j]}]);
				}
			}
			if(cc[i] < 2 * n && i + 1 < cc.size() && ps[i + 1].size() && cc[i] == cc[i + 1] - 1){
				int x = lower_bound(ps[i + 1].begin(), ps[i + 1].end(), ps[i][j]) - ps[i + 1].begin();
				if(x != 0){
					x --;
					//assert(ps[i + 1][x] < ps[i][j] && (x + 1 == ps[i + 1].size() || ps[i + 1][x + 1] >= ps[i][j]));
					//cout << cc[i + 1] << " " << ps[i + 1][x] << " " << cc[i] << " " << ps[i][j] << endl;
					adj[id[{i + 1, ps[i + 1][x]}]].push_back(id[{i, ps[i][j]}]);
				}
			}
		}
	}

	queue<int> q;
	int st = id[{rev[n], 0}];
	q.push(st); vis = 0;

	for(; q.size();){
		int nw = q.front(); q.pop();
		if(vis[nw]) continue;
		vis[nw] = 1;

		for(int nx : adj[nw]) q.push(nx);
	}

	int ax = 0;
	for(int i : ends)
		if(vis[i]) ax ++;
	cout << ax << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ss second
#define ff first
#define pb push_back
#define ll long long
using namespace std;
typedef pair<int,int> pii;
const int maxn=2e5+10;

int main(){

    ///freopen("test.txt","r",stdin);

    int n,m;
   scanf("%d %d",&n,&m);
   if(n==1 && m==0){
    printf("1 2\n");
    return 0;
   }
   if(m<0 || m==n || m==n-1){
    printf("-1\n");
    return 0;
   }
   if(n==1 && m!=0){
        printf("-1\n");
        return 0;
   }

   vector<pii>rez;
   for(int i=1;i<n;i++)rez.pb({i*3+1,i*3+3});

   rez.pb({1,rez[m].ff+1});

   for(int i=0;i<rez.size();i++)printf("%d %d\n",rez[i].ff,rez[i].ss);

return 0;
}

//Shrey Dubey

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<list>
#include<iomanip>
#include<queue>
#include<stack>
#include <math.h>
#include<climits>
#include<bitset>
#include<cstring>
#include<numeric>
#include<array>

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

#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define prDouble(x) cout<<fixed<<setprecision(10)<<x //to print decimal numbers
#define pb push_back
#define ff first
#define sec second
#define umap unordered_map
#define mp make_pair
#define KOBE ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fo(n) for(ll i = 0; i<n; i++)
#define fnd(stl, data) find(stl.begin(), stl.end(), data)
#define forn(x,n) for(ll x = 0; x<n; x++)
#define imax INT_MAX
#define lmax LLONG_MAX
#define imin INT_MIN
#define lmin LLONG_MIN
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<ll,ll> >
#define vb vector<bool>
#define pr(t) cout<<t<<"\n"
#define int long long
#define ql queue<ll>
#define qp queue<pair<ll,ll> >
#define endl "\n"
#define nl cout<<"\n"
#define re cin >>
#define pll pair<ll,ll>
#define FOR(a,b) for(ll i = a; i<=b; i++)
#define all(x) x.begin(),x.end()

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

ll mod = 1e9 + 7;

ll cl(ld a){
    if(a>(ll) a){
        return (ll)a+1;
    }
    else{
        return (ll)a;
    }
}

ll flr(ld a){
    if(a < 0.0){
        return (ll) a - 1;
    }
    return (ll) a;
}

//code starts here

const ll M = 2e5+100;
vl gr[M];
ll n,m,x,y;
ll a[M];
ll dp[M];
bool vis[M] = {false};
void dfs(ll cur){
    vis[cur] = true;
    dp[cur] = 0;
    for(auto x: gr[cur]){
        if(!vis[x]){
            dfs(x);
        }
        dp[cur] = max(dp[cur],max(a[x],dp[x]));
    }
}

void solve(){
    re n; re m;
    fo(n) re a[i+1];
    fo(m){
        re x; re y;
        gr[x].pb(y);
    }
    for(ll i = 1; i<=n; i++){
        if(!vis[i]) dfs(i);
    }
    ll ans = -1e15;
    for(ll i = 1; i<=n; i++){
        if(dp[i] != 0){
            ans = max(ans,dp[i]-a[i]);
        }
    }
    pr(ans);
}

int32_t main(){
    KOBE;
    ll t;
    t = 1;
    // re t;
    while(t--) solve();
}

//common errors
// row - n, col - m always and loop var
// see the freq of numbers carefully
// see if there's array overflow
// use map for large inputs

//problem ideas
//check piegonhole wherever possible
//there might be many instances of limited answers like 0,1,2 only
// see suffix and prefix
//don't be obsessed with binary search
// try to find repeating pattern in matrices


//#pragma GCC target("avx")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#pragma region header
using lint = long long;
const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
const long long INF = 1ll << 60;
const int mod = 1000000007;
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define init std::ios::sync_with_stdio(false); std::cin.tie(0);
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return true;
	}
	return false;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return true;
	}
	return false;
}
using namespace std;
#pragma endregion
/*----give me AC!----*/
const lint MOD = 998244353;

int main(void) {
	lint a, b, c; cin >> a >> b >> c;
	lint abc = a * b % MOD * c % MOD;
	c = (1 + c) * c / 2 % MOD;
	b = (1 + b) * b / 2 % MOD;
	b *= c;
	b %= MOD;
	a = (1 + a) * a / 2 % MOD;
	cout << a * b % MOD << endl;

	return 0;
}

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define iint int
#define f(i,a,b)        for(ll i=a;i<b;i++)
#define f0(i,n)         f(i,0,n)
#define fr(i,a,b)       for(ll i=a;i>=b;i--)
#define for1(i,n)       for(ll i=1;i<=n;i++)
#define pb              push_back
#define tc(t)           int t;cin >>t;while(t--)
#define lol             std::ios::sync_with_stdio(false); cin.tie(NULL);
#define endl            "\n"
#define ss              second
#define ff              first
#define ll              long long
#define lld             long double
#define int             long long
#define pii             pair< int,int >
#define pll             pair< ll,ll >
#define sz(a)           a.size()
#define inf             (1000*1000*1000+5)
#define all(a)          a.begin(),a.end()
#define arr(a,n)        int a[n];f0(i, n) cin >> a[i];
#define ini(a,n)        memset(a,n,sizeof(a))
#define printArr(a,n)   f0(i,n) cout<<a[i]<<" ";
#define in              cin>>
#define rr              return 0;
#define vi              vector< int >
#define vs              vector<string>
#define l_b             lower_bound
#define u_b             upper_bound
#define mod             1000000007
#define pi              3.141592653589793238
#define fmap(m)         for(auto it:m)
#define deb(args...)    { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define debarr(arr,a,b) for(int i=(a);i<(b);i++) cout<<(arr[i])<<" ";cout<<endl;
#define long_max        numeric_limits<ll>::max()

vs tokenizer(string str, char ch) {std::istringstream var((str)); vs v; string t; while (getline((var), t, (ch))) {v.pb(t);} return v;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}
int dx[8] = { +1, +1, +1, 0, 0, -1, -1, -1};
int dy[8] = { +1, 0, -1, +1, -1, +1, 0, -1};

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

const int N = 5e5 + 10;

const int m = 998244353;

int power(int a, int b) //a^b korte hobe   (binary exponentiation)
{
    int result = 1;
    while (b)
    {
        if (b & 1)
        {
            result = (a % m * result % m) % m;
            b--;
        }
        else
        {
            a = (a % m * a % m) % m;
            b >>= 1;
        }
    }
    return result % m;
}

int pow_inverse(int n)
{
    return power(n, m - 2) % m;
}

void solve()
{

    int a, b, c;
    cin >> a >> b >> c;
    int ans = 1 ;
    ans = (a % m * (a + 1) % m) % m;
    ans = (ans % m * pow_inverse(2)) % m;

    ans = (ans % m * (b % m * (b + 1) % m) % m) % m;
    ans = (ans % m * pow_inverse(2)) % m;

    ans = (ans % m * (c % m * (c + 1) % m) % m) % m;
    ans = (ans % m * pow_inverse(2)) % m;

    cout << ans << "\n";
}

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

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,q,a[300005],seg[1200005];
void build (int l,int r,int id){
	if (l==r) seg[id]=a[l];
	else {
		int mid=l+(r-l)/2;
		build(l,mid,id*2);
		build (mid+1,r,id*2+1);
		seg[id]=seg[id*2]^seg[id*2+1];
	}
}
void change(int p,int val,int l,int r,int id){
	if (l>p||r<p) return;
	seg[id]^=val;
	if (l==r) {
		return;
	}
	int mid=l+(r-l)/2;
	change(p,val,l,mid,id*2);
	change(p,val,mid+1,r,id*2+1);
}
int get(int l,int r,int curl,int curr,int id){
	if (l>curr||curl>r) return 0;
	if (curl>=l&&curr<=r) return seg[id];
	int mid=curl+(curr-curl)/2;
	return get(l,r,curl,mid,id*2)^get(l,r,mid+1,curr,id*2+1);
}
int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>q;
	for (int i=0;i<n;i++) cin>>a[i];
	build(0,n-1,1);
	for (int i=0;i<q;i++){
		int type;
		cin>>type;
		if (type==1){
			int x,y;
			cin>>x>>y;
			change(x-1,y,0,n-1,1);
			a[x-1]^=y;
		}
		else {
			int x,y;
			cin>>x>>y;
			cout<<get(x-1,y-1,0,n-1,1)<<'\n';
		}
	}
}

#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void print_vector(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

void no(){cout<<-1<<endl; exit(0);}

template <unsigned long long mod > class modint{
public:
    ll x;
    constexpr modint(){x = 0;}
    constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){}
    constexpr modint set_raw(ll _x){
        //_x in [0, mod)
        x = _x;
        return *this;
    }
    constexpr modint operator-(){
        return x == 0 ? 0 : mod - x;
    }
    constexpr modint& operator+=(const modint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr modint operator+(const modint& a) const{
        return modint(*this) += a;
    }
    constexpr modint& operator-=(const modint& a){
        if((x -= a.x) < 0) x += mod;
        return *this;
    }
    constexpr modint operator-(const modint& a) const{
        return modint(*this) -= a;
    }
    constexpr modint& operator*=(const modint& a){
        (x *= a.x)%=mod;
        return *this;
    }
    constexpr modint operator*(const modint& a) const{
        return modint(*this) *= a;
    }
    constexpr modint pow(unsigned long long pw) const{
        modint res(1), comp(*this);
        while(pw){
            if(pw&1) res *= comp;
            comp *= comp;
            pw >>= 1;
        }
        return res;
    }
    //以下、modが素数のときのみ
    constexpr modint inv() const{
        if(x == 2) return (mod + 1) >> 1;
        return modint(*this).pow(mod - 2);
    }
    constexpr modint& operator/=(const modint &a){
        (x *= a.inv().x)%=mod;
        return *this;
    }
    constexpr modint operator/(const modint &a) const{
        return modint(*this) /= a;
    }
};
#define mod2 1000000007
using mint = modint<mod2>;

ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
using vm = vector<mint>;

mint cmb(int n, int m){
    mint res(1);
    rep(i, m)(res *= n - i) /= i + 1;
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>N>>M;
    vec a(N);
    rep(i, N) cin>>a[i];
    ll sum = accumulate(ALL(a), 0);
    cout<<cmb(M + N, sum + N)<<endl;
}


//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

ll dp[18][1 << 18] = {};

int main() {
	ll ans = 0;
	ll tmp = 0;
	int n; cin >> n;
	ll x[n+1], y[n+1], z[n+1];
	REP(i, n) cin >> x[i] >> y[i] >> z[i];
	x[n] = x[0]; y[n] = y[0]; z[n] = z[0];
	int full = 0; REP(i, n) full += 1 << i;
	REP(bit, 1 << (n+1)){
		REP(j, n+1){
			dp[j][bit] = INF;
		}
	}
	dp[0][0] = 0;
	REP1(i, n-1){
		dp[i][1 << (i-1)] =
			dp[0][0] + abs(x[0] - x[i]) + abs(y[0] - y[i]) + max((ll)0, z[i] - z[0])
		;
		//cout << dp[0][0] + abs(x[0] - x[i]) + abs(y[0] - y[i]) + max((ll)0, z[i] - z[0]) << endl;
	}
	//cout << dp[1][1] << endl;
	REP(bit, 1 << (n+1)){
		REP(j, n+1){
			if(!(bit & (1<<(j-1))) ) continue;
			ll cost = dp[j][bit], here = j;
			//cout << cost << " " << here << " " << bitset<18>(bit) << endl;
			REP1(i, n){
				dp[i][bit | (1 << (i-1) )] = min( dp[i][bit | (1 << (i-1))],
					cost + abs(x[here] - x[i]) + abs(y[here] - y[i]) + max((ll)0, z[i] - z[here])
				);
			}
		}
	}
	cout << dp[n][full] << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vt vector
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0; i < n; i++)
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))

// 🚩
// 20210424 21:52:52~
//
void flip(string& S, ll a, ll b)
{
    char temp = S.at(a);
    S.at(a) = S.at(b);
    S.at(b) = temp;
}
string cur(string& S, ll N, bool flipped)
{
    if (!flipped)
        return S.substr(0, N) + S.substr(N, N);
    else
        return S.substr(N, N) + S.substr(0, N);
}
int main()
{
    string S;
    ll N;
    ll Q;

    bool flipped = false;
    {
        cin >> N;
        cin >> S;
        cin >> Q;
    }
    rep(q, Q)
    {
        ll t, a, b;
        cin >> t >> a >> b;
        a--;
        b--;
        if (t == 1)
        {
            if (flipped)
            {
                a += N;
                b += N;
                a %= N * 2;
                b %= N * 2;
                //cout << a << "," << b << endl;
            }

            flip(S, a, b);
        }
        else if (t == 2)
        {
            flipped = !flipped;
        }
        //cout << "  " << cur(S, N, flipped) << endl;
    }
    cout << cur(S, N, flipped) << endl;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}
void solve(long long N){
    if(N%2==0)cout<<"White"<<endl;
    else cout<<"Black"<<endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}

#include <iostream>
using namespace std;

int main() {
	int N;
	cin>>N;
	if (N%2==0){
		cout<<"White";
	}
	else {
		cout<<"Black";
	}

	}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto& x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << '\n'; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

const int INF = 0x3F3F3F3F;
const int MAXN = (int) 1e6;
const int MOD = (int) 1e9+7;

//=========================

void run_test() {
    ll n, m, t;
    read(n, m, t);
    vi a(m), b(m);
    rep(i, m) read(a[i], b[i]);
    a.pb(t); b.pb(t);

    ll cur = n;

    rep(i, m+1) {
        ll dec = a[i] - (i == 0 ? 0 : b[i-1]);
        ll inc = b[i] - a[i];
        cur = max(0LL, cur - dec);
        if(cur == 0) { println("No"); return; }
        cur = min(n, cur + inc);
    }

    println("Yes");
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
int main(void){
    double n,x0,y0,xn2,yn2;
    cin >> n;
    cin >> x0 >> y0;
    cin >> xn2 >> yn2;
    double xm = (x0+xn2)/2.0;
    double ym = (y0+yn2)/2.0;
    double theta = 2*PI/n;
    double x1 = xm + cos(theta)*(x0-xm)+sin(theta)*(-y0+ym);
    double y1 = ym + cos(theta)*(y0-ym)+sin(theta)*(x0-xm);
    printf("%.9f %.9f\n",x1,y1);
}


//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T>>;
const int INF = 0xccccccc;
const ll LINF = 0xcccccccccccccccLL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

//head

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, vi> mp;
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    y -= n;
    mp[x].emplace_back(y);
  }
  map<int, int> dp;
  dp[0] = 1;
  for(auto &[ig, v]:mp) {
    map<int, int> ch;
    for(auto z:v) {
      ch[z] = dp[z+1]|dp[z-1];
    }
    for(auto [z, val]:ch) dp[z] = val;
  }
  int ans = 0;
  for(auto [x, y]:dp) ans += y;
  cout << ans << endl;
}

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

#define int long long
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define all(v) v.begin(), v.end()
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x) \
  int x;     \
  cin >> x;  \
  while (x--)

int32_t main() {

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

    int n,k;
    cin >> n >> k;
    vector<pair<int,int>> v(k);

    for(int i = 0; i < k; ++i)
        cin >> v[i].ff >> v[i].ss;

    sort(all(v));

    set<int> can;
    can.insert(n);

    for(int i = 0; i < k;) {
        vector<int> rem,add;
        int temp = v[i].ff;

        while(i < k && v[i].ff == temp) {
            int l = can.count(v[i].ss - 1);
            int r = can.count(v[i].ss + 1);

            if(l + r == 0)
                rem.push_back(v[i].ss);
            else add.pb(v[i].ss);

            i++;
        }

        for(int j: rem)
            can.erase(j);

        for(int j: add)
            can.insert(j);
    }

    cout << can.size();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define f first
#define s second
void find(int N,vector<int>& a)
{
    int n=(N<<1);
    vector<bool> vis(n,1);
    vector<pi> val(n);
    for(int i=0;i<n;i++)
    val[i]=make_pair(a[i],i);
    sort(val.begin(),val.end());
    for(int i=0;i<N;i++)
    vis[val[i].s]=0;
    int cur=0;
    string res="";
    bool f=0;
    for(int i=0;i<n;i++)
    {
        if(cur==0 or vis[i]==f)
        {
            res.push_back('(');
            f=vis[i];
            ++cur;
        }
        else
        {
            res.push_back(')');
            --cur;
        }
    }
    cout<<res;
}
int32_t main()
{
    int n;
    cin>>n;
    vector<int> a(2*n);
    for(int i=0;i<2*n;i++)
    cin>>a[i];
    find(n,a);
    return 0;
}

#pragma GCC optimize("Ofast")
#if 1
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using ll = int64_t;
using db = double;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define show(x) cerr << #x << " = " << (x) << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo(x) cout<<((x)?"Yes":"No")<<newl;
#define YESNO(x) cout<<((x)?"YES":"NO")<<newl;
#define v(T) vector<T>
#define vv(T) vector<vector<T>>

template<class A, class B> using umap = unordered_map<A, B>;
template<class A> using uset = unordered_set<A>;

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class A, class B> istream& operator>>(istream& i, pair<A, B>& p) {
  return i >> p.first >> p.second;
}
template<class A, class B, class C> istream& operator>>(istream& i, tuple<A, B, C>& t) {
  return i >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
template<class T> ostream& operator<<(ostream& o, const pair<T, T>& v) {
  o << "(" << v.first << "," << v.second << ")";
  return o;
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T> ostream& operator<<(ostream& o, const set<T>& v) {
  for (auto e : v) {
    o << e << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

/*
Aを数の大きさ順で上半分、下半分のグループにわけ
カッコで対応するペアは別グループと組むようにする
*/

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  vpii as(2*N);
  F0R(i, 2*N) {
    cin >> as[i].first;
    as[i].second = i;
  }
  sort(rng(as));
  v(bool) bs(2*N);
  F0R(i, 2 * N) {
    bs[as[i].second] = i < N;
  }
  v(bool) st; // ( のグループ
  F0R(i, 2 * N) {
    if (st.empty() || st.back() == bs[i]) {
      cout << '(';
      st.push_back(bs[i]);
    }
    else {
      cout << ')';
      st.pop_back();
    }
  }
  cout << newl;
}
#endif


#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b) cout<<c;
	else if(b==c) cout<<a;
	else if(a==c) cout<<b;
	else cout<<0;
	return 0;
}

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

int main () {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(min(a,b),min(c,d)) << endl;
}


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

int main(){
  long long n,x,mnh=0,che=0;
  double uqu=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x;
    mnh+=abs(x);
    uqu+=x*x;
    che=max(abs(che),abs(x));
  }
  cout<<fixed<<setprecision(15);
  cout<<mnh<<endl;
  cout<<sqrt(uqu)<<endl;
  cout<<che<<endl;
}

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

using namespace __gnu_pbds;
using namespace std;

// MACROS

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

#define pii pair<int,int>
#define pll pair<ll,ll>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, a, b) for (int i = a; i < b; i++)
#define per(i, n) for (int i = n - 1; i >= 0; i--)
#define per2(i, a, b) for (int i = a; i >= b; i--)
#define FORE(i, l) for (auto i : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) n.begin(), n.end()
#define sz(x) ((int)(x).size())

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

void file_input(string file) { freopen((file+".in").c_str(), "r", stdin); freopen((file+".out").c_str(), "w", stdout); }

const int MOD = 1e9 + 7;
const int MAX = 1e6;

int T, N, K;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(15);
    cin >> N;
    V<ll> nums(N);
    rep(i, N) cin >> nums[i];
    ll man = 0;
    ll euc = 0;
    ll che = 0;
    rep(i, N)
    {
        man += abs(nums[i]);
        euc += abs(nums[i]) * abs(nums[i]);
        che = max(che, abs(nums[i]));
    }
    cout << man << "\n" << sqrt(euc) << "\n" << che << '\n';
}


#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<cstdio>
#include<string>
#include<deque>
#include<cmath>
#include<queue>
#include<set>
#include<map>

using namespace std;

int a, b;
int aBoard[1010];
int bBoard[1010];

int main(void)
{
	scanf("%d%d", &a, &b);

	if (a >= b) {
		for (int i = 0 ; i < a ; i++) {
			aBoard[i] = i + 1;
		}
		int left = a;
		for (int i = 0 ; i < b ; i++) {
			bBoard[i] = left;
			left--;
		}

		while (left > 0) {
			for (int i = 0 ; i < b ; i++) {
				bBoard[i] = bBoard[i] + left;
				left--;
				if (left <= 0)
					break;
			}
		}
	} else {
		for (int i = 0 ; i < b ; i++) {
			bBoard[i] = i + 1;
		}
		int left = b;
		for (int i = 0 ; i < a ; i++) {
			aBoard[i] = left;
			left--;
		}

		while (left > 0) {
			for (int i = 0 ; i < a ; i++) {
				aBoard[i] = aBoard[i] + left;
				left--;
				if (left <= 0)
					break;
			}
		}
	}

	for (int i = 0 ; i < a ; i++) {
		printf("%d ", aBoard[i]);
	}
	for (int i = 0 ; i < b ; i++) {
		printf("%d ", -bBoard[i]);
	}

	printf("\n");

	return 0;
}

#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define bit(x,j) ((x>>j)&1)
using namespace std;
// bitset<8>set1(p);
// __builtin_popcountll(x);
// bitset<100> b("1010");
ll int mod=998244353;
int mul(ll int x, ll int y)
{
    return (x * 1ll * y) % mod;
}

ll int add(ll int x,ll int y)
{
    x += y;
    while(x >= mod) x -= mod;
    while(x < 0) x += mod;
    return x;
}

long long power(long long a, long long b,ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = mul(res,a);
        a = mul(a,a);
        b >>= 1;
    }
    return res%m;
    }

  ll int binomial(ll int n, ll int k)
{
    ll int C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;  // nC0 is 1

    for (ll int i = 1; i <= n; i++)
    {
        // Compute next row of pascal triangle using
        // the previous row
        for (int j = min(i, k); j > 0; j--)
            C[j] = C[j]+C[j-1];
    }
    return C[k];
}
  vector<int> pr;
  bool prime[10000000];
void Sieve(ll int n)
{
    memset(prime, true, sizeof(prime));
    prime[1]=false;

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}

//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}
int sum(int n)
{
    if (n == 0)
    return 0;
    return (n % 10 + sum(n / 10));
}
ll int factori(ll int n,ll int m)
{
    ll int fact = 1;
    for(int i=2;i<=n;i++) {
        fact = (fact * i)%m;
    }
    return fact%m;
}

int reduce(int x, int y)
{
    int d;
    d = __gcd(x, y);

    x = x / d;
    y = y / d;
    return x;
}

int binarySearch(int arr[], int l, int r, int x)
{
    if (r >= l) {
        int mid = l + (r - l) / 2;

        if (arr[mid] == x)
            return mid;

        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);

        // Else the element can only be present
        // in right subarray
        return binarySearch(arr, mid + 1, r, x);
    }

    // We reach here when element is not
    // present in array
    return -1;
}

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

// Function to return LCM of two numbers
long long lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

ll int money_left(ll int money_left,long long int a[],ll int n)
{
    ll int l = 0, r = n;
    while (l < r)
    {
        ll int m = (l + r + 1) / 2;
        if (a[m] <= money_left) l = m; else r = m-1;
    }
    return l;
}
ll int dp[1005][1005];
ll int n,m;
ll int a[1005],b[1005];
ll int fun(int i,int j)
{
    if(i==n || j==m)
    return max(n-i,m-j);
    if(dp[i][j]!=-1)
    return dp[i][j];
    dp[i][j]=1e18;
    if(a[i]==b[j])
    {
        dp[i][j]=min(dp[i][j],fun(i+1,j+1));
    }
    dp[i][j]=min(dp[i][j],1+fun(i+1,j));
    dp[i][j]=min(dp[i][j],1+fun(i,j+1));
    dp[i][j]=min(dp[i][j],1+fun(i+1,j+1));
    return dp[i][j];
}

 int main() {
    ios;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<m;i++)
    cin>>b[i];
    memset(dp,-1,sizeof(dp));
    cout<<fun(0,0)<<endl;
}


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

struct ios
{
    inline char read()
    {
        static const int IN_LEN = 1e6 + 10;
        static char buf[IN_LEN], *s, *t;
        return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)), s == t ? -1 : *s++;
    }
    template <typename _Tp>
    inline ios &operator>>(_Tp &x)
    {
        static char c11, boo;
        for (c11 = read(), boo = 0; !isdigit(c11); c11 = read())
        {
            if (c11 == -1)
                return *this;
            boo |= c11 == '-';
        }
        for (x = 0; isdigit(c11); c11 = read())
            x = x * 10 + (c11 ^ '0');
        boo && (x = -x);
        return *this;
    }
} io;

namespace IO
{
    template <typename T>
    inline void w(T x)
    {
        if (x > 9)
            w(x / 10);
        putchar(x % 10 + 48);
    }
    template <typename T>
    inline void write(T x, char c)
    {
        if (x < 0)
            putchar('-'), x = -x;
        w(x);
        putchar(c);
    }
    template <typename T>
    inline void read(T &x)
    {
        x = 0;
        T f = 1;
        char c = getchar();
        for (; !isdigit(c); c = getchar())
            if (c == '-')
                f = -1;
        for (; isdigit(c); c = getchar())
            x = (x << 1) + (x << 3) + (c ^ 48);
        x *= f;
    }
} // namespace IO

#define int long long
#define x first
#define y second
#define PII pair<int,int>
#define LL long long
#define pb push_back
#define pqp priority_queue<PII,vector<PII>,greater<PII>>
#define pqi priority_queue<int,vector<int>,greater<int>>
#define PSS pair<string,string>
#define in insert
#define line inline
#define sort(s) sort(s.begin(),s.end());
#define reverse(s) reverse(s.begin(),s.end());
#define max_(s) *max_element(s.begin(), s.end())
#define V vector<int>
#define VV vector<V>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

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

void solve()
{
    int v,t,s,d;
    io >> v >> t >> s >> d;
    int x1 = v * t, x2 = s * v;
    if(d >=x1 && d <= x2) puts("No");
    else puts("Yes");
}

signed main()
{
    // IOS
    // int _; cin >> _; while(_ --)
    solve();
}

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

int main() {
    int V,T,S,D;
    cin >> V >> T >> S >> D;
    cout << ((V*T <= D && V*S >= D)?"No":"Yes") << endl;
}


#include<bits/stdc++.h>
using namespace std;
long long arr[200200];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    long long sum = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        long long a, b;
        cin >> a >> b;
        arr[i] = 1ll * 2*a + b;
        sum += a;
    }
    sort(arr, arr+n, greater<long long>());
    for(int i = 0; i < n; i++){
        if(sum < 0){
            cout << i << '\n';
            return 0;
        }
        sum -= arr[i];
    }
    cout << n << '\n';
    return 0;
}

#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(i) ri(__i); fi(i, __i)

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

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef pair<i64, i64> pi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << endl;
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(n);
    vi qs(n);
    i64 fst = 0;
    fi(i, n) {
        ri(a, b);
        fst += a;
        qs[i] = 2 * a + b;
    }
    dbg(fst, qs);
    sort(rall(qs));
    i32 k = 0;
    while (fst >= 0) {
        fst -= qs[k++];
        dbg(k, fst);
    }
    wl(k);

    return 0;
}


/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << "\n"
ll dp[18][1LL<<18] = {};
ll dist[20][20] = {};

void solve(){
    ll N;
    cin >> N;
    ll X[20], Y[20], Z[20];
    rep(i,0,N) cin >> X[i] >> Y[i] >> Z[i];
    rep(i,0,N){
        rep(j,0,(1LL<<N)){
            dp[i][j] = INF;
        }
    }
    rep(i,0,N){
        rep(j,0,N){
            if(i == j){
                dist[i][j] = 0;
            }else{
                dist[i][j] = abs(X[i]-X[j]) + abs(Y[i]-Y[j]) + max(0LL, Z[j]-Z[i]);
            }
        }
    }

    dp[0][1] = 0; //dp[i][j]: 今iにいて訪れたことのある頂点集合がjの時の最短距離
    rep(bit,0,(1LL<<N)){
        rep(i,0,N){
            if(dp[i][bit] == INF) continue;
            rep(j,0,N){
                if((bit>>j) & 1) continue;
                dp[j][bit | (1LL<<j)] = min(dp[j][bit | (1LL<<j)], dp[i][bit] + dist[i][j]);
            }
        }
    }
    ll ans = INF;
    rep(i,0,N){
        ans = min(ans, dp[i][(1LL<<N)-1] + dist[i][0]);
    }
    if(ans == INF){
        print(-1);
    }else{
        print(ans);
    }
}

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

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>

using namespace std;
using ll = int64_t;

struct Point{
	int x;
	int y;
	int z;
};

inline int D(const Point& l, const Point& r)
{
	return abs(r.x - l.x) + abs(r.y - l.y) + max(0, r.z - l.z);
}

int tsp(const vector<vector<int>>& cities, int pos, int visited, vector<vector<int>>& state)
{
	if(visited == ((1 << cities.size()) - 1))
		return cities[pos][0]; // return to starting city

	if(state[pos][visited] != INT_MAX)
		return state[pos][visited];

	for(int i = 0; i < cities.size(); ++i)
	{
		// can't visit ourselves unless we're ending & skip if already visited
		if(i == pos || (visited & (1 << i)))
			continue;

		int distance = cities[pos][i] + tsp(cities, i, visited | (1 << i), state);
		if(distance < state[pos][visited])
			state[pos][visited] = distance;
	}

	return state[pos][visited];
}

int main()
{
	int n;
	cin >> n;
	vector<Point> points(n);
	for (int i = 0; i < n; ++i) {
		cin >> points[i].x >> points[i].y >> points[i].z;
	}

	vector<vector<int>> d(n);
	for (int i = 0; i < n; ++i) {
		d[i].resize(n);
		for (int j = 0; j < n; ++j) {
			d[i][j] = D(points[i], points[j]);
		}
	}

	vector<vector<int>> state(n);
	for (auto& y : state) {
		y = vector<int>((1 << n) - 1, INT_MAX);
	}
	cout << tsp(d, 0, 1, state) << "\n";

	return 0;
	int minPath = INT_MAX;
	vector<int> v(n - 1);
	for (int i = 0; i < v.size(); ++i) {
		v[i] = i + 1;
	}

	do {
		int current = 0;
		int k = 0;

		for (int i = 0; i < v.size(); ++i) {
			current += d[k][v[i]];
			k = v[i];
		}
		current += d[k][0];
		minPath = min(minPath, current);
	} while (next_permutation(v.begin(), v.end()));

	cout << minPath << "\n";

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

template<typename T>
void debug(vector<T> item) {

	for (auto i : item) {
		cout << i << " ";
	}

	cout << endl;
}

int main() {
	int N;

	cin >> N;

	int64_t mn = -(int64_t)1e9;
	int64_t mx = 1e9;

	int64_t sum = 0;
	for (int i = 0; i < N; ++i) {
		int64_t a, b;
		cin >> a >> b;

		if (b == 1) {
			sum += a;
			mn += a;
			mx += a;
		} else if (b == 2) {
			mn = max(a, mn);
			mx = max(a, mx);
		} else {
			mn = min(a, mn);
			mx = min(a, mx);
		}
	}

	int Q;

	cin >> Q;

	for (int i = 0; i < Q; ++i) {
		int64_t q;
		cin >> q;

		q += sum;

		if (mn <= q && q <= mx) {
			cout << q << endl;
		} else if (q < mn) {
			cout << mn << endl;
		} else {
			cout << mx << 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);

	int N;
	cin >> N;

	int A[200000], T[200000], X[200000];
	rep(i, N) {
		cin >> A[i] >> T[i];
	}
	int Q;
	cin >> Q;
	rep(i, Q) cin >> X[i];

	ll L = -1e16, R = 1e16;
	ll ima = 0;
	rep(i, N) {
		if (T[i] == 1) {
			ima += A[i];
		}
		if (T[i] == 2) {
			chmax(L, A[i] - ima);
			chmax(R, L);
		}
		if (T[i] == 3) {
			chmin(R, A[i] - ima);
			chmin(L, R);
		}
	}

	rep(i, Q) {
		ll tmp = X[i];
		chmin(tmp, R);
		chmax(tmp, L);
		co(tmp + ima);
	}

	Would you please return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2ll);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        ll n,k;
        cin>>n>>k;
        vector <ll> c(n,0);
        for(int i=0;i<n;i++){
            int a;
            cin>>a;
            c[a]++;
        }
        ll ans=0ll;
        for(ll i=0;i<n&&k>0;i++){
            if(c[i]<k){
                ans+=i*(k-c[i]);
                k=c[i];
            }
        }
        cout<<ans<<"\n";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(vector<bool>::reference b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
const int MOD = 998244353;
struct Mint {
	int val;
	Mint() { val = 0; }
	Mint(ll x) {
		val = (-MOD <= x && x < MOD) ? x : x % MOD;
		if (val < 0) val += MOD;
	}
	template <typename U>
	explicit operator U() const { return (U)val; }
	friend bool operator==(const Mint& a, const Mint& b) { return a.val == b.val; }
	friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
	friend bool operator<(const Mint& a, const Mint& b) { return a.val < b.val; }
	Mint& operator+=(const Mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	Mint& operator-=(const Mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	Mint& operator*=(const Mint& m) { val = (ll)val * m.val % MOD; return *this; }
	friend Mint modex(Mint a, ll p) {
		assert(p >= 0);
		Mint ans = 1;
		for (; p; p >>= 1, a *= a) if (p & 1) ans *= a;
		return ans;
	}
	Mint& operator/=(const Mint& m) { return *this *= modex(m, MOD - 2); }
	Mint& operator++() { return *this += 1; }
	Mint& operator--() { return *this -= 1; }
	Mint operator++(int) { Mint result(*this); *this += 1; return result; }
	Mint operator--(int) { Mint result(*this); *this -= 1; return result; }
	Mint operator-() const { return Mint(-val); }
	friend Mint operator+(Mint a, const Mint& b) { return a += b; }
	friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
	friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
	friend Mint operator/(Mint a, const Mint& b) { return a /= b; }
	friend ostream& operator<<(ostream& os, const Mint& x) { return os << x.val; }
	friend string to_string(const Mint& b) { return to_string(b.val); }
};
vector<Mint> fac(1, 1), invfac(1, 1);
Mint binom(int n, int k) {
	if (k < 0 || k > n) return 0;
	while (fac.size() <= n) {
		fac.push_back(fac.back() * fac.size());
		invfac.push_back(1 / fac.back());
	}
	return fac[n] * invfac[k] * invfac[n - k];
}
vector<int> pfac; // pfac[i] = largest prime factor of i (pfac[i <= 1] = 0)
void genPrimes(int n) {
	pfac = vector<int>(n + 1);
	for (int i = 2; i <= n; ++i) pfac[i] = i;
	for (int i = 2; i <= n; ++i)
		if (pfac[i] == i)
			for (int j = i + i; j <= n; j += i)
				pfac[j] = i;
}
/* Prime factors (with precomputing). */
vector<pair<int, int>> factorize(int x) {
	vector<pair<int, int>> factors;
	while (x > 1) {
		int p = pfac[x];
		int cnt = 0;
		while (pfac[x] == p) {
			++cnt;
			x /= p;
		}
		factors.emplace_back(p, cnt);
	}
	return factors;
}
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	binom(n + 20, 0);
	genPrimes(m);
	Mint ans = 0;
	for (int i = 1; i <= m; ++i) {
		auto ps = factorize(i);
		Mint prod = 1;
		for (auto& p : ps) {
			prod *= binom(n - 1 + p.second, p.second);
		}
		ans += prod;
	}
	printf("%d\n", ans.val);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define pb push_back
#define mp make_pair
template <typename T> void chkmin(T &x,T y){y<x?x=y:T();}
template <typename T> void chkmax(T &x,T y){x<y?x=y:T();}
template <typename T> void readint(T &x)
{
	int f=1;char c;x=0;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	x*=f;
}
const int MOD=998244353;
inline int dmy(int x){return x>=MOD?x-MOD:x;}
inline void inc(int &x,int y){x=dmy(x+y);}
int qmi(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%MOD)
		if(y&1)ans=1ll*ans*x%MOD;
	return ans;
}
const int MAXN=100005;

int n;
char a[MAXN];

int main()
{
	#ifdef LOCAL
	freopen("code.in","r",stdin);
//	freopen("code.out","w",stdout);
	#endif
	readint(n);
	scanf("%s",a+1);
	if(a[1]!=a[n])return 0*printf("1\n");
	for(int i=2;i<=n-2;++i)
		if(a[i]!=a[1] && a[i+1]!=a[1])return 0*printf("2\n");
	printf("-1\n");
	return 0;
}

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

int get() {
	int x = 0, f = 1; char c = getchar();
	while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
	while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); }
	return x * f;
}

double Sx, Sy, Gx, Gy;

int main() {
	Sx = get(), Sy = get(), Gx = get(), Gy = get();
	printf("%.9lf", Sx + (Gx - Sx) / (Sy + Gy) * Sy);
	return 0;
}


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

void chmin(int &a, int b) { if(a>b) a=b; }

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> A(N+1, 0);
    vector<int> B(M+1, 0);
    vector<vector<int>> dp(N+1, vector<int>(M+1, INT_MAX));
    for (int i=1; i<=N; i++) { cin >> A[i]; }
    for (int i=1; i<=M; i++) { cin >> B[i]; }

    dp[0][0] = 0;
    for (int i=0; i<=N; i++) {
        for (int j=0; j<=M; j++) {
            int tmpa = INT_MAX;
            if (i>0) {
                //chmin(dp[i][j], dp[i-1][j] + 1);
                chmin(tmpa, dp[i-1][j] + 1);
            }

            if (j>0) {
                //chmin(dp[i][j], dp[i][j-1] + 1);
                chmin(tmpa, dp[i][j-1] + 1);
            }

            if (i>0 && j>0)  {
                //chmin(dp[i][j], dp[i-1][j-1] + !(A[i]==B[j])); // true is 1
                chmin(tmpa, dp[i-1][j-1] + !(A[i]==B[j])); // true is 1
            }
            if (i==0 && j== 0) dp[i][j] = 0;
            else dp[i][j] = tmpa;
            //cout << tmpa << " ";
            //cout << dp[i][j] << " ";
        }
        //cout << endl;
    }

    cout << dp[N][M] << endl;

    return 0;
}

/*
    author: lone_star
    I love coding, particle physics and chilled beer.
*/

#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;

long long mod(ll x, ll M){
    return ((x%M + M)%M);
}
long long add(ll a, ll b, ll m){
    return mod(mod(a,m)+mod(b,m),m);
}
long long mul(ll a, ll b, ll m){
    return mod(mod(a,m)*mod(b,m),m);
}

bool prime(ll s)
{
    if (s <= 1)  return false;
    if (s <= 3)  return true;
    if (s%2 == 0 || s%3 == 0) return false;

    for (ll i=5; i*i<=s; i=i+6)
        if (s%i == 0 || s%(i+2) == 0)
            return false;

    return true;
}

ll power(ll x, ll y)
{
    ll res = 1;

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

        y = y >> 1;
        x = (x * x);
    }
    return res;
}

// ll power(ll x, ll y)
// {
//     ll ans = 1;
//     for(ll i=1;i<=y;++i)
//         ans*=x;
//     return ans;
// }

ll power(ll x, ll y, ll p)
{
    ll res = 1;

    x = x % p;

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

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

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

bool square(long double x)
{
    long double sr = sqrt(x);

    return ((sr - floor(sr)) == 0);
}

void solve()
{
    string a,b;
    cin>>a>>b;
    ll sum1=0,sum2=0;
    for(char ch : a)
        sum1+= ch-'0';
    for(char ch : b)
        sum2+= ch-'0';
    cout<<max(sum1,sum2)<<"\n";
}

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

    ll t=1;
    // cin>>t;

    ll z=1;
    while(t--)
    {
        // cout<<"Case #"<<z<<": ";
        solve();
        z++;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
const int inf = 1000000000; // 10^9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//vector<vector<int>> vv(n, vector<int>(m));

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

    vector<string> S(N);

    rep(i,N) cin >> S[i];

    map<string,int> M; //stringの番地にintを立てれる．

    string wow = "!";

    rep(i,N){
        M[S[i]] = 1;
        if(S[i][0]=='!'){ //先頭が!のとき
            string temp;
            temp = S[i];
            temp.erase(temp.begin());
            if(M[temp]==1){
                cout << temp << endl;
                return 0;
            }
        }
        else{
            string temp2 = wow + S[i];
            if(M[temp2]==1){
                cout << S[i] << endl;
                return 0;
            }
        }
    }
    cout << "satisfiable" << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

int main() {
  ll N;cin>>N;
 vector<vector<ll>> vec(N,vector<ll> (5));
 for(ll i=0;i<N;i++) {
   for(ll j=0;j<5;j++) {
     cin>>vec[i][j];
   }
 }

ll s=1;
ll g=1e9+1;

while(s<g) {
  ll k=(s+g+1)/2;
  set<ll> Q;
  vector<ll> note(0);
  for(ll i=0;i<N;i++) {
   ll S=0;
    for(ll j=0;j<5;j++) {
      if(vec[i][j]>=k) {
        S|=(1<<j);
      }
    }

      Q.insert(S);

    }

  bool b=false;
for(auto x:Q) {
  for(auto y:Q) {
    for(auto z:Q) {
      ll a=x|y|z;
      if(a==(1<<5)-1) b=true;
    }
  }
}

if(b) s=k;
else g=k-1;
}

  cout<<s<<endl;
}


#include <cstdio>

#define rep( i, a, b ) for( int i = (a) ; i <= (b) ; i ++ )
#define per( i, a, b ) for( int i = (a) ; i >= (b) ; i -- )

typedef long long LL;

const int MAXN = 2e5 + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

LL buc[MAXN];

int main()
{
	int K;
	read( K );
	rep( i, 1, K )
		rep( j, 1, K / i )
			buc[i * j] ++;
	LL ans = 0;
	rep( i, 1, K )
		rep( j, 1, K / i )
			ans += buc[j];
	write( ans ), putchar( '\n' );
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    srand(time(NULL));
    ll n,m;
    cin >> n >> m;
    vector<string>che(m);
    string ra ="ABCDEFGH";
    for(int i=0;i<m;i++){
        cin>>che.at(i);
    }
    sort(che.begin(),che.end());
    ll check =0;
    for(int i=0;i<n;i++){
        string d;
        while(d.size()<n){
            if(d.size()+che.at(check).size()>n){
                while(d.size()<n){
                d+='.';
                }
                break;
            }
            d+=che.at(check);
            check++;
        }
        if(d.size()>n){
            string g;
            for(int j=0;j<n;j++){
            g+=d.at(j);
            }
            d=g;
        }
        cout<<d<<endl;
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int N;
    ll X;
    cin >> N >> X;
    vector<ll> A(N), dp(2), x(N), bound(N);
    for(int i = 0; i < N; ++i)  cin >> A[i];
    for(int i = N - 1; i >= 0; --i){
        x[i] = X / A[i];
        X %= A[i];
    }
    for(int i = 0; i + 1 < N; ++i)  bound[i] = A[i + 1] / A[i];
    bound[N - 1] = 1e+17;
    dp[0] = 1;
    for(int i = 0; i < N; ++i){
        vector<ll> dp2(2);
        for(int j = 0; j < 2; ++j){
            for(int k = 0; k < 2; ++k){
                // x[i] + z + j = y + k * val[i]
                // y = 0
                ll z = 0 + bound[i] * k - x[i] - j;
                if(0 <= z && z < bound[i])  dp2[k] += dp[j];
                // z = 0
                ll y = x[i] + 0 + j - bound[i] * k;
                if(0 < y && y < bound[i])   dp2[k] += dp[j];
            }
        }
        swap(dp, dp2);
    }
    cout << dp[0] << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<P>;
using vvp = vector<vp>;

#define INF 1001001001
#define MAX 200010

const int mod = 1000000007;

int n;
vl a;

vl div(ll x) {
  vl res(n);
  for (int i = n-1; i >= 0; i--) {
    res[i] = x/a[i];
    x %= a[i];
  }
  return res;
}
int main() {
  ll x;
  cin >> n >> x;
  a.resize(n);
  rep(i,n) cin >> a[i];
  vl vx = div(x);
  vl dp(n);
  rep(i,n-1) if (vx[i]) dp[i]++;
  rep(i,n-1) {
    vl v = div(x+a[i+1]);
    int idx = i+1;
    while (!v[idx]) idx++;
    for (int j = idx; j < n-1; j++) if (v[j]) dp[j]+=dp[i];
  }
  ll ans = 1;
  rep(i,n) ans += dp[i];
  cout << ans << endl;

  return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
   ll N;cin>>N;
   ll ans=N;
   for(ll b=0;(1LL<<b)<=N;b++){
      ll a = N/(1LL<<b);
      ll c = N - a*(1LL<<b);
      ans=min(ans,a+b+c);

   }

   cout<<ans<<endl;

}

#include"bits/stdc++.h"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }
#define INF 1e18
#define PI (acos(-1))
#define mod (int)1e9+7
struct Edge {
    ll to, weight;
    Edge(ll t, ll w) :to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
int main() {
    string s;
    cin >> s;
    ll cnt = 0;
    REP(i, s.size() - 3) {
        if (s.substr(i, 4) == "ZONe") {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define coutp(a) cout << "(" << a.first << ", " << a.second << ")"

using namespace std;

const int mx = 2e5;
int parent[mx + 10], Rank[mx + 10];

int get(int a)
{
    return parent[a] = (parent[a] == a? a: get(parent[a]));
}

void Union(int a, int b)
{
    a = get(a);
    b = get(b);

    if(Rank[a] == Rank[b])
        Rank[a]++;

    if(Rank[a] > Rank[b])
        parent[b] = a;
    else
        parent[a] = b;
}

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

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

        set <int> s;
        for (int i = 0; i < n/2; i++)
        {
            if(a[i] != a[n - i - 1])
            {
                if(parent[a[i]] == 0)
                parent[a[i]] = a[i];
                if(parent[a[n - i - 1]] == 0)
                parent[a[n - i - 1]] = a[n - i - 1];

                s.insert(a[i]);
                s.insert(a[n - i - 1]);

                Union(a[i], a[n - i - 1]);
            }
        }

        set <int> s2;
        for(auto i: s)
        {
            // cout << i << " " << get(i) << endl;
            s2.insert(get(i));
        }

        cout << s.size() - s2.size() << endl;

    }

}

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

vector<int> V[100001];

int f[100001], sz[100001];

void dfs(int pos) {
	f[pos] = -1, sz[pos] = 1;

	int sum = 0;
	vector<int> odd;
	for (int w : V[pos]) {
		dfs(w); sz[pos] += sz[w];
		if (sz[w] & 1) odd.push_back(w);
		else {
			if (f[w] >= 0) f[pos] += f[w];
			else sum += f[w];
		}
	}
	sort(odd.begin(), odd.end(), [&](int a, int b) -> bool {
		return f[a] > f[b];
		});
	bool aoki = false;
	for (int w : odd) {
		f[pos] += (aoki ? -1 : 1) * f[w];
		aoki = !aoki;
	}

	if (odd.size() & 1) f[pos] -= sum;
	else f[pos] += sum;
}

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

	int n; cin >> n;
	for (int i = 2; i <= n; i++) {
		int a; cin >> a;
		V[a].push_back(i);
	}

	dfs(1);
	cout << (n - f[1]) / 2;

	return 0;
}


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

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a:x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define f first
#define s second
#define nl "\n"
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
const int MOD=1e9+7;
template<class T> using pqg=priority_queue<T, vector<T>, greater<T>>;

template <ll Mod>
struct ModInt {
  ll n;

  ModInt(const ll x = 0) : n(x) {
    while (n < 0) n += Mod;
    n %= Mod;
  }
  explicit operator int() const { return n; }
  inline constexpr ModInt operator+(const ModInt r) const noexcept { return ModInt(*this) += r; }
  inline constexpr ModInt operator-(const ModInt r) const noexcept { return ModInt(*this) -= r; }
  inline constexpr ModInt operator*(const ModInt r) const noexcept { return ModInt(*this) *= r; }
  inline constexpr ModInt operator/(const ModInt r) const noexcept { return ModInt(*this) /= r; }
  inline constexpr ModInt &operator+=(const ModInt r) noexcept {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  inline constexpr ModInt &operator-=(const ModInt r) noexcept {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  inline constexpr ModInt &operator*=(const ModInt r) noexcept {
    n = n * r.n % Mod;
    return *this;
  }
  inline constexpr ModInt &operator/=(const ModInt r) noexcept { return *this *= r.inv(); }

  inline constexpr ModInt pow(ll x) const noexcept {
    ModInt<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  inline constexpr ModInt inv() const noexcept { return pow(Mod-2); }

  friend ostream& operator<<(ostream& os, const ModInt& obj) { return os << obj.n; }
  friend istream& operator>>(istream& is, ModInt& obj) {
    ll t;
    is >> t;
    obj = ModInt(t);
    return is;
  }
};

constexpr ll mod = 998244353; //check!
using mint = ModInt<mod>;
mint operator"" _mi(unsigned long long n) { return mint(n); }

mint fac[200001];
mint sum[301];
mint a[200001];
mint b[200001];
int n, k;

mint choose(int n, int k){
  return fac[n]/fac[k]/fac[n-k];
}

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

  cin >> n >> k;
  fac[0]=1;
  rep(i, 1, k) fac[i]=fac[i-1]*i;
  rep(i, 1, n){
    cin >> a[i];
    b[i]=1;
  }

  rep(j, 0, k){
    rep(i, 1, n){
      sum[j]+=b[i];
      b[i]*=a[i];
    }
  }

  rep(i, 1, k){
    mint ans=0;
    rep(c, 0, i){
      ans+=choose(i, c)*(sum[c]*sum[i-c]-sum[i])/2;
    }
    cout << ans << nl;
  }
}

#include <bits/stdc++.h>

using namespace std;
int main()
{
	//freopen ("input.txt","r",stdin);
	//freopen ("output.txt","w",stdout);
	int a,b;

	scanf("%d%d",&a,&b);

	double ans = (double)(a*b)/100;

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


// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
//#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//ordered_set 重複不可
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// use set_function + find_by_order(select itr-num)

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char Alpha[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

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

//cout << std::fixed << std::setprecision(15) << y << endl; //小数表示

int main(){
    string s1, s2, s3; cin >> s1 >> s2 >> s3;
    vector<int> flag(26, 0);
    REP(i,0,s1.size()){
        flag[s1[i]-'a'] = 1;
    }
    REP(i,0,s2.size()){
        flag[s2[i]-'a'] = 1;
    }
    REP(i,0,s3.size()){
        flag[s3[i]-'a'] = 1;
    }
    vector<char> clis;
    REP(i,0,26){
        if(flag[i]){
            clis.pb(alpha[i]);
        }
    }
    if(clis.size() > 11){
        cout << "UNSOLVABLE" << endl;
        return 0;
    }
    vector<int> v(10,0);
    REP(i,0,10){
        v[i] = i;
    }
    do {
        ll ss1 = 0, ss2 = 0, ss3 = 0;
        REP(i,0,s1.size()){
            char key = s1[i];
            REP(l,0,clis.size()){
                if(key == clis[l]){
                    ss1 *= 10;
                    ss1 += v[l];
                }
            }
        }
        //cout << ss1 << " ";

        REP(i,0,s2.size()){
            char key = s2[i];
            REP(l,0,clis.size()){
                if(key == clis[l]){
                    ss2 *= 10;
                    ss2 += v[l];
                }
            }
        }
        //cout << ss2 << " ";

        REP(i,0,s3.size()){
            char key = s3[i];
            REP(l,0,clis.size()){
                if(key == clis[l]){
                    ss3 *= 10;
                    ss3 += v[l];
                }
            }
        }
        //cout << ss3 << endl;
        if(!( (to_string(ss1).size() == s1.size()) && (to_string(ss2).size() == s2.size()) && (to_string(ss3).size() == s3.size())) ){
            continue;
        }
        if(s1.size() == 1){
            if(ss1 == 0){
                continue;
            }
        }
        if(s2.size() == 1){
            if(ss2 == 0){
                continue;
            }
        }
        if(s3.size() == 1){
            if(ss3 == 0){
                continue;
            }
        }
        //ll is1 = stoi(ss1), is2 = stoi(ss2), is3 = stoi(ss3);
        if(ss1 + ss2 == ss3){
            cout << ss1 << endl;
            cout << ss2 << endl;
            cout << ss3 << endl;
            return 0;
        }
    } while (std::next_permutation(v.begin(), v.end()));

    cout << "UNSOLVABLE" << endl;
    return 0;
}

#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, init, end) for(ll i = init; i < end; i++)
#define REP(i, init, end) for(ll i = init; i < end + 1; i++)
#define rev(i, end, init) for(ll i = init - 1; i >= end; i--)
#define REV(i, end, init) for(ll i = init; i >= end; i--)
#define PI 3.14159265359
// #define EPS 0.0000000001
// #define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;

ll getSize(ll N){
    ll count = 0;
    while(N > 0){
        count++;
        N /= 10;
    }

    return count;
}

int main(){
    string S[3];
    rep(i, 0, 3){
        cin >> S[i];
    }

    ll N[3][26];
    ll x;
    rep(i, 0, 3){
        rep(j, 0, 26){
            x = 0;
            rep(k, 0, S[i].size()){
                x *= 10;
                if(S[i][k] - 'a' == j){
                    x += 1;
                }
            }
            N[i][j] = x;
        }
    }

    vector<ll> v = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    ll p;
    ll Nnum[3];
    ll Nsize[3];
    bool moveP;
    bool found = false;
    do{
        p = 0;
        rep(i, 0, 3){
            Nnum[i] = 0;
        }

        rep(j, 0, 26){
            moveP = false;
            rep(i, 0, 3){
                if(N[i][j] != 0){
                    moveP = true;
                }
                Nnum[i] += N[i][j] * v[p];
            }
            if(moveP){
                p++;
            }
        }

        if(Nnum[0] + Nnum[1] == Nnum[2]){
            found = true;
            rep(i, 0, 3){
                if(S[i].size() != getSize(Nnum[i])){
                    found = false;
                }
            }
            if(found){
                break;
            }
        }
    }while(next_permutation(v.begin(), v.end()));

    if(found){
        rep(i, 0, 3){
            cout << Nnum[i] << endl;
        }
    }else{
        cout << "UNSOLVABLE" << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
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;}
#define rep(i,n) for(int i=0;i<(n);i++)
#define drep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cerr << #x << " = " << (x) << endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N),B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    ll sum = 0;
    rep(i,N) sum += A[i]*B[i];
    cout << (sum? "No\n":"Yes\n");
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin >> n;
  int x[n];
  int y[n];
  for(int i=0;i<n;i++)
  {
    cin >> x[i];
  }
  for(int j=0;j<n;j++)
  {
    cin >> y[j];
  }
  int mul[n];
  int sum=0;
  for(int p=0;p<n;p++)
   {
     mul[p]=x[p]*y[p];
   }
   for(int o=0;o<n;o++)
   {
      sum=sum+mul[o];
    }
  if(sum==0)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}


/*
        @uthor: Kashish Gilhotra
        user: CodeChef, CodeForces, HackerEarth, HackerRank, SPOJ: kashish001
*/

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

#define int long long int
typedef vector<int> vi;
typedef vector<pair<int, int>> vpi;
typedef vector<vi> vvi;
const int mod = 1e9 + 7;

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
#define debug(...) cerr << "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define EB emplace_back
#define ALL(v) v.begin(), v.end()
#define size(v) (int)v.size()
#define endl '\n'
#define UMO unordered_map
#define USO unordered_set
#define TC int t; cin >> t; while (t--)

void Panda() {
    int n;
    cin >> n;
    int m = 0, maxx = INT64_MIN;
    double euc = 0;
    for(int i = 0, x;i < n ; i++) {
        cin >> x;
        m += abs(x);
        euc += (int)pow(abs(x), 2);
        maxx = max(maxx, abs(x));
    }
    cout << m << endl;
    cout << fixed << setprecision(15) << sqrt(euc) << endl;
    cout << maxx << endl;
}

int32_t main() {

    FAST;

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    Panda();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define forf(i,a,b) for(ll i = a; i < b; i++)
#define forb(i,a,b) for(ll i = b; i >= a; i--)
#define pb push_back
#define ff first
#define ss second
#define pi 3.141592653589793
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define print(v) for(auto x:v) {cout<<x<<" ";}
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>

int main()
{

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

	fast
	ll n;
	cin>>n;
	map<ll,ll> count;
	forf(i,0,n)
	{
		ll x;
		cin >> x;
		count[x]++;
	}
	ll c = 0;
	ll ans = 0;
	for(auto x : count)
	{
		c += x.second;
		ans += x.second * (n-c);
	}
	cout<<ans;
	return 0;
}


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

template<typename T>
void view_1d(vector<T> V, string sep) {
    for (ll i=0; i<V.size(); i++) {
        cout << V[i];
        if (i == V.size() - 1) {
            cout << endl;
        } else {
            cout << sep;
        }
    }
}

template<typename T>
void view_2d(vector<vector<T>> V, string sep) {
    for (ll i=0; i<V.size(); i++) {
        for (ll j=0; j<V[i].size(); j++) {
            cout << V[i][j];
            if (j == V[i].size() - 1) {
                cout << endl;
            } else {
                cout << sep;
            }
        }
    }
}

//==============================//

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (ll i=0; i<N; i++) cin >> A[i];

    unordered_map<ll,ll> mp;
    for (ll i=0; i<N; i++) mp[A[i]]++;

    ll ans = N * (N - 1) / 2;
    for (auto x : mp) {
        ans -= x.second * (x.second - 1) / 2;
    }

    cout << ans << endl;
}

#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define set(x, i) (x | (1 << i))
#define check(x, i) (x & (1 << i))
#define printcase printf("Case %d: ",test++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0,lim-1);
  return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

int test = 1;
vi g[N];
int a[N];

void solve() {
  int i, j, n, m;
  //printcase;
  map<ll, int> nums;
  cin >> n;
  ll ans = 0;
  fo(i,n) {
    int a;
    cin >> a;
    ans += i - nums[a];
    nums[a]++;
  }
  cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

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

    return 0;
}

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

void ipgraph(int n, int m){
  int i, u, v;
  while(m--){
    cin>>u>>v;
    u--, v--;
    g[u].pb(v);
    g[v].pb(u);
  }
}

void dfs(int u, int par){
  for(int v:g[u]){
    if (v == par) continue;
    dfs(v, u);
  }
}


#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;

int main() {
    ll n;
    scanf("%lld", &n);

    ll sum = 1;
    for(int i = 2; i<=n; i++) {
        int value = i;
        for(int j=i-1; j>1; j--) {
            if(value % j == 0) {
                value = value / j;
            }
        }
        if(i == 8) value = value * 2;
        if(i == 16) value = value * 2;
        if(i == 27) value = value * 3;
        sum *= value;
    }

    for(int i=2; i<=n; i++) {
        ll x = (sum+1) % i;
        if(x != 1) printf("no!!! n: %lld, %d, %lld\n", n, i, x);
    }
    cout << sum + 1 << '\n';
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR(i,a,b) for(i= a ; i < b ; ++i)
#define rep(i,n) FOR(i,0,n)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define INF INT_MAX
#define pb push_back
#define tc int t;cin>>t;while(t--)
#define ll long long int
#define mod (ll)(1e9 + 7)
#define vi vector<int>
#define vll vector<ll>
#define endl "\n"
#define si set<int>
using ld= long double;

int main()
{
    fastio;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //graph();
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min({a,b,c,d})<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define For(i,x,y)	for(ll i=(x);i<=(y);++i)
#define FOr(i,x,y)	for(ll i=(x);i>=(y);--i)
#define rep(i,x,y)	for(ll i=(x);i<(y);++i)
#define clr(a,v)	memset(a,v,sizeof(a))
#define cpy(a,b)	memcpy(a,b,sizeof(a))
#define fi	first
#define se	second
#define	pb	push_back
#define mk	make_pair
#define pa	pair<ll,ll>
#define y1	y11111111111111
#define debug	puts("@@@@@@@@@@@@@@@@@@@@@@@")
ll read(){
	ll x=0,f=1;	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())	if (ch=='-')	f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())	x=x*10+ch-'0';
	return x*f;
}
void write(ll x){
	if (x<0)	putchar('-'),write(-x);
	else{
		if (x>=10)	write(x/10);
		putchar(x%10+'0');
	}
}

ll a[11][11],m[11];

inline ll ksm(ll x,ll n,ll m){
	ll ans = 1;
	while(n){
		if(n&1) ans = ans*x%m;
		x = x*x%m;
		n >>= 1;
	}
	return ans;
}

signed main(){
	For(i,0,9){
		a[i][++m[i]] = i;
		ll x = i*i%10;
		while(x != i){
			a[i][++m[i]] = x;
			x = x*i%10;
		}
	}
	ll A = read(),B = read(),C = read();
	A = A%10;
	ll p = ksm(B,C,m[A]);
	if(p == 0) p = m[A];
	printf("%lld\n",a[A][p]);
}

#include <bits/stdc++.h>
#define ll long long
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FOR(i, a, b) for (int i=a; i<(b); i++)
using namespace std;

ll mod = 998244353;

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

    ll a,b,c;
    cin >> a >> b >> c;
    ll x1 = (a*(a+1)/2) % mod;
    ll x2 = (b*(b+1)/2) % mod;
    ll x3 = (c*(c+1)/2) % mod;

    ll ans = ((x1*x2%mod)*x3%mod);
    cout << ans << "\n";

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<pair<int, int>> v(N);
  for (int i = 0; i < N; ++i) {
    cin >> v[i].first >> v[i].second;
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (abs(v[i].first - v[j].first) >= abs(v[i].second - v[j].second)) {
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define rArr(v) for(auto &i: v) cin >> i
#define pArr(v) for(auto i: v) cout << i << " "
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
  int i, j, n, m;
  cin >> n;
  vpii points(n, {0, 0});

  for(pii &point: points) {
    cin >> point.F >> point.S;
  }

  int counter = 0;

  for(i = 0; i<n; i++) {
    for(j = i + 1; j<n; j++) {
      float slope = float(points[j].S - points[i].S)/float(points[j].F - points[i].F);
      // deb(slope);
      if(slope >= -1 && slope <= 1) counter++;
    }
  }

  cout << counter << endl;

}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

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

    return 0;
}

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

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}