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

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++){
        cin >> a.at(i);
    }

    vector<int> hindo(N);
    for (int i = 0; i < N; i++){
        hindo.at(a.at(i))++;
    }
    vector<vector<int>>hako(K,vector<int>(0));
    int MAX = 0;
    for (int i = 0; i < K; i++){
        for (int j = 0; j < N; j++){
            if (hindo.at(j) > 0){
                hako.at(i).push_back(j);
                hindo.at(j)--;
            }else{
                break;
            }
        }
        MAX += hako.at(i).size();
    }
    cout << MAX << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (n); i++)
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int main() {
    int n;
    ll ans = 0;
    string s;
    cin >> n >> s;
    vector<vector<int>> count(n + 1, vector<int>(4, 0));
    string ch = "ATCG";
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            for (int j = 0; j < 4; j++) count[i + 1][j] += count[i][j];
        }
        for (int j = 0; j < 4; j++)
            if (s[i] == ch[j]) count[i + 1][j]++;
    }

    for (int st = 0; st < n; st++) {
        for (int le = 2; st + le < n + 1; le++) {
            int num[4] = {0};
            for (int i = 0; i < 4; i++)
                num[i] = count[st + le][i] - count[st][i];
            if (num[0] == num[1] && num[2] == num[3]) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t,n,s,k;

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

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

void solve()
{
    ll a = k;
    ll b = n;
    ll m = n-s;
    ll g = gcd(a,b);
    if(m%g!=0){
        cout<<-1<<endl;
        return;
    }

    ll d = gcd(g,m);
    a /= d;
    m /= d;
    b /= d;
    n /= d;

    ll tmp = gcd(a,b);

    ll x,y;
    exgcd(a,b,x,y);
    ll tm =  x*m/tmp;
  	ll res = (tm%n+n)%n;
    cout<<res<<endl;

    return;
}

int main()
{
    cin>>t;
    while(t--){
        cin>>n>>s>>k;
        solve();
    }

    return 0;
}

#include<bits/stdc++.h>
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define LL long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define int long long
#define sz(x) (ll)(x.size())
using namespace std;

const int mod = 1e9+7;

int expo_pow(int x,int y){
 if(y == 0) return 1;
  y=y%(mod-1);
  x%=mod;
  if(y==0) y=mod-1;
  int res=1;
  while(y){
    if(y&1) res=(res*x)%mod;
    x=(x*x)%mod;
    y>>=1;
  }
  return res;
}

ll add()
{
    return 0;
}

template <typename T, typename... Types>
T add(T var1, Types... var2){
    return (((((ll)(var1)) % mod + (ll)(add(var2...))) % mod) + mod) % mod;
}

ll mul(){
    return 1;
}

template <typename T, typename... Types>
T mul(T var1, Types... var2){
    return (((ll)(var1)) % mod * (ll)(mul(var2...))) % mod;
}

class triplet{
    public:
    LL a;
    LL b;
    LL gcd;
};

triplet extended_euclid(LL a,LL b)
{
    if(b==0)
    {
        triplet x;
        x.a=1;
        x.b=0;
        x.gcd=a;
        return x;
    }
    triplet x1=extended_euclid(b,a%b);
    triplet x;
    x.a=x1.b;
    x.b=x1.a-(a/b)*(x1.b);
    x.gcd=x1.gcd;
    return x;
}
LL mod_inverse(LL a, LL m)
{
    LL ans=extended_euclid(a,m).a;
    return (ans%m +m )%m;
}

void solve(){
  int n,s,k;
  cin >> n >> s >> k;
  int gcd = __gcd(n,k);
  int steps_to_move = n - s;
  if (steps_to_move%gcd != 0) {
    cout << "-1\n";
    return;
  }

  n /= gcd;
  k /= gcd;
  steps_to_move /= gcd;

  int ans = mod_inverse(k,n);
  ans*= steps_to_move;
  ans %= n;
  ans += n;
  ans %= n;

  cout << ans << "\n";

}

signed main(){
  fast;
  int test = 1;
  cin>>test;
  int i=1;
  while(test--){
    solve();
  }
}


#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pai
#include <vector>        // vector

typedef long long ll;

using namespace std;

// イテレーション
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repk(i, k, n) for (ll i = k; i < ll(n); i++)

// x:コンテナ
#define ALL(vec) vec.begin(), vec.end()
#define SIZE(x) ll(x.size())

#define debug(x) cout << "debug: " << x << endl

// 定数
#define MOD 1000000007
#define INF32 2147483647
#define INF64 9223372036854775807

int digitsum(int n) {
  int ans = 0;
  while (n > 0) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
void DoSomething() {
  //
  int a, b;
  cin >> a >> b;
  int sum_a = digitsum(a);
  int sum_b = digitsum(b);
  cout << max(sum_a, sum_b) << "\n";
}

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

  DoSomething();

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mem(a,val) memset(a,(val),sizeof((a)))
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define decimal(n)  cout << fixed ; cout << setprecision((n));
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
#define all(v) v.begin(), v.end()
#define endl "\n"
#define lcm(m,n) (m)*((n)/__gcd((m),(n)))
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(ll (i)=1;(i)<(n);(i)++)
#define repa(i,n,a) for(ll (i)=(a);(i)<(n);(i)++)
#define repr(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sz(x) (ll)x.size()
#define ub upper_bound
#define lb lower_bound
#define pcnt(x) __builtin_popcountll(x)
const long long N=1e4+10;
const long long NN=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}

ll abc[61];
void pre()
{
  abc[0]=1;
  for(int i=1;i<=60;i++)
  {
    abc[i]=abc[i-1]*2;
  }
}

void solve()
{
  //code begins from here//
  ll n;
  cin>>n;
  string s[n+1];
  rep1(i,n+1)cin>>s[i];
  ll ans=0;
  for(int i=n;i>=1;i--)
  {
    if(s[i]=="OR")
    {
      ans+=abc[i];
    }
  }
  ans++;
  cout<<ans;
}

signed main()
{
FAST
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int testcase=1;
//cin>>testcase;
  pre();
while(testcase--) solve();
return 0;
}


#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <string.h>
#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;

#define INF 2000000000000000000

ll p(ll n, ll m){
    if(m == 0) return 1;
    if(m == 1) return n;
    if(m % 2 == 0){
        return p(n * n, m / 2);
    }
    return n * p(n * n, (m - 1) / 2);
}

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

    ll a, b, c;
    ll twoB;
    ll ans = INF;
    rep(i, 0, 62){
        b = i;
        twoB = p(2, b);
        if(twoB > N){
            break;
        }

        a = N / twoB;
        c = N % twoB;
        ans = min(ans, a + b + c);
    }

    cout << ans << endl;

    return 0;
}

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

int n;
long long a[200010],b[200010];
long long c[200010];
int main(void)
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    scanf("%lld",&a[i]);
    for (int i=1;i<=n;i++)
    scanf("%lld",&b[i]);
    long long ans = 0;
    long long maxa=0,maxb=0;
    for (int i=1;i<=n;i++)
    {
        ans = max(ans,a[i]*b[i]);
        ans = max(ans,maxa*b[i]);
        // ans = max(ans,maxb*a[i]);
        c[i] = ans;
        maxa = max(maxa,a[i]);
        // maxb = max(maxb,b[i]);
    }
    for (int i=1;i<=n;i++)
    printf("%lld\n",c[i]);
    return 0;
}


#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int sum=0;
    int sum2=0;
    for(int i=0;i<a.size();i++){
        sum=sum+(a[i]-'0');
    }
    for(int i=0;i<b.size();i++){
        sum2=sum2+(b[i]-'0');
    }
    if(sum>sum2) cout<<sum<<endl;
    else if(sum2>sum) cout<<sum2<<endl;
    else cout<<sum<<endl;
    return 0;
}

#pragma GCC optimize("Ofast")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

int sum(int n){
    int s=0;
    while(n>0){
        s+=n%10;
        n/=10;
    }
    return s;
}
void solve() {
    int a,b; cin>>a>>b;
    cout<<max(sum(a),sum(b));
}

int32_t main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 100005
#define ll long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
int T,n,A[N];ll Sum1,Sum2;
int main()
{
	for(scanf("%d",&T);T--;Sum1=Sum2=0)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++) scanf("%d",&A[i]);
		std::sort(A+1,A+1+n);
		if(n&1)
		{
			for(int i=2;i<=n;i++) i&1?Sum1+=A[i]:Sum2+=A[i];
			Sum1+=A[1];
			puts(Sum1^Sum2?"Second":"First");
		}
		else
		{
			for(int i=1;i<=n;i++) i&1?Sum1+=A[i]:Sum2+=A[i];
			puts(Sum1^Sum2?"First":"Second");
		}
	}
	return 0;
}

#include<bits/stdc++.h>
#define rint register int
using namespace std;
int n,a[1010000];
int main(){
	int T;
	cin>>T;
	while(T--) {
		cin>>n;
		for(rint i=1;i<=n;++i) cin>>a[i];
		sort(a+1,a+n+1);
		if(n&1) {cout<<"Second\n";}
		else {
			int fl=0;
			for(rint i=2;i<=n;i+=2){
				if(a[i]!=a[i-1]) {cout<<"First\n",fl=1;break;}
			}
			if(!fl) cout<<"Second\n";
		}
	}
	return 0;
}


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

int main(){
    LL(n,x);
    vector<ll> a(n);
    in(a);
    ll ans=INF2,c;
    for(int m=1;m<=n;m++){
        vector3d(ll,dp,n+1,n+1,n+1,-INF2);
        dp[0][0][0]=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                for(int k=0;k<m;k++){
                    if(dp[i][j][k]==-INF2)continue;
                    chmax(dp[i+1][j][k],dp[i][j][k]);
                    chmax(dp[i+1][j+1][(k+a[i])%m],dp[i][j][k]+a[i]);
                    if((k+a[i])%m==x%m&&j+1==m){
                        chmin(ans,(x-(dp[i][j][k]+a[i]))/m);
                    }
                }
            }
        }
    }
    out(ans);
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N, M;
    cin >> N >> M;
    vector<vector<bool>> G(N, vector<bool>(N, false));
    for (int i=0; i<M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1][b-1] = G[b-1][a-1] = true;
    }

    vector<int> dp(1<<N, INF);
    dp[0] = 0;
    for (int bits=1; bits<(1<<N); ++bits) {
        bool comp = true;
        for (int i=0; i<N; ++i) {
            for (int j=i+1; j<N; ++j) {
                if ((bits & (1<<i)) && (bits & (1<<j)) && !G[i][j]) {
                    comp = false;
                    break;
                }
            }
            if (!comp) break;
        }

        if (comp) {
            dp[bits] = 1;
        } else {
            for (int sub=bits; ; sub=bits&(sub-1)) {
                chmin(dp[bits], dp[sub] + dp[bits&(~sub)]);
                if (sub == 0) break;
            }
        }
    }
    cout << dp.back() << '\n';
}

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

    solve();

    return 0;
}


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

int main()
{
    int x;
    cin >> x;
    cout << max(x, 0) << endl;
    return 0;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
using ll = long long;
using ld = long double;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 101;
// const ll MOD = 1e9 + 7ll;
// const ll MOD = 998244353;
const double PI=3.14159265358979323846;

int main() {
    ll k; cin >> k;
    ll ans = 0ll;
    ll a = 1ll;
    while(1) {
        ll b = a;
        while(1) {
            ll c = b;
            while(1) {
                if(a*b*c <= k) {
                    // printf("(%lld, %lld, %lld)", a, b, c);
                    if(a == b and a == c and b == c) {
                        ans++;
                        // cout << " 1" << endl;
                    } else if(a == b or b == c) {
                        ans += 3ll;
                        // cout << " 3" << endl;
                    } else {
                        ans += 6ll;
                        // cout << " 6" << endl;
                    }
                    c++;
                } else {
                    if(a == b == c) {
                        cout << ans << endl;
                        return 0;
                    } else {break;}
                }
            }
            if(b == c) break;
            b++;
        }
        if(a == b) {
            cout << ans << endl;
            return 0;
        }
        a++;
    }
}


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

int main(){
	deque <char> s;
	char c;
	int r=0;
	while((c=getchar())!='\n'){
		if(c=='R'){
			r^=1;
			continue;
		}
		if(r==0){
			if(s.empty()) s.push_back(c);
			else{
				if(c==s.back()) s.pop_back();
				else s.push_back(c);
			}
		}else{
			if(s.empty()) s.push_front(c);
			else{
				if(c==s.front()) s.pop_front();
				else s.push_front(c);
			}
		}
	}
	if(!r){
		while(!s.empty()){
			printf("%c",s.front());
			s.pop_front();
		}
	}else{
		while(!s.empty()){
			printf("%c",s.back());
			s.pop_back();
		}
	}
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long t;
  cin>>t;
  while(t--){
  long long n;
    cin>>n;
    if(n%2==1) cout<<"Odd"<<endl;
    else if(n%4==0) cout<<"Even"<<endl;
    else cout<<"Same"<<endl;
  }
  return 0;
}


//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)
//logb(n)=loga(n)/loga(b)

#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

//(a+b)^n=sum of C(n,i)*a^i*b^(n-i) 0<=i<=n
//(a-b)^n=sum of C(n,i)*a^i*b^(n-i) for even i-for odd i

#define gainf pop_front
#define len(x) (int)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0
// a^b=(a+b)-2(a&b)

typedef double db;
typedef long long ll;

//sum of squares n*(n+1)*(2n+1)/6
//sum of cubes [n*(n+1)/2]^2
//sum of squares for odds n*(4*n*n-1)/3
//sum of cubes for odds n*n*(2*n*n-1)

const int ary=2e5+5;
const int mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
int n,q,a[ary],b[ary],to[ary],ti[ary],tu,d[ary];
vector<int> g[ary];
ll w[ary],p[ary];
void dfs(int v=1,int p=0){
	d[v]=d[p]+1;
	tu++;
	ti[v]=tu;
	for(int i=0;i<len(g[v]);i++){
		int to=g[v][i];
		if(to==p){
			continue;
		}
		dfs(to,v);
	}
	to[v]=tu;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>a[i]>>b[i];
		g[a[i]].putb(b[i]);
		g[b[i]].putb(a[i]);
	}
	dfs();
	cin>>q;
	while(q--){
		int t,e,x;
		cin>>t>>e>>x;
		if(t==1){
			if(d[a[e]]<d[b[e]]){
				p[1]+=x;
				p[ti[b[e]]]-=x;
				p[to[b[e]]+1]+=x;
			}
			else{
				p[ti[a[e]]]+=x;
				p[to[a[e]]+1]-=x;
			}
		}
		else{
			if(d[b[e]]<d[a[e]]){
				p[1]+=x;
				p[ti[a[e]]]-=x;
				p[to[a[e]]+1]+=x;
			}
			else{
				p[ti[b[e]]]+=x;
				p[to[b[e]]+1]-=x;
			}
		}
	}
	for(int i=1;i<=n;i++){
		p[i]+=p[i-1];
	}
	for(int i=1;i<=n;i++){
		w[i]=p[ti[i]];
		cout<<w[i]<<"\n";
	}
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define reps(i,s,n) for(int i=s; i<n; i++)
#define per(i,n) for(int i=n-1; i>=0; i--)
#define pers(i,n,s) for(int i=n-1; i>=s; i--)
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define lb(v,n) lower_bound(all(v),n)
#define lbi(v,n) lower_bound(all(v),n) - v.begin()
#define ub(v,n) upper_bound(all(v),n)
#define ubi(v,n) upper_bound(all(v),n) - v.begin()

#define mod 1000000007
#define infi 1010000000
#define infl 1100000000000000000

#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define IN(n,m,v) rep(i,n) rep(j,m){cin >> v[i][j];}
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define cYES cout << "YES" << endl
#define cNO cout << "NO" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}

int N;
ve<ve<pair<int,ll>>> G;
vl A;

void dfs(int u, int v){

    for (auto p : G[u]) {
        if(p.fi == v) continue;
        A[p.fi] = A[u] ^ p.se;
        dfs(p.fi,u);
    }

}

template <typename T> T extgcd(T a, T b, T& x, T& y){
    T d = a;
    if(b != 0){
        d = extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }
    else x=1,y=0;
    return d;
}

template <typename T> T mod_pow(T m, T n) {
    if(n == 0) return 1;
    T res = mod_pow(m*m%mod, n/2);
    if(n & 1) res *= m;
    return res%mod;
}

template <typename T> T mod_inv(T n) {
    T m = mod;
    T x,y;
    extgcd(n,m,x,y);
    return (m+x%m)%m;
}

void solve(){

    cin >> N;
    G.resize(N);
    A.assign(N,0);

    rep(i,N-1){
        int u,v;
        ll w;
        cin >> u >> v >> w;
        u--,v--;
        G[u].pb({v,w});
        G[v].pb({u,w});
    }

    dfs(0,-1);

    //outve(A);

    vl B(61,0);
    vl C(61,0);
    rep(i,N) {
        rep(j,61) {
            if(A[i] & 1LL << (ll)j) B[j]++;
            else C[j]++;
        }
    }

    //outve(B);

    ll ans = 0;
    rep(i,N) {
        rep(j,61){
            if(!(A[i] & 1LL << j)) ans += (B[j])*(ll(1LL<<(ll)j)%mod)%mod;
            else ans += (C[j])*((ll)(1LL<<(ll)j)%mod)%mod;
            ans %= mod;
        }
    }

    cout << (ans*(mod_inv(2LL)%mod))%mod << endl;

}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();

    return 0;
}


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

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N), B(N), C(N, -3 * INF);
    Graph G(N);
    rep(i, N){
        cin >> A[i];
        B[i] = A[i];
    }
    rep(i, M){
        ll x, y;
        cin >> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    rep(i, N){
        sort(all(G[i]));
    }

    rep(i, N){
        for(ll j : G[i]){
            B[j] = min(B[j], B[i]);
            C[j] = max(A[j] - B[i], C[j]);
        }
    }

    ll ans = -3 * INF;
    rep(i, N){
        ans = max(ans, C[i]);

    }

    cout << ans << endl;

}

/*
 * author: cyclexit
 * start from: 2021-01-16 12:06
 */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<pair<int, int>> edge(m);
  for (int i = 0; i < m; ++i) {
    cin >> edge[i].first >> edge[i].second;
    --edge[i].first;
    --edge[i].second;
  }
  sort(edge.begin(), edge.end());
  vector<int> mn(a), mx(a);
  int ans = -1e9 - 10;
  int u, v;
  for (int i = 0; i < m; ++i) {
    u = edge[i].first;
    v = edge[i].second;
    ans = max(ans, mx[v] - mn[u]);
    mx[u] = max(mx[u], mx[v]);
    mn[v] = min(mn[v], mn[u]);
  }
  cout << ans << '\n';
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define coy cout<<"Yes"<<endl
#define con cout<<"No"<<endl
#define pi 3.141592653589793
#define eps 0.00000000001
#define INF 1e9+7
#define LINF 1e18+10
using ll = long long;

using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
using PIP = pair<int, P>;
using Ps = pair<int, string>;

using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }

//const ll mod=998244353;
const ll mod = 1e9 + 7;
const ll MAX = 300000;
template <typename T>
T abs(T a) { if (a < 0)return -a; else return a; }//2020/09/30 stdlib has abs(long) abs(long long) error

//////////////////////////////////////
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main() {
    //cout<<fixed<<setprecision(10);
    int n;
    cin>>n;

    vp x(n);
    rep(i,n)cin>>x[i].fs>>x[i].sc;
    sort(all(x));
    rep(i,n){
        rep(j,i){
            rep(k,j){
                double a1=x[i].fs-x[k].fs,a2=x[i].sc-x[k].sc;
                double b1=x[i].fs-x[j].fs,b2=x[i].sc-x[j].sc;
                double c1=x[j].fs-x[k].fs,c2=x[j].sc-x[k].sc;
                a1=sqrt(a1*a1+a2*a2);
                b1=sqrt(b1*b1+b2*b2);
                c1=sqrt(c1*c1+c2*c2);
                if(abs(b1+c1-a1)<eps){
                    coy;
                    return 0;
                }
            }
        }
    }
    con;
    return 0;
}

#include <math.h>

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

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

  bool ok = false;

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (x[i] == x[j] && x[i] == x[k]) {
          ok = true;
        } else {
          if (y[k] * (x[i] - x[j]) ==
              (y[i] - y[j]) * x[k] + x[i] * y[j] - x[j] * y[i]) {
            ok = true;
          }
        }
      }
    }
  }
  cout << (ok ? "Yes" : "No");
  return 0;
}


// Problem : E - Unique Color
// Contest : AtCoder - AtCoder Beginner Contest 198
// URL : https://atcoder.jp/contests/abc198/tasks/abc198_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Delete the dynamically allocated memory

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

#define ff              first
#define ss              second
#define pb              push_back
#define pr              pair<long long,long long>
#define mp(a,b)         make_pair(a,b)
#define vr              vector<long long>
#define mod1            1000000007
#define mod2            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define fill(a,b)       memset(a, b, sizeof(a))
#define mk(arr,n,type)  type *arr=new type[n];
#define ll              long long
#define ld	            long double
#define w(x)            int x; cin>>x; while(x--)

vr ans;

void print(vr* edges,ll n,ll s,bool* vis,set<ll> &st,ll* c){
	vis[s]=true;
	if(st.find(c[s])==st.end()){
		ans.pb(s+1);
		st.insert(c[s]);
		for(ll i=0;i<edges[s].size();i++){
			if(!vis[edges[s][i]]){
				print(edges,n,edges[s][i],vis,st,c);
			}
		}
		st.erase(c[s]);
	}else{
		for(ll i=0;i<edges[s].size();i++){
			if(!vis[edges[s][i]]){
				print(edges,n,edges[s][i],vis,st,c);
			}
		}
	}
	return;
}

void DFS(vr* edges,ll n,ll* c){
	mk(vis,n,bool)
	for(ll i=0;i<n;i++){
		vis[i]=false;
	}
	set<ll> st;
	print(edges,n,0,vis,st,c);
	delete[] vis;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	mk(c,n,ll)
	for(ll i=0;i<n;i++){
		cin>>c[i];
	}
	mk(edges,n,vr)
	for(ll i=0;i<n-1;i++){
		ll u,v;
		cin>>u>>v;
		edges[u-1].pb(v-1);
		edges[v-1].pb(u-1);
	}
	DFS(edges,n,c);
	sort(ans.begin(),ans.end());
	for(ll i=0;i<ans.size();i++){
		cout<<ans[i]<<"\n";
	}
	delete[] edges;
	delete[] c;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }
long long gcd(long long a, long long b) { return (a % b) ? gcd(b, a % b) : b; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

template<class T>
struct Dijkstra {
private:
    struct Edge {
        int to;
        T cost;
    };

    vector<vector<Edge>> graph;
    vector<T> prev;

public:
    const T inf = numeric_limits<T>::max() / 2 - 1;
    vector<T> dist;
    vector<int> path;

    Dijkstra() {}
    Dijkstra(int n) {
        graph.resize(n);
        dist.resize(n);
        prev.resize(n);
    }

    void add_edge(int from, int to, T cost) {
        graph[from].push_back((Edge){to, cost});
    }

    void get_distance(int from) {
        priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> pq;
        fill(dist.begin(), dist.end(), inf);
        fill(prev.begin(), prev.end(), -1);
        dist[from] = 0;
        pq.push(make_pair(0, from));
        while(!pq.empty()) {
            pair<T, int> p = pq.top(); pq.pop();
            int cv = p.second;
            T cd = p.first;
            if (dist[cv] < cd) continue;
            for (auto e : graph[cv]) {
                T nd = dist[cv] + e.cost;
                if (dist[e.to] > nd) {
                    dist[e.to] = nd;
                    prev[e.to] = cv;
                    pq.push(make_pair(nd, e.to));
                }
            }
        }
    }

    void get_path(int to) {
        path = vector<int>(0);
        for (; to != -1; to = prev[to]) {
            path.push_back(to);
        }
        reverse(path.begin(), path.end());
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> c(n);
    rep(i, n) cin >> c[i];
    Dijkstra<ll> di(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        di.add_edge(a, b, 1);
        di.add_edge(b, a, 1);
    }
    di.get_distance(0);
    vector<bool> checked(n, false), good(n, false);
    rep(i, n) {
        if (checked[i]) {
            if (good[i]) {
                cout << (i + 1) << endl;
            }
            continue;
        }
        di.get_path(i);
        set<ll> colors;
        good[i] = true;
        for(auto &x : di.path) {
            checked[x] = true;
            good[x] = colors.count(c[x]) == 0;
            colors.insert(c[x]);
        }
        if (good[i]) cout << (i + 1) << endl;
    }
    return 0;
}


#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>

using namespace std;

typedef int in;
#define int long long
const long double EPS=1e-9;
const int MOD=1e9+7;
const int N=1e6;

int n,m,arr1[200005],arr2[200005];
struct node{
	int x,a,b;
};
vector<node> adj[200005];
bool vis[200005];
int sm1,sm2;

void dfs(node nd){
	vis[nd.x] = 1;
	sm1 += nd.a;
	sm2 += nd.b;
	//cout << nd.x << " " << nd.a << " " << nd.b << endl;
	for(int i = 0 ; i < adj[nd.x].size() ; i ++){
		node f = adj[nd.x][i];
		if(vis[f.x]){
			continue;
		}
		dfs(f);
	}
}

in main(){
	cin >> n >> m;
	for(int i = 0 ; i < n ; i ++){
		cin >> arr1[i];
	}
	for(int i = 0 ; i < n ; i ++){
		cin >> arr2[i];
	}
	for(int i = 0 ; i < m ; i ++){
		int x,y;
		cin >> x >> y;
		node dummy;
		dummy.x = y;
		dummy.a = arr1[y - 1];
		dummy.b = arr2[y - 1];
		adj[x].push_back(dummy);
		dummy.x = x;
		dummy.a = arr1[x - 1];
		dummy.b = arr2[x - 1];
		adj[y].push_back(dummy);
	}
	for(int i = 1 ; i <= n ; i ++){
		if(!vis[i]){
			node dummy;
			dummy.x = i;
			dummy.a = arr1[i - 1];
			dummy.b = arr2[i - 1];
			sm1 = 0;
			sm2 = 0;
			dfs(dummy);
			//cout << sm1 << " " << sm2 << endl;
			if(sm1 != sm2){
				cout << "No\n";
				return 0;
			}
		}
	}
	cout << "Yes\n";
	return 0;
}

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<time.h>
#include<list>
#include<iomanip>
#include<string>
#include<sstream>
#include<string.h>
#include<queue>
#include<stack>
#include <numeric>
#include<ctype.h>
#define h 1010
#define infi 1000000000000000
#define lli unsigned long long int
#define pb push_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli n,m, x,y, i, sum=0,sum2=0,j, flag=0;
	cin>>n>>m;
	vector<lli>a(n+1),b(n+1);
	vector< vector<lli> >g(n+1);
	for(i=1;i<=n;i++) cin>>a[i];
	for(i=1;i<=n;i++) cin>>b[i];
	for(i=0;i<m;i++)
	{
		cin>>x>>y;
		g[x].pb(y);
		g[y].pb(x);
	}
	vector<bool>vis(n+1,false);
	queue<lli>q;
	for(j=1;j<=n;j++) {
		sum=0;sum2=0;
		if(vis[j]==false) {
	q.push(j);
	vis[j]=true;;
	while(!q.empty())
	{
		x=q.front();
		q.pop();
		if(a[x]<=b[x]) sum+=(b[x]-a[x]);
		else sum2+=(a[x]-b[x]);
		for(i=0;i<g[x].size();i++)
		{
			if(vis[g[x][i]]==false)
			{
				vis[g[x][i]]=true;
				q.push(g[x][i]);
			}
		}
	}
	}
	if(sum==sum2)continue;
	else{flag=1;break;}
	}
	if(flag)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


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

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

#define vec vector
#define PB push_back

#define MP make_pair
#define MT make_tuple
#define F first
#define S second

using ll = long long int; // watch out for overflows in your code
using pii = pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void debug() { cout << "\n"; };
template <typename T, typename... Targs>
void debug(T t, Targs... args) {
    cout << t << " ";
    debug(args...);
}

template <typename T1, typename T2>
inline ostream& operator << (ostream& os, const pair<T1,T2>& p) {
    return os << "(" << p.F << ", " << p.S << ")";
}

template <typename T>
inline ostream& operator << (ostream& os, const vec<T>& v) {
    for(auto& t : v) {
        os << t << " ";
    }
    return os;
}

template <typename T>
inline ostream& operator << (ostream& os, const vec<vec<T>>& m) {
    for(auto& v : m) {
        for(auto& t : v) {
            os << t << " ";
        }
        os << "\n";
    }
    return os;
}

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

template <typename K, typename V>
inline ostream& operator << (ostream& os, const map<K,V>& m) {
    for(auto& p : m) {
        os << p.F << " -> " << p.S << "\n";
    }
    return os;
}

int N;
vec<int> A;

vec<int> C;
void color() {
    vec<int> B(A.begin(), A.end());
    sort(B.begin()+1, B.end());
    map<int, deque<int>> idx;
    ffor(i, 1, 2*N) {
        idx[B[i]].PB(i);
    }
    C.assign(2*N+1, -1);
    ffor(i, 1, 2*N) {
        auto& dq = idx[A[i]];
        if(dq.front() >= N+1) {
            C[i] = 1; // 1 == black
        }
        else {
            C[i] = 0; // 0 == white
        }
        dq.pop_front();
    }
}

vec<char> ans;
void compute() {
    ans.assign(2*N+1, '.');
    stack<int> s;
    ffor(i, 1, 2*N) {
        if(s.empty()) {
            s.push(i);
        }
        else if(C[s.top()] != C[i]){
            ans[s.top()] = '(';
            ans[i] = ')';
            s.pop();
        }
        else {
            s.push(i);
        }
    }
}

////////////////////////////////////////////////////////////////////////

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

    cin >> N;
    A.assign(2*N+1, 0);
    ffor(i, 1, 2*N) {
        cin >> A[i];
    }
    color();
    compute();
    ffor(i, 1, 2*N) {
        cout << ans[i];
    }
    cout << "\n";
}

#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, const U &b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, const U &b){ return b > a ? a = b, true : false; }

int n;
string res;
vector<int> v, pv;
vector<array<int, 2>> a;
map<int, vector<int>> st1, st0;
inline int qry(int l, int r){
    return pv[r + 1] - pv[l];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n; n <<= 1; a.assign(n, {0, 0});
    v.assign(n, 0); pv.assign(n + 1, 0);
    res.assign(n, '.');
    for(int i = 0; i < n; ++i){
        cin >> a[i][0]; a[i][1] = i;
    }
    sort(a.begin(), a.end());
    for(int i = 0; i < n; ++i){
        if(i < n/2) v[a[i][1]] = 1;
        else v[a[i][1]] = -1;
    }
    for(int i = 0; i < n; ++i){
        pv[i + 1] = pv[i] + v[i];
    }
    assert(qry(0, n - 1) == 0);
    for(int i = n - 1; i >= 0; --i){
        if(v[i] == -1) st0[qry(0, i)].push_back(i);
        else st1[qry(0, i)].push_back(i);
    }
    for(int i = 0; i < n; ++i){
        if(res[i] != '.') continue;
        res[i] = '(';
        if(v[i] == -1){
            int pos = qry(0, i - 1);
            res[st1[pos].back()] = ')';
            st1[pos].pop_back();
            st0[qry(0, i)].pop_back();
        }
        else{
            int pos = qry(0, i - 1);
            res[st0[pos].back()] = ')';
            st0[pos].pop_back();
            st1[qry(0, i)].pop_back();
        }
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
#define poi 100
#define int long long
using namespace std;
typedef long long ll;
typedef double db;
char a[poi], b[poi];
int Ahave[poi], Bhave[poi], tothave[poi];
inline int re()
{
    char c = getchar();
    int x = 0, k = 1;
    while (c < '0' || c > '9')
    {
        if (c == '-')
            k = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
        x = (x << 1) + (x << 3) + c - '0', c = getchar();
    return k * x;
}
void wr(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        wr(x / 10);
    putchar(x % 10 + '0');
}
inline int ksm(int x, int y)
{
    int ans = 1;
    for (; y; y >>= 1)
    {
        if (y & 1)
            ans = (ans * x);
        x = (x * x);
    }
    return ans;
}
int getAscore(int x)
{
    int ans = 0;
    Ahave[x]++;
    for (int i = 1; i <= 9; i++)
        ans += i * ksm(10, Ahave[i]);
    Ahave[x]--;
    return ans;
}
int getBscore(int x)
{
    int ans = 0;
    Bhave[x]++;
    for (int i = 1; i <= 9; i++)
        ans += i * ksm(10, Bhave[i]);
    Bhave[x]--;
    return ans;
}
signed main()
{
    int k = re();
    db winCase = 0, totCase = 0;
    scanf("%s%s", a, b);
    for (int i = 0; i < 4; i++)
    {
        Ahave[a[i] - '0']++;
        Bhave[b[i] - '0']++;
        tothave[a[i] - '0']++;
        tothave[b[i] - '0']++;
    }
    for (int i = 1; i <= 9; i++)
        for (int j = 1; j <= 9; j++)
        {
            int Ascore = getAscore(i);
            int Bscore = getBscore(j);
            int thisCase = max(0ll, k - tothave[i]);
            thisCase *= max(0ll, k - tothave[j]);
            if (i == j)
                thisCase = max(0ll, k - tothave[i]) * max(0ll, k - tothave[i] - 1);
            if (Ascore > Bscore)
                winCase += thisCase;
            totCase += thisCase;
        }
    printf("%.7f", winCase / totCase);
    return 0;
}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
    string sep = " ";
    if(v.size()) os << v[0];
    for(int i=1; i<v.size(); i++) os << sep << v[i];
    return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
    for(int i=0; i<v.size(); i++) is >> v[i];
    return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
    cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

bool dfs(int u, int c, int s, vector<vector<int>> &a, vector<int> &cs){
    int n = a.size();
    cs[u] = c;
    for(int v=0; v<n; v++){
        if(s>>v&1) continue;
        if(a[u][v]==0) continue;
        if(cs[v]==c) return false;
        if(cs[v]<0){
            if(!dfs(v, 1-c, s, a, cs)){
                return false;
            }
        }
    }

    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cout << setprecision(20) << fixed;

    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(n));
    for(int i=0; i<m; i++){
        int x, y;
        cin >> x >> y;
        a[x-1][y-1] = 1;
        a[y-1][x-1] = 1;
    }

    ll ans = 0;
    for(int s=0; s<(1<<n); s++){
        bool ok = true;
        for(int i=0; i<n; i++){
            if((s>>i&1)==0) continue;
            for(int j=i+1; j<n; j++){
                if((s>>j&1)==0) continue;
                if(a[i][j]) ok = false;
            }
        }
        if(!ok) continue;

        ll x = 1;
        vector<int> cs(n, -1);
        for(int i=0; i<n; i++){
            if(s>>i&1) continue;
            if(cs[i]>=0) continue;
            if(dfs(i, 0, s, a, cs)){
                x *= 2;
            } else {
                x = 0;
            }
        }
        dbg(s, x);
        ans += x;
    }

    cout << ans << endl;

    return 0;
}


/* Author : Aaryan Srivastava ^__^ */
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ;

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii;
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ;
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

bool cmp(pii& a,  pii& b){
    return 1LL * (a.ff + 2LL * a.ss) > 1LL * (b.ff + 2LL * b.ss);
}

void solve()
{
    int n ;
    cin >> n ;
    vector<pii> v(n);
    rep(i , n) cin >> v[i].ss >> v[i].ff;
    sort(all(v) , cmp);
    int cur = 0;
    rep(i , n) cur -= v[i].ss;
    for(int i = 0 ; i < n ; ++i){
        cur += v[i].ss * 2 + v[i].ff;
        if(cur > 0){
            cout << i + 1;
            return;
        }
    }
}

int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define vt vector
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define sz(x) int(x.size())
#define uset unordered_set
#define umap unordered_map
#define ins insert
const int inf = 0x3f3f3f3f, mod = 1e9+7, mx = 2e5+10;
const ll infll = 0x3f3f3f3f3f3f3f3f;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	vector<array<int, 3>> a;
	for(int i=0; i < n; i++){
		int t, l, r;cin >> t >>l >> r;
		if(t==1){
			a.pb({l, r, t});
		}else if(t==2){
			a.pb({l, r-1, t});
		}else if(t==3){
			a.pb({l+1, r, t});
		}else{
			a.pb({l+1, r-1, t});
		}
	}
	int ans =0 ;
	sort(all(a));
	for(int i=0; i < a.size(); i++){
		for(int j=i+1; j < a.size(); j++){
			auto [l, r, t]= a[i];auto [L, R, T] = a[j];
			if(r >= L){
				ans++; continue;
			}
			int tmp = r, tmp1 = L;
			if(t==2 || t==4){
				tmp++;
			}
			if(T==3||T==4)tmp1--;
			if(tmp > tmp1)ans++;
		}
	}
	cout << ans;
}


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

#define int long long int
#define double long double
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define pqi priority_queue<int>
#define test int tcase; cin>>tcase; for(int tc = 1; tc <= tcase; tc++)
#define inp(a,n,f) int a[n+f];for(int hh=f;hh<n+f;hh++)cin>>a[hh];
#define printdecimal(k) cout<<fixed<<setprecision(k);
#define mem(a,k) memset(a,k,sizeof(a))
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define mod (int)(1e9+7)
#define inf LLONG_MAX
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int exp(int x,int y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int modinv(int x){return exp(x,mod-2);}
int add(int a,int b){a%=mod,b%=mod;a=((a+b)%mod+mod)%mod;return a;}
int sub(int a,int b){a%=mod,b%=mod;a=((a-b)%mod+mod)%mod;return a;}
int mul(int a,int b){a%=mod,b%=mod;a=((a*b)%mod+mod)%mod;return a;}
#define N (int)(2e6+6)

struct segtree
{
	int size;
	vector<int> values;

	void ini(int n)
	{
		size=1;
		while(size<n)
			size*=2;
		values.assign(2*size,1);
	}

	void set(int i,int v,int cur,int lx,int rx)
	{
		if(rx-lx==1)
		{
			values[cur]=v;
			return;
		}
		int m=(lx+rx)/2;
		if(i<m) set(i,v,2*cur+1,lx,m);
		else set(i,v,2*cur+2,m,rx);
		values[cur]=max(values[2*cur+1],values[2*cur+2]);
	}

	void set(int i,int v)
	{
		set(i,v,0,0,size);
	}

	int cal(int v,int cur,int lx,int rx)
	{
		if(values[cur]<v) return -1;
		if(rx-lx==1) return lx;
		int m=(lx+rx)/2;
		int val=cal(v,2*cur+1,lx,m);
		if(val==-1) return cal(v,2*cur+2,m,rx);
		return val;
	}

	int cal(int v)
	{
		return cal(v,0,0,size);
	}
};

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	for(int i=0;i<100;i++){}
	int n,m;
	cin>>n>>m;
	segtree st;
	st.ini(N);
	inp(a,n,0);
	int h[n+1]={0};
	for(int i=0;i<m-1;i++)
		st.set(a[i],0),h[a[i]]++;
	int ans=inf;
	for(int j=m-1,i=0;j<n;j++,i++)
	{
		if(h[a[j]]==0) st.set(a[j],0);
		h[a[j]]++;
		int idx=st.cal(1);
		ans=min(ans,idx);
		h[a[i]]--;
		if(h[a[i]]==0) st.set(a[i],1);
	}
  for(int i=0;i<100;i++){}
	cout<<ans;
	return 0;
}

/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip> //setprecision
#include <map> // map
#include <unordered_map> //unordered_map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
#include <sstream>
#define endl "\n";
using namespace std;

using PLL = pair<long long,long long>;
typedef tuple<long long,long long,long long> TUP;
using P = pair<int,int>;
const long long INF = 4000000000000000001;
const int inf = 1001001001;
const long long MOD = 998244353;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M, long long mod) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % mod, M / 2,mod);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % mod;
    return res %= mod;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}
long long get_mod(long long res){
    if(res < 0) res += MOD;
    return res % MOD;
}

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

    int T;T = 1;
    vector<long long> ans;
    for(int t = 0;t<T;t++){
        long long X,Y,A,B,C,D;cin >> X >> Y;
        if(X == Y){
            ans.push_back(0);
            break;
        }
        A = 1,B = 1,C = 1,D = 1;
        map<long long,long long> cost;
        cost[Y] = 0;
        cost[X] = INF;
        priority_queue<PLL,vector<PLL>,greater<PLL>> Q;
        Q.push(make_pair((long long)0,Y));
        while(!Q.empty()){
            long long now = Q.top().second , c = Q.top().first; Q.pop();
            if(cost.count(0) && c > cost[X]) break;
            //-1繰り返し
            if(abs(X-now)*D+c > 0) cost[X] = min(cost[X],abs(X-now)*D + c);
            //2倍
            long long c2 = now + 2-(now%2);
            if(cost.count(c2/2)) {
                if(abs(now-c2)*D + c + A > 0){
                    if(cost[c2/2] > abs(now-c2)*D + c + A) Q.push(make_pair(abs(now-c2)*D + c + A , c2/2));
                    cost[c2/2] = min(cost[c2/2], (abs(now-c2)*D) + c + A);
                }
            }
            else{
                if(abs(now-c2)*D + c + A > 0){
                    Q.push(make_pair(abs(now-c2)*D + c + A , c2/2));
                    cost[c2/2] = (abs(now-c2)*D) + c + A;
                }
            }
            c2 -= 2;
            if(cost.count(c2/2)) {
                if(abs(now-c2)*D + c + A > 0){
                    if(cost[c2/2] > abs(now-c2)*D + c + A) Q.push(make_pair(abs(now-c2)*D + c + A , c2/2));
                    cost[c2/2] = min(cost[c2/2], (abs(now-c2)*D) + c + A);
                }
            }
            else{
                if(abs(now-c2)*D + c + A > 0){
                    Q.push(make_pair(abs(now-c2)*D + c + A , c2/2));
                    cost[c2/2] = (abs(now-c2)*D) + c + A;
                }
            }
        }
        /*for(auto P : cost){
            cout << P.first << " " << P.second << endl;
        }*/
        ans.push_back(cost[X]);
    }
    for(long long OUTPUT : ans) cout << OUTPUT << endl;
}


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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef vector<bool> VB;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) LL((a).size())

#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define ROF(i,a,b) for(LL i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL LARGE_INT = 1e9+100;
const LL INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const LL MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL a,b,c,d;cin>>a>>b>>c>>d;
    cout<<b-c<<endl;

	return;
}

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

#include<iostream>
using namespace std;

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


// Author : heyuhhh
// Created Time : 2020/11/11 10:33:54
#include<bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head

struct node {
    ll i, v;
};

map<ll, ll> mp[51];

void run() {
    int n;
    ll x;
    cin >> n >> x;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    queue<node> que;
    que.push({0, x});
    mp[0][x] = 1;
    ll ans = 0;
    while (!que.empty()) {
        node cur = que.front(); que.pop();
        int i = cur.i;
        ll v = cur.v;
        if (mp[i].find(v) == mp[i].end()) {
            continue;
        }
        ll res = mp[i][v];
        mp[i].erase(v);
        if (i + 1 == n) {
            ans += res;
            continue;
        }
        // a[i + 1] | (v + k * a[i])
        ll nd = a[i + 1];
        ll t1 = v / nd * nd, t2 = (v + nd - 1) / nd * nd;

        if ((v - t1) % a[i] == 0) {
            mp[i + 1][t1] += res;
            que.push({i + 1, t1});
        }

        if (t1 != t2) {
            if ((t2 - v) % a[i] == 0) {
                mp[i + 1][t2] += res;
                que.push({i + 1, t2});
            }
        }
    }
    cout << ans << '\n';
}
int main() {
#ifdef Local
    freopen("input.in", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 5e5 + 5;
const ll MOD = 1e9+7;

int parent[N];

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

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

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
    }
    return res;
}

int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

int msbPos(int n) {
    if(n == 0) return 0;
    int msbPos = 0;
    n /= 2;
    while(n != 0) {
        n /= 2;
        msbPos++;
    }
    return msbPos;
}

void solve() {
    int a, b;
    cin >> a >> b;
    int y = (a - b) / 2;
    int x = a - y;
    cout << x << " " << y << endl;
    return;
}

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


#include<bits/stdc++.h>
#define N 1005
using namespace std;
int n,m,f[N][N],ans=-1;
struct z{
	int to,w;
};vector<z>b[N];
queue<z>q;
bool ok[N][N];
void bfs(){
	memset(f,-1,sizeof(f)),f[1][n]=0,q.push((z){1,n});
	while(!q.empty()){
		int x=q.front().to,y=q.front().w;q.pop();
		if(~ans&&ans<=f[x][y]*2)break;
		if(x==y){ans=f[x][y]*2;break;}
		if(ok[x][y])ans=f[x][y]*2+1;
		for(int i=0;i<b[x].size();i++)for(int j=0;j<b[y].size();j++)if(b[x][i].w==b[y][j].w){
			int A=b[x][i].to,B=b[y][j].to;
			if(f[A][B]<0)f[A][B]=f[x][y]+1,q.push((z){A,B});
		}
	}cout<<ans;
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x,y;char s[2];
		scanf("%d%d%s",&x,&y,s);b[x].push_back((z){y,(int)s[0]}),b[y].push_back((z){x,(int)s[0]});ok[x][y]=1,ok[y][x]=1;
	}bfs();
}

#include<bits/stdc++.h>
using namespace std;
const int N=505;
int f[N][N];
int a[N][N],b[N][N];
struct qw{
	int x,y,v;
	bool operator < (const qw &w) const
	{
		return v>w.v;
	}
};
priority_queue<qw> heap;
int vis[N][N];
int n,m;
int check(int x,int y)
{
	if(x<1||x>n||y<1||y>m) return 0;
	return 1;
}
void dij()
{
	int nx,ny;
	while(heap.size())
	{
		qw t=heap.top();
		heap.pop();
		int x=t.x,y=t.y;
		if(x==n&&y==m) break;
		if(vis[x][y]) continue;
		vis[x][y]=1;
		nx=x,ny=y+1;
		if(check(nx,ny)&&f[nx][ny]>f[x][y]+a[x][y])
		{
			f[nx][ny]=f[x][y]+a[x][y];
			heap.push((qw){nx,ny,f[nx][ny]});
		}
		nx=x,ny=y-1;
		if(check(nx,ny)&&f[nx][ny]>f[x][y]+a[x][y-1])
		{
			f[nx][ny]=f[x][y]+a[x][y-1];
			heap.push((qw){nx,ny,f[nx][ny]});
		}
		nx=x+1,ny=y;
		if(check(nx,ny)&&f[nx][ny]>f[x][y]+b[x][y])
		{
			f[nx][ny]=f[x][y]+b[x][y];
			heap.push((qw){nx,ny,f[nx][ny]});
		}
		for(int i=1;i<x;i++)
		if(f[x-i][y]>f[x][y]+i+1)
		{
			f[x-i][y]=f[x][y]+i+1;
			heap.push((qw){x-i,y,f[x-i][y]});
		}
	}
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m-1;j++)
	scanf("%d",&a[i][j]);
	for(int i=1;i<=n-1;i++)
	for(int j=1;j<=m;j++)
	scanf("%d",&b[i][j]);
	memset(f,0x3f,sizeof(f));
	f[1][1]=0;
	heap.push((qw){1,1,0});
	dij();
	cout<<f[n][m];
	return 0;
}


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

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

#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pii> vii;

#define INF 10000000000000000
#define inf 1000000000
// #define MOD  1000000007
#define MOD 998244353
#define PI 3.1415926535897932385

#define pb push_back
#define bitc __builtin_popcountll
#define mp make_pair
#define all(ar) ar.begin(), ar.end()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef godfather
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) uniform_int_distribution<int>(l, r)(rng32)
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ld modp(ld b, ll e) {
    ld ans=1; for(;e;b=b*b,e/=2) if(e&1) ans=ans*b; return ans; }

void solve()
{
    // START
    ll n;
    cin>>n;
    vi vec(n);
    rep(i,n)cin>>vec[i];
    sort(all(vec));
    ll ans=0;
    frr(i,n-1,0){
        ll z=vec[i];
        ll lg=n-i-1;
        ans+=i*z-lg*z;
    }
    cout<<ans<<"\n";
    // END
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   cout<<fixed;
    #ifdef godfather
        // cin.exceptions(cin.failbit);
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    fr(i,1,t)
    {
        solve();
    }
    end_routine();
}

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(ALL(a), greater<ll>());
    ll ans = 0;
    rep(i,n){
        ans += a[i]*(n-i-1);
        ans -= a[i]*i;
    }
    cout << ans << endl;
    return 0;
}


/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define ld double
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define F(i,a,b) for(ll i=a;i<b;i++)
//#include <ext/pb_ds/assoc_container.hpp> // policy based data structure header files
//#include <ext/pb_ds/tree_policy.hpp> // policy based data structure header files
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
//using namespace __gnu_pbds; // for pbds
//#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> // have functions like order_of_key, find_by_order
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781641;
const ll M=1e18;
const ll MAXN=100200;
void solve()
{
    vector<ll> v(3);
    F(i,0,3) {
        cin>>v[i];
    }
    sort(all(v));
    cout<<(v[1]+v[2]);
}
int main()
{
    IOS
    /*#ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE*/
    ll test=1;
    // cin>>test;
    F(t,1,test+1) {
        //cout<<"Case #"<<t<<": ";
        solve();
        nl
    }
    return 0;
}

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

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


 //----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef    long long                	 ll;
typedef    long double              	 ld;
typedef    unordered_set<ll>         	 usll;
typedef    unordered_multiset<ll>    	 umsll;
typedef    multiset<ll>              	 msll;
typedef    set<ll>                  	 sll;
typedef    vector<ll>               	 vll;
typedef    pair<ll,ll>              	 pll;
typedef    vector<pll>              	 vpll;
typedef    priority_queue<ll>       	 pqll;
typedef    vector<int>              	 vi;
typedef    set<int>                 	 si;
typedef    multiset<int>            	 msi;
typedef    unordered_multiset<int>  	 umsi;
typedef    unordered_set<int>       	 usi;
typedef    pair<int,int>               	 pi;
typedef    vector<pi>                	 vpi;
typedef    priority_queue<int>       	 pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_si;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_sll;
typedef    tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_msi;
typedef    tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_msll;
#define    in          		insert
#define    fi          		first
#define    se          		second
#define    pb   	    	push_back
#define    mp   	   		make_pair
#define    be   	   		begin
#define    en   	   		end
#define    itr  	   		iterator
#define    io  	       		ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   	   		1000000007
#define    inf  	   		8222372026854775807
#define    ninf   	   		-inf
#define    ima   	   		1147483647
#define    imi   	   		-ima
#define    oncnt       		__builtin_popcount
#define    zerobegin   		__builtin_clz
#define    zeroend    		__builtin_ctz
#define    parity      		__builtin_parity
#define    all(x)      		x.be(),x.en()
#define    eps         		1e-9
#define    coutd       		cout<<setprecision(10)<<fixed
#define    mems(dp,x)  		memset(dp,x,sizeof(dp))
#define    fbo         		find_by_order
#define    ook    	   		order_of_key
#define    upb    	   		upper_bound
#define    lowb  	   		lower_bound
#define    lte(v,x)    		(upb(all(v),x)-v.be())
#define    gte(v,x)    		(v.end()-lowb(all(v),x))
#define    gt(v,x)     		(v.en()-upb(all(v),x))
#define    lt(v,x)     		(lowb(all(v),x)-v.be())
const      ld PI= 			3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(x==0)return 0;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int main()
{               io
int testcases=1;            //           cin>>testcases;
/*preprocess begin*//*preprocess end*/
while(testcases--)
{

ll n;
cin>>n;
vll v;

for(ll i=1;i<=sqrt(n);i++)
{
	if(n%i==0)
	{
		ll k=n/i;
		v.pb(i);
		if(k!=i)
		v.pb(k);
	}
}

sort(all(v));
for(int i=0;i<v.size();i++)cout<<v[i]<<"\n";

}return 0;}

#include<bits/stdc++.h>
using namespace std;
#define MAXN 300005
#define lowbit(x) (x&-x)
#define reg register
#define mkpr make_pair
#define fir first
#define sec second
typedef long long LL;
typedef unsigned long long uLL;
const int INF=0x7f7f7f7f;
const LL jzm=2333;
const double Pi=acos(-1.0);
typedef pair<int,int> pii;
const double PI=acos(-1.0);
template<typename _T>
_T Fabs(_T x){return x<0?-x:x;}
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=getchar();
	while(s>'9'||s<'0'){if(s=='-')f=-1;s=getchar();}
	while('0'<=s&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=getchar();}
	x*=f;
}
template<typename _T>
void print(_T x){if(x<0){x=(~x)+1;putchar('-');}if(x>9)print(x/10);putchar(x%10+'0');}
int n,a[MAXN];LL ans;
map<LL,int> mp;
signed main(){
	read(n);for(int i=1;i<=n;i++)read(a[i]);LL sum=0;mp[0]++;
	for(int i=1;i<=n;i++){
		if(i&1)sum+=1ll*a[i];else sum-=1ll*a[i];
		ans+=mp[sum];mp[sum]++;
	}
	printf("%lld\n",ans);
	return 0;
}
/*
*/


// Problem: A - Slot
// Contest: AtCoder - AtCoder Beginner Contest 189
// URL: https://atcoder.jp/contests/abc189/tasks/abc189_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp(aa,bb) make_pair(aa,bb)
#define _for(i,b) for(int i=(0);i<(b);i++)
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#define mst(abc,bca) memset(abc,bca,sizeof abc)
#define X first
#define Y second
#define lowbit(a) (a&(-a))
#define debug(a) cout<<#a<<":"<<a<<"\n"
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef long double ld;
const int N=100010;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const double eps=1e-6;
const double PI=acos(-1.0);

void solve(){
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[0]==s[2]) cout<<"Won\n";
	else cout<<"Lost\n";
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
//	int t;cin>>t;while(t--)
	solve();
    return 0;
}

#include <iostream>
#include <string>

using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
 	string s;
 	cin>>s;
 	if(s.at(0)==s.at(1)&&s.at(0)==s.at(2))
 		cout<<"Won";
 	else
 		cout<<"Lost";
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi (3.141592653589)
#define mod 1000000007
#define pb push_back
#define f first
#define s second
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int arr[801][801];
int n,k;
bool check(int num)
{
    vector<vector<int> >v(n,vector<int>(n,0));
    for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
      {
        if(arr[i][j]<=num) v[i][j]=1;
      }
    }
    vector<vector<int> >dp(n+1,vector<int>(n+1,0));
    for(int i=1;i<=n;i++)
    {
      for(int j=1;j<=n;j++)
      {
         dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+v[i-1][j-1];
      }
    }
    for(int i=0;i+k<=n;i++){
        for(int j=0;j+k<=n;j++){
            int total = dp[i+k][j+k] - dp[i][j+k] - dp[i+k][j] + dp[i][j];
            if(total >= (k*k+1)/2) return true;
        }
    }
    return false;
}
void solve()
{

   cin>>n>>k;
   for(int i=0;i<n;i++)
   {
     for(int j=0;j<n;j++)
     {
       cin>>arr[i][j];
     }
   }
   int start=0,end=1e9+1,mid;
   while(start<end)
   {
      mid=(start+end)/2;
      if(check(mid)) end=mid;
      else start=mid+1;
   }
   cout<<end;
}
int main()
{
     fast
     int t;
     t=1;
     //cin>>t;
     while(t--)
     {
       solve();
     }
  return 0;
}

//Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
#define int ll
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 800 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
//constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
ll random(ll a, ll b){
    return a + rng() % (b - a + 1);
}
#ifndef LOCAL
#define cerr if(false) cerr
#endif
#define dbg(x) cerr << #x << " : " << x << endl;
#define dbgs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////

int N,K,g[MX][MX];

bool check(int k){
	int a[N][N];
	FOR(i,0,N) FOR(j,0,N) a[i][j]=(g[i][j]<=k);

	FOR(i,0,N) FOR(j,0,N){
		if(i) a[i][j]+=a[i-1][j];
		if(j) a[i][j]+=a[i][j-1];
		if(i&&j) a[i][j]-=a[i-1][j-1];
	}

	FOR(i,K-1,N) FOR(j,K-1,N){
		int x=a[i][j];
		if(i-K>=0) x-=a[i-K][j];
		if(j-K>=0) x-=a[i][j-K];
		if(i-K>=0 && j-K>=0) x+=a[i-K][j-K];

		if(x>=(K*K+1)/2) return 1;
	}
	return 0;
}

int32_t main() {
    boost; IO();

    cin>>N>>K;
    FOR(i,0,N) FOR(j,0,N) cin>>g[i][j];

    int l=0,r=INF,ans;
    while(l<=r){
    	int m=(l+r)/2;
    	if(check(m)){
    		ans=m;
    		r=m-1;
    	}
    	else l=m+1;
    }
    cout << ans << endl;

    return 0;
}
//Change your approach


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

//a枚ある金貨がn回で100枚になって終わる確率
long double prob(int n, int a, int b, int c){
	int u = 100 - a;
	if(u > n) return(0.0);
	if(n - u > (99-b) + (99-c)) return(0.0);

	long double p = 1.0;
	for(int i=0; i<u; i++){ p *= ((long double)(a+i)/(long double)(a+b+c+i)); }
	long double ret = 0.0;
	for(int v = 0; v<=n-u; v++){
		int w = n - u - v;
		long double s = 1.0;
		if(v+b > 99 || w+c > 99) continue;
		for(int j=0; j<v; j++){ s *= ((long double)(b+j)/(long double)(a+b+c+u+j)); }
		for(int j=0; j<w; j++){ s *= ((long double)(c+j)/(long double)(a+b+c+u+v+j)); }
		long double h = 1.0;
		for(int j=v; j>=1; j--){ h *= ((long double)(u-1+j)/(long double)j); }
		for(int j=w; j>=1; j--){ h *= ((long double)(u-1+v+j)/(long double)j); }
		ret += (p*s*h);
	}
	return ret;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int A, B, C; cin >> A >> B >> C;
	long double ans = 0.0;
	for(int n=1; n<=300; n++){
		long double pa = prob(n, A, B, C);
		long double pb = prob(n, B, C, A);
		long double pc = prob(n, C, A, B);
		ans += n*(pa + pb + pc);
	}
	printf("%.12Lf\n", ans);
	return 0;
}

#include <iostream>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>

using namespace std;
const int INF = 1 * (1 << 30);
const int mINF = -1 * (1 << 30);

int main()
{
  double ans = 0;
  int n, d, h;
  cin >> n >> d >> h;
  for (int i = 0; i < n; i++)
  {
    int d_i, h_i;
    cin >> d_i >> h_i;
    double b = (double)h - (double)d * (double)(h - h_i) / (double)(d - d_i);
    ans = max((double)ans, b);
  }
  cout << ans << endl;
  return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

//#define	INF (1<<30)
#define	INF (2147483647)
// 2^31 -1
//= 1,073,741,824 *2 -1
//=   536,870,912 *4 -1

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

#define MPl(x, y)	((((x)+(y))%MOD+MOD)%MOD)
#define MMi(x, y)	((((x)-(y))%MOD+MOD)%MOD)
#define MMul(x, y)	((((x)*(y))%MOD+MOD)%MOD)

int	main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll H, W;
	cin >>H >>W;
	vector<vector<int>> S(H+2, vector<int> (W+2, 1));
	Rep1(i, H) {
		string s;
		cin >>s;
		Rep1(j, W) {
			if ('.'==s.at(j-1))
				S.at(i).at(j)=0;
		}
	}
	vector<vector<ll>> DP(H+2, vector<ll> (W+2, 0));
	DP.at(1).at(1)=1;
	vector<vector<ll>> X(H+2, vector<ll> (W+2, 0));
	vector<vector<ll>> Y(H+2, vector<ll> (W+2, 0));
	vector<vector<ll>> Z(H+2, vector<ll> (W+2, 0));
	Rep1(i, H)
		Rep1(j, W) {
			if ((1==i)&&(1==j))
				continue;
			if (1==S.at(i).at(j))
				continue;
			ll D=DP.at(i).at(j);
			// Right
			X.at(i).at(j)=MPl(X.at(i).at(j-1), DP.at(i).at(j-1));
			// Down
			Y.at(i).at(j)=MPl(Y.at(i-1).at(j), DP.at(i-1).at(j));
			// RightDown
			Z.at(i).at(j)=MPl(Z.at(i-1).at(j-1), DP.at(i-1).at(j-1));
			DP.at(i).at(j)=MPl(X.at(i).at(j), MPl(Y.at(i).at(j), Z.at(i).at(j)));
		}
	cout <<DP.at(H).at(W) <<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vec vector
#define rep(i,n) for (int i=0; i<(n); i++)
#define print(a) cout << a << endl
#define fix(n) fixed << setprecision(n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define Yes "Yes"
#define YES "YES"
#define No "No"
#define NO "NO"

const ll mod = 1e9+7;
struct mint {
  ll x;
  mint(ll x=0) : x((x%mod+mod)%mod) {}
  mint &operator+=(const mint &p) { if((x += p.x) >= mod) x -= mod; return *this; }
  mint &operator-=(const mint &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
  mint &operator*=(const mint &p) { x = x * p.x % mod; return *this; }
  mint &operator/=(const mint &p) { *this *= p.inverse(); return *this; }
  mint operator-() const { return mint(-x); }
  mint operator+(const mint &p) const { return mint(*this) += p; }
  friend mint operator+(const int &c,const mint &p) { return mint(c) += p; }
  mint operator-(const mint &p) const { return mint(*this) -= p; }
  friend mint operator-(const int &c,const mint &p) { return mint(c) -= p; }
  mint operator*(const mint &p) const { return mint(*this) *= p; }
  friend mint operator*(const int &c,const mint &p) { return mint(c) *= p; }
  mint operator/(const mint &p) const { return mint(*this) /= p; }
  friend mint operator/(const int &c,const mint &p) { return mint(c) /= p; }
  bool operator==(const mint &p) const { return x == p.x; }
  friend bool operator==(const int &c,const mint &p) { return mint(c) == p; }
  bool operator!=(const mint &p) const { return x != p.x; }
  friend bool operator!=(const int &c, const mint &p) { return mint(c) != p; }
  mint inverse() const {
    ll a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return mint(u);
  }
  mint pow(ll n) const {
    mint ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os,const mint &p) { return os << p.x; }
  friend istream &operator>>(istream &is,mint &a) {
    ll t;
    is >> t;
    a = mint(t);
    return (is);
  }
};

int main() {
  int H,W;
  cin >> H >> W;
  vec<string> S(H);
  vec<vec<vec<mint>>> dp(H, vec<vec<mint>>(W, vec<mint>(4)));
  dp[H-1][W-1][0]=1;
  rep(i,H) {
    cin >> S[i];
  }
  for (int i=H-1; i>=0; i--) {
    for (int j=W-1; j>=0; j--) {
      if (S[i][j] == '#')
        continue;
      if (i!=H-1 && S[i+1][j]!='#')
        dp[i][j][0] += dp[i+1][j][1];
      if (j!=W-1 && S[i][j+1]!='#')
        dp[i][j][0] += dp[i][j+1][2];
      if (i!=H-1 && j!=W-1 && S[i+1][j+1]!='#')
        dp[i][j][0] += dp[i+1][j+1][3];
      for (int k=1; k<4; k++)
        dp[i][j][k] = dp[i][j][0];
      if (i!=H-1 && S[i+1][j]!='#')
        dp[i][j][1] += dp[i+1][j][1];
      if (j!=W-1 && S[i][j+1]!='#')
        dp[i][j][2] += dp[i][j+1][2];
      if (i!=H-1 && j!=W-1 && S[i+1][j+1]!='#')
        dp[i][j][3] += dp[i+1][j+1][3];
    }
  }
  print(dp[0][0][0]);
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
	long long a, b;

	cin >> a >> b;

	for (int i = 1; i <= a; ++ i)
	{
		if ((a - i) * i > b)
		{
			cout <<	"No" << endl;
			break;
		}

		if ((a - i) * i == b)
		{
			cout << "Yes" << endl;

			break;
		}
	}

	return 0;
}

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void*wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T> inline void walloc1d(T **arr, int x1, int x2, void **mem = &wmem){
  walloc1d(arr, x2-x1, mem);
  (*arr) -= x1;
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
template<class T> int Factor_L(T N, T fac[], int fs[]){
  T i;
  int sz = 0;
  if(N%2==0){
    fac[sz] = 2;
    fs[sz] = 1;
    N /= 2;
    while(N%2==0){
      N /= 2;
      fs[sz]++;
    }
    sz++;
  }
  for(i=3;i*i<=N;i+=2){
    if(N%i==0){
      fac[sz] = i;
      fs[sz] = 1;
      N /= i;
      while(N%i==0){
        N /= i;
        fs[sz]++;
      }
      sz++;
    }
  }
  if(N > 1){
    fac[sz] = N;
    fs[sz] = 1;
    sz++;
  }
  return sz;
}
template<class T> int Divisor_L(T N, T res[], void *mem = wmem){
  int i;
  int j;
  int k;
  int s;
  int sz = 0;
  T*fc;
  int*fs;
  int fsz;
  walloc1d(&fc, 100, &mem);
  walloc1d(&fs, 100, &mem);
  fsz =Factor_L(N, fc, fs);
  res[sz++] = 1;
  for(i=(0);i<(fsz);i++){
    s = sz;
    k = s * fs[i];
    for(j=(0);j<(k);j++){
      res[sz++] = res[j] * fc[i];
    }
  }
  sort(res, res+sz);
  return sz;
}
int ys;
long long y[100000];
int main(){
  int i;
  wmem = memarr;
  long long S;
  rd(S);
  long long P;
  rd(P);
  ys =Divisor_L(P, y);
  for(i=(0);i<(ys);i++){
    if(y[i] + (P/y[i]) == S){
      wt_L("Yes");
      wt_L('\n');
      return 0;
    }
  }
  wt_L("No");
  wt_L('\n');
  return 0;
}
// cLay version 20201121-1

// --- original code ---
// int ys; ll y[1d5];
// {
//   ll @S, @P;
//   ys = Divisor(P, y);
//   rep(i,ys) if(y[i] + (P/y[i]) == S) wt("Yes"), return 0;
//   wt("No");
// }


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

#define fi first
#define se second

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

ll t, a, b;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> t;
    ll ans = 0;
    while (t--) {
        cin >> a >> b;
        ans += b*(b+1)/2 - (a-1)*a/2;
    }
    cout << ans << '\n';
    return 0;
}

#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define rep(i, n) FOR(i,0,n)
#define irep(i, n) IFOR(i,0,n)
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
using VI = vector<int>;
using VLL = vector<ll>;
using VB = vector<bool>;
using VP = vector<P>;
using Graph = vector<vector<int>>;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;}
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; }
bool second_compare(P a,P b){if(a.second!=b.second){return a.second<b.second;} else return true;}

int main() {
    int n;
    cin >> n;
    double ans = 0;
    FOR(i, 1, n) {
        ans += ((double)n / i);
    }
    printf("%.10f\n", ans);
    return 0;
}


#include<bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <chrono>
#include <complex>
using namespace std;
#define ll long long
#define ld long double
#define ui unsigned int
#define ull unsigned ll
#define mp                   make_pair
#define eb                   emplace_back
#define pb                   push_back
#define pf                   push_front
#define popb                 pop_back
#define popf                 pop_front
#define hashmap              unordered_map
#define hashset              unordered_set
#define lb                   lower_bound
#define ub                   upper_bound
#define all(a)               (a).begin(), (a).end()
#define rall(a)              (a).rbegin(), (a).rend()
#define ff                   first
#define ss                   second
#define foi(n) for(ll i=0;i<n;i++)
#define foj(n) for(ll j=0;j<n;j++)
#define fok(n) for(ll k=0;k<n;k++)
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define forrr(i,b,a) for(ll i=b;i>=a;i--)
#define forrrr(i,a,b,k) for(ll i=a;i<b;i=i+k)
#define graph          vector<vector<int>>
#define sz(v) v.size()
typedef pair<int, int> pii;
typedef pair<ll, ll>   pll;
typedef vector<int>         vi;
typedef vector<ll>          vll;
typedef vector<string>      vs;
typedef vector<double>      vd;
typedef vector<pii>         vpii;
typedef vector<pll>         vpll;
typedef pair< ll, pll>      plll;
typedef vector<plll>      vplll;
typedef  vector<string> 	     vs;
typedef  vector<char>	         vc;
typedef  vector<bool>            vb;
typedef  map<string, int>         msi;
typedef  map<int, int>	         mii;
typedef  map<ll, ll>             mll;
typedef  map<char, int>           mci;
typedef  map<int, string>	     mis;
typedef  pair<string, int>       psi;
typedef  pair<string, string>    pss;
typedef priority_queue <ll> pq;
typedef priority_queue<pii, vector<pii>, greater<pii> > pqq;
const ll MOD = 1000000007;
void solve();
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("error1.txt", "w", stderr);
	freopen("output1.txt", "w", stdout);
#endif

//	ll t ; cin >> t;
//	while (t--)
	{
		solve();
		cout << "\n";
	}

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
	return 0;
}
ll ceils(ll x, ll y) {
	return x / y + ((x % y) != 0);
}
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

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

}
void solve() {
	ll t, n;
	cin >> t >> n;

	vll ans;
	for (ll i = 1; i <= 100; ++i) {
		ll a = (100 + t) * (i - 1) / 100;
		ll b = (100 + t) * i / 100;
		if (b - a == 2)
			ans.pb(a + 1);
	}
	n--;
	cout << (100 + t) * (n / t) + ans[n % t];

}

#include <bits/stdc++.h>
// #define x first
// #define y second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int n, t;

int main()
{
	IOS; cin >> t >> n;
	cout << (100ll * n + t - 1) / t + n - 1 << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, w;
    scanf("%d %d", &n, &w);
    printf("%d\n", n / w);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 1000000005
#define INFLL (ll)1000000000000000005
#define PI 3.1415926535897
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
#define per(a,mod) ((a)%(mod)+(mod))%(mod)
typedef pair<int,int> P;
const int MAX = (1<<20);
const int MOD = 1000000007;

void solve(){
    int n,w;
    cin>>n>>w;
    OUT(n/w);

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


#include<bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const ld EPS = 1e-9;
signed main() {
	cout << fixed << setprecision(15);
	ld x, y, r; cin >> x >> y >> r;
	if (x >= 0) { x += EPS; } else { x -= EPS; }
	if (y >= 0) { y += EPS; } else { y -= EPS; } r+=EPS;
	ll bai = 10000, ans = 0;
  	ll xbai = x * bai, ybai = y * bai, rbai = r * 10000;//rbai++;
  //cout<<xbai<<' '<<ybai<<' '<<rbai<<endl;
	for (int i = 0 - 200000; i <= 200000; i++) {
		if (abs(i - x) > r) { continue; }
		ll cnt = 0, ibai = i * bai;
		//下をにぶたん
		ll ok = -200001, ng = (ll)y + 1, mid = (ok + ng) / 2;
		while (ng - ok > 1) {
			//cout << i << ' ' << mid << ' ' << (ll)pow(abs(ibai - xbai), 2) << ' ' << (ll)pow(abs(mid * bai - ybai), 2) << ' ' << (ll)pow(rbai, 2) << endl;
			if ((ll)pow(abs(ibai - xbai), 2) + (ll)pow(abs(mid * bai - ybai), 2) <= (ll)pow(rbai, 2)) {
				ng = mid;
			}
			else { ok = mid; }
			mid = (ok + ng) / 2;
		}
		cnt = ng;//cout<<i<<' '<<ng<<endl;
		//上をにぶたん
		ok = (ll)y; ng = 200001; mid = (ok + ng) / 2;
		while (ng - ok > 1) {
			//cout << i << ' ' << mid << ' ' << (ll)pow(abs(ibai - xbai), 2) << ' ' << (ll)pow(abs(mid * bai - ybai), 2) << ' ' << (ll)pow(rbai, 2) << endl;
			if ((ll)pow(abs(ibai - xbai), 2) + (ll)pow(abs(mid * bai - ybai), 2) <= (ll)pow(rbai, 2)) {
				ok = mid;
			}
			else { ng = mid; }
			mid = (ok + ng) / 2;
		}
		ans += ok - cnt + 1;
	}
	cout << ans << endl;
	return 0;
}

#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    auto read = [&]() {
        string s;
        cin >> s;

        int n = s.length();
        long long res = 0;
        int cnt = -12;
        for (auto c : s) {
            if (c == '.') {
                cnt = 0;
            } else {
                ++cnt;
                res = res * 10 + (c - '0');
            }
        }
        if (cnt < 0) {
            res *= 10000;
        } else {
            while (cnt < 4) {
                res *= 10;
                ++cnt;
            }
        }
        return res;
    };
    auto x = read();
    auto y = read();
    auto r = read();
    auto ceil = [&](long long p, long long q) {
        if (q < 0) {
            p = -p;
            q = -q;
        }
        if (p >= 0) {
            return (p + q - 1) / q * q;
        } else {
            return p / q * q;
        }
    };
    auto floor = [&](long long p, long long q) {
        if (q < 0) {
            p = -p;
            q = -q;
        }
        if (p >= 0) {
            return p / q * q;
        } else {
            return (p - (q - 1)) / q * q;
        }
    };

    auto calc = [&](long long x, long long y, long long r, long long h) {
        __int128 dy = y - h;
        dy = dy * dy;
        long long lo = 0, hi = r;
        __int128 d = r;
        d *= r;
        while (lo < hi) {
            auto mi = (lo + hi + 1) / 2;
            __int128 dx = mi;
            dx *= mi;
            if (dx + dy <= d) {
                lo = mi;
            } else {
                hi = mi - 1;
            }
        }
        __int128 dx = lo;
        dx *= lo;
        if (dx + dy <= d) {
            long long l = x - lo;
            long long r = x + lo;
            l = ceil(l, 10000) / 10000;
            r = floor(r, 10000) / 10000;
            if (l <= r) {
                return r - l + 1;
            }
        }
        return 0LL;
    };

    long long t = y + r;
    long long b = y - r;
    t = floor(t, 10000);
    b = ceil(b, 10000);
    // cout << t << " " << b << endl;
    long long res = 0;
    for (long long h = b; h <= t; h += 10000) {
        res += calc(x, y, r, h);
    }

    cout << res << '\n';

    return 0;
}


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

#define fi first
#define se second
#define rng(i, a, b) for (int i=int(a);i<int(b);++i)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i=int(b)-1;i>=int(a);--i)
#define per(i, b) gnr(i, 0, b)
#define all(obj) begin(obj), end(obj)
#define allr(obj) rbegin(obj), rend(obj)
#define cinv(a) rep(i,(int)a.size()) cin >> a[i]
#define debug(a) rep(i,(int)a.size()) cout << a[i] << " "
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define dame {puts("-1"); return 0;}
typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<Pi> vp;
typedef vector<vp> vvp;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;

template<typename T>
bool chmax(T& a, const T& b){if(a < b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a, const T& b){if(a > b){a=b;return true;}return false;}
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int di[] = {0, -1, 0, 1};
const int dj[] = {1, 0, -1, 0};
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e15;
const double eps = 1e-10;
const char nl = '\n';

ll power(ll a, ll b) {return b? power(a*a%MOD, b/2)*(b%2?a:1)%MOD:1;}

ll nCk(int n, int k)
{
	ll x = 1, y = 1;
	for (int i = 1; i <= k; ++i)
	{
		x = x*(n-i+1)%MOD;
		y = y*i%MOD;
	}
	return x*power(y, MOD-2)%MOD;
}

struct UF
{
	vi d;
	UF(int n) : d(n, -1) {}
	int root(int x)
	{
		if (d[x] < 0) return x;
		return d[x] = root(d[x]);
	}
	bool unite(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (d[x] > d[y]) swap(x, y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int size(int x) { return -d[root(x)]; }
};

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	double r, x, y; cin >> r >> x >> y;
	double d = sqrt(x*x + y*y);
	cout << (d < r ? 2 : ceil(d/r)) << nl;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <iterator>
#include <set>
#include <map>
#include <stack>
using std::cout;
using std::cin;
using std::string;
using std::vector;
using std::endl;

int main()
{
    double r, x, y;
    cin >> r >> x >> y;
    int ans = (int)std::ceil(sqrt(x * x + y * y)/r);
    if (ans == 1 && x * x + y * y != r * r) ans = 2;
    cout << ans;

    return 0;
}