#include<bits/stdc++.h>

using i28 = __int128_t;

using namespace std;
// using i28 = long long;
using pint = pair<i28,i28>;
const i28 G = 10000;
const i28 lim = 2e9;
// #include"debug.hpp"

ostream &operator<<(ostream &dest, __int128_t value) {
  ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < (int)s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}

istream &operator>>(istream &is, __int128_t &a){
	string s;
	is>>s;
	a = parse(s);
	return (is);
}
// using Int = __int128_t;

i28 in() {
	string s; cin >> s;

	auto itr = find(s.begin(), s.end(), '.');
	if(itr == s.end()) return stoi(s) * G;
	i28 idx = s.end() - itr;
	s.erase(itr);
	if(count(s.begin(), s.end(), '0') == (i28)s.size()) return 0;
	while(s.front() == '0') s.erase(s.begin());
	i28 x = stoi(s);
	i28 coef = 1;
	for(i28 i = 0; i < 5 - idx; i++)coef *= 10;
	return x * coef;
}

i28 f(i28 rem, i28 y) {
	i28 lower, upper;
	{ //lower
		i28 lef = -1e18, rig = y; //xxxxooo
		while(rig - lef  > 1) {
			i28 mid = (lef + rig) / 2;
			(mid * (mid - 2 * y) <= rem ? rig : lef) = mid;
		}
		lower = rig;
	}
	{
		i28 lef = y, rig = 1e18; //oooooxxx
		while(rig - lef > 1) {
			i28 mid = (lef + rig) / 2;
			(mid * (mid - 2 * y) <= rem ? lef : rig) = mid;
		}
		upper = lef;
	}

	auto myci = [&](i28 num) {
		if(num <= 0) return -(-num + G - 1) / G;
		else return num / G;
	};

	i28 lownum = myci(lower-1);
	i28 uppnum = myci(upper);
	// print(lower, upper, lownum, uppnum);

	return uppnum - lownum;
}

int main()
{
	i28 x, y, r;
	x = in();
	y = in();
	r = in();
	// print(x, y, r);

	i28 r2 = (i28)r * r;
	i28 num = 0;
	for(i28 t1 = -lim; t1 <= lim; t1 += G) {
		i28 xa = (i28)(t1 - x) * (t1 - x);
		if(xa > r2) continue;
		// print(t1);
		i28 rem = r2 - xa;
		// print(rem);
		rem -= (i28)y * y;

		num += f(rem, y);
		// print(num, rem);
	}

	cout << num << endl;

}

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>
#include <time.h>
#include <unordered_map>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

using namespace std;
using ll = long long;
typedef std::pair<int, int> pii;
typedef std::pair<int, double> pid;
typedef std::vector<int> vi;
typedef std::vector<pii> vii;
#define PI 3.14159265358979323846264338327950L

const int mod = 1000000007;

struct container{
    int bottom, top, id;
    container(int id, int bottom, int top): top(top), bottom(bottom),id(id){
    }
};

struct Data {
    int ind;
    ll time;
    Data(int ind,ll time): ind(ind),time(time){}
    bool operator<(const Data& a) const {
    return time > a.time;
    }
};

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

    string s;
    cin >> s;

    n = s.size();

    int cnt = 0;
    string cur;

    for(int i = 0; i < n; i++){
        cur += s[i];
        while (cur.size()>=3 && cur.substr(cur.size()-3) == "fox"){
            cur.pop_back();
            cur.pop_back();
            cur.pop_back();
            cnt++;
        }
    }

    cout << n-cnt*3;
}

int main() {
    int T = 1;
    //cin >> T;

    while (T--){
        solve();
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef int int2;
#define int long long
#define pi pair<int, int>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
const int inf = 1e18;

int t;
const int maxn = 2e5 + 5;
int a[maxn], suf[maxn];

int2 main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1;i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    suf[n] = a[n];
    for (int i = n - 1; i >= 1; i--) {
        suf[i] = suf[i + 1] + a[i];
    }
    int ans = 0;
    for (int i = 1; i < n; i++) {
        ans += suf[i + 1] - (n - i) * a[i];
    }
    cout << ans << "\n";
}

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int n;
    cin>>n;
    ll ans=0;
    while(n--)
    {
        ll a,b;
        cin>>a>>b;
        ans+=b*(b+1)/2-a*(a-1)/2;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b, x, y;
  cin >> a >> b >> x >> y;
  const int y_ = min(y, x + x);
  a = 2 * a;
  b = 2 * b + 1;
  int d = abs(a - b);
  cout << d / 2 * y_ + d % 2 * x << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;
template <typename T> using lqueue = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using gqueue = priority_queue<T, vector<T>, less<T>>;

int main() {
    constexpr int A = 0, B = 1;

    int a, b, x, y; cin >> a >> b >> x >> y; --a; --b;
    auto edges = [=](int b, int n) -> array<array<int, 3>, 4> {
        if (b == A) {
            return {{
                { x, B, n }, { x, B, n - 1 }, { y, A, n - 1 }, { y, A, n + 1 },
            }};
        }
        else {
            return {{
                { x, A, n }, { x, A, n + 1 }, { y, B, n - 1 }, { y, B, n + 1 },
            }};
        }
    };

    array<array<int, 100>, 2> dist;
    lqueue<array<int, 3>> que;
    for (auto &e1 : dist) for (auto &e2 : e1) e2 = -1;
    que.push({ 0, A, a });

    while (!que.empty()) {
        auto [c, b, n] = que.top(); que.pop();
        if (dist[b][n] != -1) continue;
        dist[b][n] = c;

        for (auto [nc, nb, nn] : edges(b, n)) {
            if (nn < 0 || 99 < nn) continue;
            que.push({ c + nc, nb, nn });
        }
    }

    cout << dist[B][b] << endl;
}


/*
**    author : Dhiraj Govindvira
**      date : 08 May 2021 ~ Saturday
**      time : 05:35:49 PM
*/

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

#ifdef DHIRAJ
    #include "D:/dhiraj/Programming/debug.h"
#else
    #define dbg(...) 1
    #define cerr if(0) cerr
#endif

using ll = long long int;
#define endl '\n'

template <typename T, typename U>
inline istream & operator >> (istream &in, pair<T, U> &p) {
    in >> p.first >> p.second;
    return in;
}
template <typename T>
inline istream & operator >> (istream &in, vector<T> &v) {
    for(T &x : v) in >> x;
    return in;
}

// count total non empty subset with given sum

const ll MX = 202;
ll n;
ll a[MX];
ll dp[MX][MX];

const ll MOD = 200;
inline ll md(ll x, ll M = MOD)
{
    x %= M;
    return ((x < 0) ? (x + M) : x);
}

ll rec(ll item, ll sum)
{
    assert(sum < 200);
    if(item == 0) return sum == 0;
    ll &ans = dp[item][sum];
    if(ans != -1) return ans;
    ans = 0;
    ans += rec(item - 1, md(sum - a[item]));
    ans += rec(item - 1, sum);
    ans = min(5ll, ans);
    return ans;
}

void f1(ll item, ll sum, vector<ll> &v)
{
    if(item == 0) {
        return;
    }
    if(v.empty() and rec(item - 1, a[item]) > 1) {
        v.push_back(item);
        f1(item - 1, md(sum - a[item]), v);
    }
    else if(rec(item - 1, sum)) {
        f1(item - 1, sum, v);
    }
    else {
        v.push_back(item);
        f1(item - 1, md(sum - a[item]), v);
    }
}
void f2(ll item, ll sum, vector<ll> &v)
{
    if(item == 0) {
        return;
    }
    if(rec(item - 1, md(sum - a[item]))) {
        v.push_back(item);
        f2(item - 1, md(sum - a[item]), v);
    }
    else {
        f2(item - 1, sum, v);
    }
}

void solve(ll &tc)
{
    cin >> n;
    for(ll i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] = md(a[i]);
    }

    memset(dp, -1, sizeof(dp));
    for(ll i = 0; i < 200; i++)
    {
        ll cnt = rec(n, i);
        assert(cnt >= 0);
        if(i == 0) cnt--;
        if(cnt > 1)
        {
            vector<ll> b, c;
            f1(n, i, b);
            f2(n, i, c);

            ll sm1 = 0;
            for(ll x : b) {
                sm1 += a[x];
                sm1 = md(sm1);
            }
            ll sm2 = 0;
            for(ll x : c) {
                sm2 += a[x];
                sm2 = md(sm2);
            }

            sort(b.begin(), b.end());
            sort(c.begin(), c.end());

            if(!b.empty() and !c.empty() and b != c and sm1 == i and sm2 == i) {
                cout << "Yes\n";
                cout << b.size() << " ";
                for(auto &X : b) {
                    cout << X << " ";
                }
                cout << endl;
                cout << c.size() << " ";
                for(auto &X : c) {
                    cout << X << " ";
                }
                cout << endl;
                return;
            }
        }
    }
    cout << "No\n";
}

int main()
{
    #ifdef DHIRAJ
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

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

    ll rep = 3;
    while(rep--) {
        ll tc = 1;
        for(ll i = 1; i <= tc; i++) {
            cerr << "Case #" << i << "\n";
            solve(i);
        }
        if(dbg()) break;
    }
    return 0;
}

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define rf(i, a, b) for (ll i = a; i >= b; i--)
typedef std::vector<long long> vi;
#define F first
#define S second
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(), a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
const ll INF = LLONG_MAX / 2;
const ll N = 2e5 + 1;
using namespace std;
void solve()
{
    ll n;
    cin >> n;
    ll a[n];
    map<ll, ll> mp;
    ll ans = -1;
    fr(i, 0, n)
    {
        cin >> a[i];
        a[i] = a[i] % 200;
        mp[a[i]]++;
        if (mp[a[i]] > 1)
        {
            ans = a[i];
            break;
        }
    }
    if (ans != -1)
    {
        cout << "Yes\n";
        ll co = 0;
        fr(i, 0, n)
        {
            if (a[i] == ans)
            {
                co++;
                cout << "1 " << i + 1 << "\n";
                if (co == 2)
                    return;
            }
        }
    }
    else
    {
        map<ll, vi> mp;
        for (ll i = 0; i < min((2 << n), 201); i++)
        {
            vi subset;
            ll sum = 0;
            fr(j, 0, n)
            {
                ll c = 1 << j;
                if (c & i)
                {
                    subset.PB(j);
                    sum = (sum + a[j]) % 200;
                }
            }
            if (subset.size() == 0)
                continue;
            if (mp.find(sum) == mp.end())
                mp[sum] = subset;
            else if (subset != mp[sum])
            {
                // cout << sum << "\n";
                cout << "Yes\n";
                cout << mp[sum].size() << " ";
                fr(i, 0, mp[sum].size())
                        cout
                    << mp[sum][i] + 1 << " ";
                cout << "\n";
                cout << subset.size() << " ";
                fr(i, 0, subset.size())
                        cout
                    << subset[i] + 1 << " ";
                cout << "\n";
                return;
            }
        }

        cout << "No\n";
        return;
    }
}
int main()
{
    fast;
    ll t = 1;
    //    std::cin >> t;
    while (t--)
    {
        solve();
    }
}


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

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

void scan()
{
  return;
}

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

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

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

template<typename T>
void println(T n)
{
  print(n);
  print('\n');
  return;
}

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

template<typename T>
void print_array(T start,T end)
{
  T now=start;
  print(*now);
  ++now;
  for(;now!=end;++now)
  {
    print(' ');
    print(*now);
  }
  print('\n');
  return;
}

i64 pow_mod(i64 a,i64 n,i64 mod)
{
  i64 res=1,now=a;
  while(n)
  {
    if(n&1)
    {
      res=res*now%mod;
    }
    now=now*now%mod;
    n>>=1;
  }
  return res;
}

i64 inv_mod(i64 a,i64 mod)
{
  return pow_mod(a,mod-2,mod);
}

i64 power(i64 a,i64 n)
{
  i64 res=1;
  for(i64 i=0;i<n;++i)
  {
    res*=a;
  }
  return res;
}

bool is_prime(i64 N)
{
  if(N<2)
  {
    return 0;
  }
  for(i64 i=2;i*i<=N;++i)
  {
    if(N%i==0)
    {
      return 0;
    }
  }
  return 1;
}

struct combination
{
  vector<i64> fact,inv,fact_inv;
  i64 mod=-1;
  combination(int Max,const i64 mod_):fact(Max+1,1),inv(Max+1,1),fact_inv(Max+1,1)
  {
    mod=mod_;
    for(i64 i=2;i<=Max;++i)
    {
      fact[i]=fact[i-1]*i%mod;
      inv[i]=mod-(mod/i*inv[mod%i]%mod);
      fact_inv[i]=fact_inv[i-1]*inv[i]%mod;
    }
  }
  i64 nCk(i64 n,i64 k)
  {
    if(n<k)
    {
      return 0;
    }
    return fact[n]*fact_inv[k]%mod*fact_inv[n-k]%mod;
  }
};

i64 comb(i64 n,i64 k)
{
  if(n<k)
  {
    return 0;
  }
  i64 res=1;
  for(i64 i=1;i<=k;++i)
  {
    res*=n-i+1;
    res/=i;
  }
  return res;
}

int main()
{
  string S;
  scan(S);
  reverse(S.begin(),S.end());
  for(size_t i=0;i<S.size();++i)
  {
    if(S[i]=='6')
    {
      S[i]='9';
      continue;
    }
    if(S[i]=='9')
    {
      S[i]='6';
    }
  }
  println(S);
  return 0;
}

#include <iostream>

using namespace std;
typedef long long ll;
const ll INF=2e18;

ll clamp(ll x, ll min, ll max) {
    if (x>max) {
        return max;
    }
    if (x<min) {
        return min;
    }
    return x;
}

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

    ll low=-INF;
    ll high=INF;
    ll bias=0;

    for (ll i=1; i<=n; i++) {
        ll a,t;
        cin>>a>>t;
        if (1==t) {
            low+=a;
            high+=a;
            bias+=a;
        } else if (2==t) {
            low=max(low, a);
            high=max(high,a);
        } else {
            low=min(low, a);
            high=min(high, a);
        }
    }

    ll q;
    cin>>q;
    for (ll i=1; i<=q; i++) {
        ll x;
        cin>>x;
        cout<<clamp(x+bias, low, high)<<"\n";
    }

    return 0;
}


/*
      @author : ashnove
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long double
#define F first
#define S second
#define Th third
// #define endl "\n"
#define nl cout << endl;
#define pb push_back
#define f(i, a, b) for (ll i = a; i < b; i++)
#define what_is(x) cerr << #x << " is " << x << endl;
#define ar vector<ll>
#define mat vector<vector<ll>>
mat cn(ll n, ll m) {return vector<vector<ll>>(n, vector<ll>(m));}
bool comp1(char &allVal, char &s2) { return allVal > s2; }
bool comp2(const pair<ll, pair<ll, ll>> &a, const pair<ll, pair<ll, ll>> &b) {
      if (a.first > b.first)
            return 1;
      if (a.first == b.first && a.S.S > b.S.S)
            return 1;
      return 0;
}
class Pair { public: ll first, second;};
bool comp3(const Pair &a, const Pair &b) {
      if (a.F > b.F) return 1; return 0;
}
class Trips { public: ll first, second, third;};
bool comp4(const Trips &a, const Trips &b) {
      if (a.Th > b.Th) return 1; return 0;
}

ll const mod = 1e9 + 7;
ll const inf = 1e9;
ll const maxn = 5e5 + 1;

void solve()
{
      ll t = 1;
      // cin >> t;
      for (ll tt = 1; tt <= t; tt++) {
            string s; cin >> s;

            ll rev = 0;
            deque<char> ans;
            for(ll i = 0; i < s.size(); i++){

                  if(s[i] == 'R') rev^=1;
                  else{
                        if(rev){
                              ans.push_front(s[i]);
                        }
                        else ans.push_back(s[i]);
                  }

            }
            string res =  "";
            if(!rev){
                  map<char,ll> used;
                  while(!ans.empty()){
                        // if(used[ans.front()]) {ans.pop_front();continue;}
                        used[ans.front()] = 1;
                        res += ans.front();
                        ans.pop_front();
                  }
            }else{
                  map<char,ll> used;
                  while(!ans.empty()){
                        // if(used[ans.back()]) {ans.pop_back();continue;}
                        used[ans.back()] = 1;
                        res += ans.back();
                        ans.pop_back();
                  }
            }

            stack<char> ss;

            for(ll i = 0; i < res.size(); i++){

                  if(ss.empty())
                        ss.push(res[i]);
                  else{

                        bool ok = 0;
                        while(!ss.empty() && ss.top() == res[i])
                              ss.pop(), ok = 1;
                        if(!ok) ss.push(res[i]);

                  }

            }

            string pp = "";
            while(!ss.empty())
            {
                  pp+=ss.top(); ss.pop();
            }

            for(ll i = pp.size()-1; i >= 0; i--)
                  cout <<pp[i];
      }
}

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL); cout.tie(NULL);
      //*
#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
#endif/**/
      solve();
      // cout << "Case #" <<tt<<": ";
      // printf("TIME: %.3lf\n", double(clock()) / CLOCKS_PER_SEC);
      return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define PI 3.14159265359
#define mod 1000000007
#define ALL(a)  (a).begin(),(a).end()

int main(){
    string s;
    cin >> s;
    string a = "";
    string b = "";
    int count = 0;
    rep(i,s.size()){
        if(s[i] == 'R'){
            count++;
            continue;
        }
        if(count % 2 == 0){
            a+=s[i];
        }
        else{
            b+=s[i];
        }
    }
    reverse(ALL(b));
    b = b + a;
    if(count % 2 == 1)reverse(ALL(b));
    string ans = "";
    rep(i,b.size()){
        ans += b[i];
        if(ans[ans.size() -1] == ans[ans.size() -2] ){
            ans.pop_back();
            ans.pop_back();
        }
    }
    cout << ans << endl;
}


#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <cmath>

long long FindCentral(std::vector<std::vector<long long>> &A, long long K, long long si, long long sj, std::vector<long long> &AK)
{
    long long index = 0;

    for(long long i = si; i < (si + K); i++){
        for(long long j = sj; j < (sj + K); j++){
            AK[index] = A[j][i];
            index++;
        }
    }

    std::sort(AK.begin(), AK.end());
    //std::cout << AK[(K*K)/2 -1] << std::endl;

    long long t  = 0;
    if((((K*K)) % 2) == 0){
        t = -1;
    }

    return AK[(K*K)/2 + t];
}

long long FindCentral2(std::vector<std::vector<long long>> &A, long long K, long long si, long long sj, std::vector<long long> &AK, long long & index)
{
    for(long long j = sj; j < (sj + K); j++){
            AK[index] = A[j][si];
            index++;

            if(index == K*K){
                index = 0;
            }
    }

    std::sort(AK.begin(), AK.end());

    for(long long i = 0 ; i < K*K; i++){
        std::cout << AK[i] << " ";
    }
    long long t  = 0;
    if((((K*K)) % 2) == 0){
        t = -1;
    }

    std::cout << AK[(K*K)/2 + t] << std::endl;

    return AK[(K*K)/2 + t];
}

long long find_max_dp(long long N, std::vector<long long> &num_list, long long MAX_NUM) {
    int tmp_choice, tmp_not_choice;
    std::vector<std::vector<long long>> table(N, std::vector<long long>(MAX_NUM+1, 0));

    // DP表の一番上（i = 0）を初期化
    for(int j = 0; j <= MAX_NUM; j += 1) {
        if(num_list[0] > j) {
            table[0][j] = 0; // 何も入れられないとき
        }
        else {
            table[0][j] = num_list[0]; // 0番目の数字を足せるとき
        }
    }

    for(int i = 1; i < N; i += 1) {
        for(int j = 0; j <= MAX_NUM; j += 1) {
            tmp_not_choice = table[i-1][j];
            if(num_list[i] > j) {
                table[i][j] = tmp_not_choice;
            }
            else {
                tmp_choice = table[i-1][j - num_list[i]] + num_list[i];
                if(tmp_choice >= table[i-1][j])
                    table[i][j] = tmp_choice;
                else
                    table[i][j] = tmp_not_choice;
            }
        }
    }

    return table[N-1][MAX_NUM];
}

int main()
{
    long long N;

    std::cin >> N;
    long long Tsum = 0;
    std::vector<long long> T(1001, 0);
    std::vector<long long> T2(N, 0);

    for(long long i = 0; i < N; i++){
        long long temp;
        std::cin >> temp;
        T2[i] = temp;
        Tsum += temp;
        T[temp]++;
    }
    std::sort(T2.begin(), T2.end());

    long long ans = find_max_dp(N, T2, Tsum/2);

    ans = Tsum - ans;

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

#include<bits/stdc++.h>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
using namespace std;
const int N=110;
int n;
int a[N];
bool dp[N][N*2000];
int sum=0;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	forn(i,1,n)cin>>a[i];
	forn(i,1,n)sum+=a[i];
	dp[0][100000]=1;
	forn(i,1,n){
		rep(j,200001){
			if(dp[i-1][j]){
				dp[i][j+a[i]]=dp[i][j-a[i]]=1;
			}
		}
	}
	forn(d,0,100000){
		if(dp[n][100000+d]||dp[n][100000-d]){
			cout<<(sum+d)/2;
			return 0;
		}
	}
	return 0;
}


#include <algorithm>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; ++i)

using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;

// 番号が若い順から順に０にしていくと
// 偶数番・奇数番をそれぞれ独立に足し合わせたものが残っていく
// -> 偶数番の合計と奇数番の合計が等しくなればよい
// -> 偶数番と奇数番の差を計算し，等しくなればよい

int main()
{
	int N; cin >> N;
	vector<LLONG> as(N); REP(i, N) cin >> as[i];
	vector<LLONG> diffs(N);
	diffs[0] = as[0];
	for(int i = 1; i < N; ++i)
	{
		if (i % 2 == 0) diffs[i] = diffs[i - 1] + as[i];
		else diffs[i] = diffs[i - 1] - as[i];
	}

	map<LLONG, LLONG> diff2NumMap;
	for (LLONG diff : diffs) ++diff2NumMap[diff];

	LLONG ans = 0;
	++diff2NumMap[0];
	for (const auto& kvp : diff2NumMap)
	{
		LLONG num = kvp.second;
		ans += num * (num - 1) / 2;
	}

	cout << ans << endl;
}

#include<bits/stdc++.h>
#include <iostream>
#include <stack>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

using ll = long long;

using ull = unsigned long long;

using pi=pair<int,int>;

using pl=pair<ll,ll>;

#define pb push_back

#define     f               first
#define     s               second
#define     rep(i,a,b)      for(ll i=a;i<b;i++)
#define     repd(i,b,a)     for(ll i=b;i>a;i--)
#define     repi(i,b,a,c)   for(ll i=b;i<a;i+=c)
#define     cas             ll cas;cin>>cas ; for(ll i=0;i<cas;i++)

const ll N=1e5 + 10;
const ll INF=1e18;
const ll M=1e5 +10;
const ll mod=1e9 + 7;
const ll L=31;
const ll hp=293;

ll _pow(ll a,ll b){
    if(b==0){
      return 1;
    }
    if(b==1){
      return a%mod;
    }
    ll k=_pow(a,b/2);
    k%=mod;
    k=k*k;
    k%=mod;
    if(b%2==1){
      k*=a;
      k%=mod;
    }
    return k;
}

bool prime[N];
ll seive(){
     for(ll i=0;i<N;i++){
          prime[i]=true;
     }
     for(ll i=2;i<=sqrt(N);i++){
          if(prime[i]){
               for(ll j=i*i;j<N;j+=i){
                    prime[j]=false;
               }
          }
     }

}

ll solve(){
     // seive();
     ll n;
     cin>>n;
     // ll cnt=0;
     set<ll>st;
     for(ll i=2;i<=sqrt(n);i++){
          // if(prime[i]){
               // cout<<i<<" ";
               ll p=i*i;
               while(p<=n){
                    st.insert(p);
                    p=p*i;
                    // cnt++;
               }
          // }
     }
     ll sz=st.size();
     cout<<(n-sz)<<'\n';
    return 0;
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    //solve();
//    cas{
        solve();
//    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define ub upper_bound
#define lb lower_bound
const ll M=1000000007;
#define inf 1000000000000000000
#define infn -1000000000000000000
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll power(ll x,ll n,ll m){if(n==0)return 1;else if(n%2==0)return (power(((x%m)*(x%m))%m,n/2,m))%m;else return ((x%m)*(power(x,n-1,m)%m))%m;}
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m==1)return 0;while(a>1){
ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}
// std::rotate(vec.begin(), vec.begin()+rotL, vec.end());//rotl=no of left ro
// td::rotate(vec.begin(), vec.begin()+vec.size()-rotR, vec.end());
//str.substr(1,3); // takes(0 based indexing all from [1,3])
//transform(str.begin(),str.end(),str.begin(),::tolower);//also "toupper"
// to_string(ll),stoll(string)
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL),cout.tie(NULL);
ll n,m,q,l,r,w,v;
cin>>n>>m>>q;
vector<pair<ll,ll>>vec,pec;
for(int i=1; i<=n; i++){
cin>>w>>v;
vec.pb({w,v});
}
pec=vec;
ll num[m],vis[n]={0};
for(int i=0; i<m; i++){
cin>>num[i];
}
while(q--){
cin>>l>>r;
l-=1,r-=1;
for(int i=0; i<n; i++)
vis[i]=0;
vector<ll>vec;
for(int i=0; i<m; i++){
if(l>i||i>r){
vec.pb(num[i]);
}
}
sort(vec.begin(),vec.end());
ll ans=0;
for(int i=0; i<vec.size(); i++){
ll d=infn,ind=-1,w=-1;
for(int j=0; j<pec.size(); j++){
if(vis[j]==0&&pec[j].ff<=vec[i]&&pec[j].ss>d){
d=pec[j].ss;
ind=j;
w=pec[j].ff;
}
if(vis[j]==0&&pec[j].ff<=vec[i]&&pec[j].ss==d){
if(w<pec[j].ff){
d=pec[j].ss;
ind=j;
w=pec[j].ff;
}
}
}
if(ind!=-1)
vis[ind]=1,ans+=d;
}
cout<<ans<<"\n";
}
return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define SZ(x) ((int)(x).size())
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  int t;
  cin >> t;
  REP(i, t) {
    ll n;
    cin >> n;
    string ans;
    if (n % 4 == 0) {
      ans = "Even";
    } else if (n % 2 == 0) {
      ans = "Same";
    } else {
      ans = "Odd";
    }
    cout << ans << endl;
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


#include <bits/stdc++.h>

using namespace std;
int isprime (int n)
{
	int j;
	for ( j = 2 ; j <= n / 2 ; j ++ )
	{
		if ( !(n % j) )
			return 0;
	}
	return 1;

}
int main (void)
{

	 	int  n;
	 	while (cin >> n)
	 	{
	 		long long ans = 1;
	 		int i;
	 		for ( i = 2; i <= n ; i ++)
	 		{
	 			if (isprime (i))
	 			{
	 				if ( i == 2)
	 					ans *=2 * 2 * 2 * 2;
	 				else if (i == 3)
	 				{
	 					ans *=3 * 3 * 3;
					}
					else if (i == 5)
					{
						ans *= 5 * 5;
					}
					else
						ans *= i;
				}
			 }
			 printf ("%lld\n",ans+1);
		}
		return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y)
{
    return __gcd(x,y);
}
ll lcm(ll x,ll y)
{
    return (x*y)/(gcd(x,y));
}
int main()
{
    long long n,i,a;
    cin>>n;
    a=1;
    for(i=2;i<=n;i++)
    {
        a=lcm(a,i);
    }
    cout<<a+1<<endl;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define fi first
#define se second
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
#define set20 cout<<fixed<<setprecision(20) ;
// ミント
//int mod ; cin>>mod ;
const ll mod = 1e9+7 ;//924844033;
    //998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod); //任意modではここ消す
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
    return fact[n]*ifact[n-k] ; //kは個数
  }
  }  c(1000005);

mint modpow(ll a,ll b){
 if(b==0) return 1 ;
 mint c= modpow(a,b/2) ;
 if(b%2==1) return c*c*a ;
 else return c*c ;
}

mint komb(ll n,ll m){
  mint x=1 ;mint y=1 ;
  rep(i,m){
    x*= n-i ;
    y*= i+1 ;
  }
  return x/y ;
}

 map<ll,ll> factor(ll n){  //素因数とオーダーをマップで管理
  map <ll,ll> ord ;
  for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            int res=0;
            while(n%i==0){
                n/=i;
                res++;
            }
            ord[i]=res;
        }
    }
   if(n!=1) ord[n]++;
   return ord ;
 }

int main(){
  ios::sync_with_stdio(false) ;
  cin.tie(nullptr) ;
  ll n ; cin>>n ;
  string s ; cin>>s ;
  if(s[0]!=s[n-1]) cout<<1<<endl ;
  else{
    char a=s[0] ;
    bool ok=0 ;
    rep(i,n-1){
     if(s[i]!=a && s[i+1]!=a) ok=1 ;
    }
    if(ok) cout<<2<<endl ;
    else cout<<-1<<endl ;
  }
  return 0 ;
  }

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int,int>;
const int N=2000;
const int INF=1e9;
const int White=0,Gray=1,Black=2;
vector<P> G[N];
int dist[N][N];
int color[N], self[N];
priority_queue<P,vector<P>, greater<P>> que;
void dijkstra(int v){
  que.push({0,v});
  color[v]=Gray;
  while(!que.empty()){
    P now=que.top();que.pop();
    if(dist[v][now.second]<now.first)continue;
    color[now.second]=Black;
    for (auto &&i : G[now.second]){
      int d=i.first, next=i.second;
      if(color[next]==Black)continue;
      if(dist[v][next] > dist[v][now.second]+d) {
        dist[v][next] = dist[v][now.second]+d;
        que.push({dist[v][next],next});
        color[next]=Gray;
      }
    }

  }
}
int main() {
  int n,m;
  cin >> n >> m;
  rep(i,n)self[i]=INF;
  rep(i,m) {
    int ai, bi, ci;
    cin >> ai >> bi >> ci;
    ai--; bi--;
    if(ai==bi){
      self[ai]=min(self[ai],ci);
      continue;
    }
    G[ai].push_back({ci,bi});
  }
  rep(i,n)rep(j,n)dist[i][j]=INF;
  rep(i,n)dist[i][i]=0;

  rep(j,n){
    rep(k,n)color[k] = White;
    dijkstra(j);
  }
  rep(i,n) {
    int ans = INF;
    rep(j,n) {
      if(i==j){
        ans=min(ans,self[i]);
        continue;
      }
      ans = min(ans,dist[i][j]+dist[j][i]);
    }
    cout << ((ans==INF) ? -1 : ans)<< endl;
  }
}


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

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

int P[100001];
int sei[100001], fu[100001], kisuu[100001], kazu[100001], kazu2[100001];

void sort_ganbare(int N, int A[]) {
	if (N < (1 << 12)) {
		sort(A, A + N);
		return;
	}
	const int b = 9;
	int tmp[100001];
	int kazu[1 << b] = {}, kazu2[1 << b] = {};
	rep(i, N) kazu[A[i] & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
	for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] & ((1 << b) - 1)]] = A[i];
	rep(i, N) kazu2[tmp[i] >> b & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
	for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> b & ((1 << b) - 1)]] = tmp[i];
}

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

	int N;
	cin >> N;
	rep1(i, N - 1) {
		cin >> P[i + 1];
		kazu[P[i + 1]]++;
	}
	rep(i, N) kazu2[i + 1] = (kazu[i + 1] += kazu[i]);

	for (int i = N; i >= 2; i--) {
		int ret = sei[i] - 1;

		auto ki = kisuu + kazu[i - 1];
		int sz = kazu2[i - 1] - kazu[i - 1];
		sort_ganbare(sz, ki);

		if (sz & 1) {
			ret -= fu[i];
			rep(j, sz) {
				if (j & 1) ret -= ki[j] - (1 << 17);
				else ret += ki[j] - (1 << 17);
			}
		}
		else {
			ret += fu[i];
			rep(j, sz) {
				if (j & 1) ret += ki[j] - (1 << 17);
				else ret -= ki[j] - (1 << 17);
			}
		}

		if (ret & 1) {
			kisuu[kazu2[P[i] - 1]++] = ret + (1 << 17);
		}
		else {
			if (ret >= 0) sei[P[i]] += ret;
			else fu[P[i]] += ret;
		}
	}

	int ret = sei[1] - 1;

	auto ki = kisuu + kazu[0];
	int sz = kazu2[0] - kazu[0];
	sort_ganbare(sz, ki);

	if (sz & 1) {
		ret -= fu[1];
		rep(j, sz) {
			if (j & 1) ret -= ki[j] - (1 << 17);
			else ret += ki[j] - (1 << 17);
		}
	}
	else {
		ret += fu[1];
		rep(j, sz) {
			if (j & 1) ret += ki[j] - (1 << 17);
			else ret -= ki[j] - (1 << 17);
		}
	}

	co((N - ret) / 2);

	Would you please return 0;
}

//QwQcOrZ yyds!!!
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define R(i,a,b) for (int i=(a);i<(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,x) for (int i=head[x];i;i=e[i].nx)
#define mp make_pair
#define pb push_back
#define pa pair < int,int >
#define fi first
#define se second
#define re register
#define be begin()
#define en end()
#define sqr(x) ((x)*(x))
#define ret return puts("-1"),0;
#define put putchar('\n')
#define inf 1000000005
#define mod 998244353
#define int ll
//#define N
using namespace std;
inline char gc(){static char buf[100000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;}
#define gc getchar
inline ll read(){char c=gc();ll su=0,f=1;for (;c<'0'||c>'9';c=gc()) if (c=='-') f=-1;for (;c>='0'&&c<='9';c=gc()) su=su*10+c-'0';return su*f;}
inline void write(ll x){if (x<0){putchar('-');write(-x);return;}if (x>=10) write(x/10);putchar(x%10+'0');}
inline void writesp(ll x){write(x),putchar(' ');}
inline void writeln(ll x){write(x);putchar('\n');}
long long x,y,z,p;
signed main()
{
	x=read(),y=read(),z=read();
	p=y*y+z*z;
	if (sqrt(p*1.0)/x<1) writeln(2); else
	cout<<ceil(sqrt(p*1.0)/x);
}
/*

*/


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

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

    ll ans = 2*a[0];
    ll last = 2*a[0];
    ll ma = a[0];
    //cout << last << endl;
    cout << ans << endl;
    for(int i=1;i<n;i++){
        if(ma < a[i]){
            ans += i*(a[i]-ma) + last+(a[i]-ma)+a[i];
            last = last+(a[i]-ma)+a[i];
            ma = a[i];
        }else{
            ans += last+a[i];
            last += a[i];
        }
        //cout << last << endl;
        cout << ans << endl;
    }
    return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;
int n;
long long k;
long long a[3000006];
long long sum[3000006];
int main(){
	scanf("%d%lld",&n,&k);
	int l=3;
	for(int i=1;i<=n;++i)a[l++]=1ll*i;
	for(int i=n-1;i>=1;--i)a[l++]=1ll*i;
	for(int i=3;i<=n+2;++i){
		sum[i]=sum[i-1]+a[i];
		a[i]=sum[i];
	}
	for(int i=n+3;i<=3*n;++i){
		sum[i]=sum[i-1]+a[i];
		a[i]=(sum[i]-sum[i-n]);
	}
	for(int s=3;s<=3*n;++s){
		if(k<=a[s]){
			for(int i=1;i<=min(s-2,n);++i){
				int js;
				if(s-i-1<=n)js=s-i-1;
				else js=max(2*n-(s-i-1),0);
				if(k<=js){
					int j=k+(s-i-1>n?s-i-1-n:0);
					printf("%d %d %d\n",i,j,(s-i-j));
					return 0;
				}
				k-=1ll*js;
			}
		}
		k-=a[s];
	}
	return 0;
}


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

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;
using namespace __gnu_pbds;

template<typename T> // order_of_key(), *find_by_order()
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

namespace {
    struct custom_hash {
        static uint64_t splitmix64(uint64_t x) {
            // http://xorshift.di.unimi.it/splitmix64.c
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }

        size_t operator()(uint64_t x) const {
            static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }
    };

    template<typename T, typename F>
    using HashMap = unordered_map<T, F, custom_hash>;

    template<typename T>
    using HashSet = unordered_set<T, custom_hash>;
}

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
    ll gcd(ll a, ll b) {
        return (a == 0 ? b : gcd(b % a, a));
    }
    ll gcdex(ll a, ll b, ll& x, ll& y) {
        if (a == 0) {
            x = 0; y = 1;
            return b;
        }
        ll x1, y1;
        ll d = gcdex(b % a, a, x1, y1);
        x = y1 - (b / a) * x1;
        y = x1;
        return d;
    }

    ll inv_eu(ll a, ll m) {
        ll x, y;
        ll g = gcdex(a, m, x, y);
        if (g != 1) {
            assert(0);
            return 0;
        } else {
            x = (x % m + m) % m;
            return x;
        }
    }
}

ll const maxn = 3e5 + 5;

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

    ll n; cin >> n;
    vector<int>a(n),b(n);
    for(int &x : a) cin >> x;
    for(int &x : b) cin >> x;

    ll ans = 0;
    for(int x : a) ans += x;

    vector<vector<int>>v(2);
    for(int i=0;i<n;i++)
        v[i%2].push_back(b[i] - a[i]);

    for(int i=0;i<2;i++){
        sort(all(v[i]));
        reverse(all(v[i]));
    }

    for(int i=0;i<n/2;i++){
        //cerr << v[0][i] << " " << v[1][i] << endl;
        if(v[0][i] + v[1][i] > 0) ans += v[0][i] + v[1][i];
    }
    cout << ans << endl;

    return 0;
}

/*

*/


#include <cstdio>
#include <cstdlib>
using namespace std;
#define ll long long
const ll MAXN = 400011;

struct fhqTreap {
	ll tot, rt;
	ll val[MAXN], sum[MAXN], sz[MAXN], ls[MAXN], rs[MAXN], rd[MAXN];

	void pushup(ll u) {sz[u] = sz[ls[u]] + sz[rs[u]] + 1; sum[u] = sum[ls[u]] + sum[rs[u]] + val[u];}

	void split(ll u, ll k, ll &x, ll &y) {
		if(!u) {x = y = 0; return;}
		if(val[u] <= k) x = u, split(rs[u], k, rs[u], y);
		else y = u, split(ls[u], k, x, ls[u]);
		pushup(u);
	}

	ll merge(ll u, ll v) {
		if(!u || !v) return u | v;
		if(rd[u] < rd[v]) {rs[u] = merge(rs[u], v); pushup(u); return u;}
		else {ls[v] = merge(u, ls[v]); pushup(v); return v;}
	}

	ll add(ll k) {
		rd[++tot] = rand();
		sz[tot] = 1;
		val[tot] = sum[tot] = k;
		return tot;
	}

	void insert(ll k) {
		ll x, y;
		split(rt, k, x, y);
		rt = merge(merge(x, add(k)), y);
	}

	ll cb(ll k) {
		ll x, y;
		split(rt, k, x, y);
		ll ans = sz[x] * k + sum[y];
		rt = merge(x, y);
		return ans;
	}

	void delet(ll k) {
		ll x, y, z;
		split(rt, k, x, z);
		split(x, k - 1, x, y);
		y = merge(ls[y], rs[y]);
		rt = merge(merge(x, y), z);
	}
} t[2];

ll q;
ll len[2];
ll w[2][MAXN];

ll read() {
	ll X = 0, F = 1; char C = getchar();
	while(C < '0' || C > '9') {if(C == '-')F=-1; C = getchar();}
	while(C >= '0' && C <= '9') {X = X*10+C-'0'; C = getchar();}
	return X * F;
}

int main() {
	ll ans = 0;
	len[1] = read(); len[0] = read(); q = read();
	for(ll i = 0; i < 2; ++i)
		for(ll j = 1; j <= len[i]; ++j)
			t[i].rt = t[i].merge(t[i].rt, t[i].add(0));
	for(ll i = 1, opt, x, y; i <= q; ++i) {
		opt = (read() & 1); x = read(); y = read();
		t[opt].delet(w[opt][x]);
		t[opt].insert(y);
		ans -= t[opt^1].cb(w[opt][x]);
		w[opt][x] = y;
		ans += t[opt^1].cb(w[opt][x]);
		printf("%lld\n", ans);
	}
	return 0;
}

#include <iostream>
using namespace std;
long long n,k,x,y,a,b,c,d, ansx, ansy;
long long ans;
main(){
	cin>>n>>k;
    k=abs(k);
	for(x=1; x<=2*n+1; x++){
		ansx=1; ansy=1;
		y=x-k;
		//cout<<"----"<<endl;
		//cout<<x<<" "<<y<<endl;
		if(x-1>=n) ansx=2*n-x+1;
		else ansx=x-1;
		if(y-1>=n) ansy=2*n-y+1;
		else ansy=y-1;

		if(ansx<0 || ansy<0) continue;
		//cout<<ansx<<" "<<ansy<<endl;
		ans+= (ansx*ansy);
	}
	cout<<ans<<endl;
}


#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a+3);
    if(a[0]==a[1]){
    	cout << a[2] <<endl;
    }else if(a[1]==a[2]){
    	cout << a[0] <<endl;
    }else{
    	cout << 0 <<endl;
    }
  	return 0;
}

#define _DEBUG
#include "bits/stdc++.h"
//#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,a5,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#define debug_6(x1,x2,x3,x4,x5,x6) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<", "#x6<<": "<<x6<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_6,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define prind(argument) cout<<std::fixed<<setprecision(13)<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define PI acosl(-1)
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define puba emplace_back
#define pubamp(a,b) emplace_back(mp(a,b))
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	int x1[101],y1[101],x2[101],y2[101];
	scan(N);
	rep(i,N){
		scan(x1[i]>>y1[i]);
	}
	rep(i,N){
		scan(x2[i]>>y2[i]);
	}
	if(N==1){
		prin("Yes");
		return 0;
	}
	int a01x=x1[1]-x1[0],a01y=y1[1]-y1[0];
	map<pint,int> acount;
	rep(i,N){
		int atox=x1[i]-x1[0],atoy=y1[i]-y1[0];
		int naiseki=a01x*atox+a01y*atoy;
		int gaiseki=a01x*atoy-atox*a01y;
		acount[mp(naiseki,gaiseki)]++;
	}
	rep(ii,N){
		rep(jj,N){
			if(ii==jj) continue;
			int b01x=x2[ii]-x2[jj],b01y=y2[ii]-y2[jj];
			map<pint,int> bcount;
			rep(i,N){
				int btox=x2[i]-x2[jj],btoy=y2[i]-y2[jj];
				int naiseki=b01x*btox+b01y*btoy;
				int gaiseki=b01x*btoy-btox*b01y;
				bcount[mp(naiseki,gaiseki)]++;
			}
			bool ok=1;
			for(const auto& fs:acount){
				if(bcount[fs.first]!=fs.second){
					ok=0;
				}
			}
			if(ok){
				prin("Yes");
				return 0;
			}
		}
	}
	prin("No");
	return 0;
}


/**
 *    author:  Pocket7878
 **/
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

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

/* Consts */
const int INF = 1000000000;
const long long LINF = 1e18;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const long double LEPS = 1.0E-14;

/* Types */
typedef long long ll;
typedef unsigned long long ull;

/* Macros */
#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)

bool start_with(const std::string& s, const std::string& prefix, int offset) {
  if (s.size() < prefix.size()) return false;
  return std::equal(std::begin(prefix), std::end(prefix),
                    std::begin(s) + offset);
}

// #include <algorithm> // std::equal
// #include <iterator>  // std::rbegin, std::rend
// ends_with("abc", "bc") == true
bool ends_with(const std::string& s, const std::string& suffix) {
  if (s.size() < suffix.size()) return false;
  return std::equal(std::rbegin(suffix), std::rend(suffix), std::rbegin(s));
}

template <class T>
double deg2rad(T& deg) {
  return deg * (M_PI / 180.0);
}

// Debugs
#ifndef ONLINE_JUDGE
#define _LIBCPP_DEBUG 1
#endif

#ifdef ONLINE_JUDGE
#define debug(var) 42
#endif

#ifndef ONLINE_JUDGE
#define debug(var)              \
  do {                          \
    std::cout << #var << " : "; \
    view(var);                  \
  } while (0)
#endif

template <typename T>
void view(T e) {
  std::cout << e << std::endl;
}
template <typename T>
void view(const std::vector<T>& v) {
  for (const auto& e : v) {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>>& vv) {
  for (const auto& v : vv) {
    view(v);
  }
}

void comb(vector<vector<long long int>>& v) {
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}

ll mod_fact(unordered_map<ll, ll>& memo, ll i) {
  if (memo.find(i) != memo.end()) {
    return memo[i];
  } else if (i == 1) {
    return memo[i] = 1;
  } else {
    return memo[i] = (i % MOD) * (mod_fact(memo, i - 1) % MOD) % MOD;
  }
}

vector<long long> enum_divisors(long long N) {
  vector<long long> res;
  for (long long i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      res.push_back(i);
      // 重複しないならば i の相方である N/i も push
      if (N / i != i) res.push_back(N / i);
    }
  }
  // 小さい順に並び替える
  sort(res.begin(), res.end());
  return res;
}

struct Edge {
  ll to;
  ll ki;
  ll ti;

  Edge(ll to, ll ki, ll ti) : to(to), ki(ki), ti(ti) {}
};

using Graph = vector<vector<Edge>>;

std::vector<ll> Eratosthenes( const ll N )
{
    std::vector<bool> is_prime( N + 1 );
    for( ll i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<ll> P;
    for( ll i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( ll j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

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

  ll A, B;
  cin >> A >> B;

  ll C = A + B;
  if (C >= 15 && B >= 8) {
    cout << 1 << endl;
  } else if (C >= 10 && B >= 3) {
    cout << 2 << endl;
  } else if (C >= 3) {
    cout << 3 << endl;
  } else {
    cout << 4 << endl;
  }
}

#include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>

using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;

/*bool compare_function(const pair<int, int> a, const pair<int, int> b)
{
    return a.first < b.first;
}*/
// use case
//sort(V.begin(), V.end(), compare_function);

/*struct compare
{
    bool operator ()(const pair<int, int> &a, const pair<int, int> &b) {
    if (a.second-a.first==b.second-b.first)
    {
        return a.first>b.first;
    }
    return a.second-a.first < b.second-b.first;}
};
priority_queue <pair<int,int>, vector <pair<int,int>>, compare> Q;*/

/*void print1(vector <int> X)
{
    for (int i=0; i<X.size(); i++)
    {
        cout<<X[i]<<" ";
    }
    cout<<endl;
    return;
}

void print2(vector <vector <int>> X)
{
    for (int i=0; i<X.size(); i++)
    {
    for (int j=0;j<X[i].size();j++) {
        cout<<X[i][j]<<" ";}
    cout<<endl;}
    return;
}*/

int solve(int a, int b) {
	if (a+b>=15 && b>=8) {return 1;}
	if (a+b>=10 && b>=3) {return 2;}
	if (a+b>=3) {return 3;}
	return 4;
	}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    int x=solve(a,b);
    cout<<x<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (n-1); i >= 0; i--)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template <class S>S sum(vector<S>& a) {return accumulate(all(a), S());}
template <class S>S max(vector<S>& a) {return *max_element(all(a));}
template <class S>S min(vector<S>& a) {return *min_element(all(a));}
ll max(int a, ll b) { return max((ll)a, b); } ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); } ll min(ll a, int b) { return min(a, (ll)b); }

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

using P = pair<int,int>;
int n,m;
vector<vector<P>> graph;
vector<int> label;

void dfs(int node){
  for(auto [a,c]: graph[node]){
    if(label[a] < 0){
      if(c == label[node]){
        label[a] = (c+1) % n;
      }else{
        label[a] = c;
      }
      dfs(a);
    }
  }
}

void Main(){
  cin >> n >> m;
  graph = vector<vector<P>>(n);
  label = vector<int>(n, -1);
  Rep(m){
    int u,v,c; cin >> u >> v >> c;
    u--; v--; c--;
    graph[u].push_back(P(v,c));
    graph[v].push_back(P(u,c));
  }
  label[0] = 0;
  dfs(0);
  for(auto i: label){
    cout << i+1 << endl;
  }
}

#include "bits/stdc++.h"
using namespace std;
using P = pair<int, int>;
bool seen[100010], seen2[100010];
vector<vector<P>>graph;
int ans[100010];
void dfs(vector<vector<P>> &G, int v) {
	seen[v] = true;
	for (auto nv : G[v]) {
		if (seen[nv.first])continue;
		graph[v].push_back({ nv.first,nv.second });
		graph[nv.first].push_back({ v,nv.second });
		dfs(G, nv.first);
	}
}
void dfs2(int v) {
	if (v == 0) {
		ans[v] = 1;
	}
	seen2[v] = true;
	for (auto nv : graph[v]) {
		if (seen2[nv.first])continue;
		if (ans[v] == nv.second) {
			int tmp = 1;
			if (tmp == nv.second)tmp++;
			ans[nv.first] = tmp;
		}
		else {
			ans[nv.first] = nv.second;
		}
		dfs2(nv.first);
	}
}
signed main() {
	int N, M; cin >> N >> M;
	graph.resize(N);
	vector<vector<P>>G(N);
	for (int i = 0; i < M; i++) {
		int u, v, c; cin >> u >> v >> c; u--; v--;
		G[u].push_back({ v,c });
		G[v].push_back({ u,c });
	}
	dfs(G, 0);
	dfs2(0);
	for (int i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}


#include <iostream>
#include <cstdio>
using namespace std;
int m;
long long n;
struct node
{
	int res, rem;
};
node work(long long x)
{
	if(x == 0)
	{
		return (node){0, 1};
	}
	if(x % 2 == 1)
	{
		node tmp = work(x - 1);
		int Res = (tmp.res * 10 + (tmp.rem * 10) / m) % m;
		int Rem = (tmp.rem * 10) % m;
		return (node){Res, Rem};
	}
	else
	{
		node tmp = work(x / 2);
		int Res = (tmp.res * tmp.res % m * m % m + 2 * tmp.res * tmp.rem % m + (tmp.rem * tmp.rem) / m) % m;
		int Rem = (tmp.rem * tmp.rem) % m;
		return (node){Res, Rem};
	}
}
int main()
{
	scanf("%lld%d", &n, &m);
	node tmp = work(n);
	printf("%d", tmp.res);
	return 0;
}

//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define PI              acos(-1.0)
#define No              cout<<"No\n"
#define Yes             cout<<"Yes\n"
#define no              cout<<"no\n"
#define yes             cout<<"yes\n"
#define NO              cout<<"NO\n"
#define YES             cout<<"YES\n"
// #define MOD             (int)1000000007
#define int             long long
#define ll              long long
#define pii             pair<int, int>
#define fi              first
#define se              second
#define sf(a)           scanf("%lld", &a)
#define pf(a)           printf("%lld ", a)
#define pfn(a)          printf("%lld\n", a)
#define case(a)         cout<<"Case "<<a<<": ";
#define FASTIO          ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb              push_back
#define mem(arr)        memset(arr, 0, sizeof(arr))
#define mem1(arr)       memset(arr, -1, sizeof(arr))
#define all(a)          a.begin(),a.end()
#define f(i,a,b)        for (int i = a; i<=b; i++)
#define fr(i,a,b)       for (int i = a; i>=b; i--)
#define rr              return 0
#define prec(n)         fixed<<setprecision(n)
#define maxpq           priority_queue<int>
#define minpq           priority_queue<int, vector<int>, greater<int> >
#define inf             (int)(1e18)
#define vi              vector<int>
#define vii             vector<pii>
#define sz(s)           s.size()
#define lcm(a,b)        (a*(b/gcd(a,b)))

int gcd(int a, int b)   {return __gcd(a,b);}

int MOD;
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n or (1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

const double eps = 1e-9;

int dx[5] = {+1, +0, -1, -0};
int dy[5] = {+0, +1, -0, -1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };

inline bool Equal(double x, double y) { return fabs(x-y)<eps; }
inline bool Greater(double x, double y){ return x-eps>y; }
inline bool Lesser(double x, double y){ return x+eps<y; }

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << " "; err(++it, args...); }

///Write what you need -->
/// nt, ft, kmp, tri, sufarr, ub_lb, lis
/// dsu, combi

///Template Ends Here////////////////////////////

signed main()
{
//    root = new trinode();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    FASTIO

//    int n;
//    cin>>n;
//
//    int a[n+1];
//    f(i, 1, n){
//        cin>>a[i];
//    }

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

    MOD = m*m;
    int r = modPow(10, n);

    MOD = m;
    int r1 = modPow(10, n);

    cout<<(r-r1)/m;

//    tridel(root);
}


#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <deque>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <cassert>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = int64_t;
#define rep(i, a) for (int i = 0; i < (int)(a); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define repr(i, a) for (int i = (int)((a) - 1); i >= 0; --i)
template <class T> using V1 = vector<T>;
template <class T> using V2 = vector<V1<T>>;
template <class T> using V3 = vector<V2<T>>;
template <class T> using V4 = vector<V3<T>>;
template <class T> using V5 = vector<V4<T>>;
template <class T> V1<T> MV1(size_t n1, T init = T()) { return V1<T>(n1, init); }
template <class T> V2<T> MV2(size_t n1, size_t n2, T init = T()) { return V2<T>(n1, MV1(n2, init)); }
template <class T> V3<T> MV3(size_t n1, size_t n2, size_t n3, T init = T()) { return V3<T>(n1, MV2(n2, n3, init)); }
template <class T> V4<T> MV4(size_t n1, size_t n2, size_t n3, size_t n4, T init = T()) { return V4<T>(n1, MV3(n2, n3, n4, init)); }
template <class T> V5<T> MV5(size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, T init = T()) { return V5<T>(n1, MV4(n2, n3, n4, n5, init)); }
struct dstream { ofstream fout; dstream(const char* fname) : fout(fname) {} };
template <typename T> dstream& operator << (dstream& lhs, const T& rhs) { lhs.fout << rhs; cout << rhs; return lhs; }

template <typename T> vector<T> GetDivisors(T n)
{
	vector<T> v;
	for (T i = 1; i * i <= n; ++i) {
		if ((n % i) == 0) {
			v.push_back(i);
			if ((n / i) != i)
				v.push_back(n / i);
		}
	}
	sort(v.begin(), v.end());
	return v;
}

int main()
{
#ifdef ENV_LOCAL
	ifstream fin("input.txt");
	dstream dout("output.txt");
	auto& in = fin;
	auto& out = dout;
#else
	auto& in = cin;
	auto& out = cout; out << "";
#endif

	int A, B;
	in >> A >> B;
	vector<int> ds(200001);
	for (int i = A; i <= B; ++i) {
		auto divs = GetDivisors(i);
		rep(j, divs.size())
			ds[divs[j]]++;
	}
	int vmax = 0;
	rep(i, ds.size()) {
		if (ds[i] >= 2)
			vmax = max(vmax, i);
	}
	cout << vmax;

	return 0;
}

/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿
⠀⡇⠀⠀⠀⠀⠀⠀⠹⣿⣷⣄⠀⣿⣿⣿⣿⠀⣠⣾⣿⠏⠀⠀⠀⠀⠀⠀⢸
⠀⠁⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⢇⣿⣿⣿⣿⡸⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣧⡀
⠀⠀⠀⠐⢤⣀⣀⢀⣀⣠⣴⣿⣿⠿⠋⠙⠿⣿⣿⣦⣄⣀⠀⠀⣀⡠⠂
⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠋⠁
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define F(i,a,b) for(i=a;i<b;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781641;
const ll M=1e16;
const ll MAXN=200200;
ll i,j,mask;
void solve()
{
   ll x,y;
   cin>>x>>y;
   if(x>=y)
   {
       cout<<x-y;
       return ;
   }
   queue<ll> q;
   q.push(y);
   ll lvl=-1;
   ll ans=y-x;
   set<ll> st;
   st.insert(y);
   while(!q.empty())
   {
       lvl++;
       if(lvl>=ans)break;
       ll s=q.size();
       F(i,0,s)
       {
           ll p=q.front();
           q.pop();
           if(p<=x)
           {
               ans=min(ans,lvl+x-p);
           }
           else
           {
               ans=min(ans,lvl+p-x);
               if(p%2)
               {
                   if(st.count(p+1)==0)
                   {st.insert(p+1);q.push(p+1);}
                   if(st.count(p-1)==0)
                   {st.insert(p-1);q.push(p-1);}
               }
               else
               {
                   if(st.count(p/2)==0)
                   {st.insert(p/2);q.push(p/2);}
               }
           }
       }
   }
   cout<<ans;
}
int main()
{
IOS
/*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#*/
/*ll t,test;
cin>>test;
F(t,1,test+1)
{
    //cout<<"Case #"<<t<<": ";
    solve();
    nl
}*/
solve();
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, q;
int p[N];
map<int, int> m[N];
int find(int a){
  return (p[a]<0) ? a : (p[a] = find(p[a]));
}
void merge(int a, int b){
  a=find(a);
  b=find(b);
  if(a==b) return;
  if(sz(m[a]) < sz(m[b])) swap(a, b);
  for(auto p:m[b]) m[a][p.fi] += p.se;
  p[b] = a;
  m[b].clear();
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> q;
  FOR(i, 0, n){
    int c;
    cin >> c;
    m[i][c]++;
    p[i] = -1;
  }
  FOR(_, 0, q){
    int t, a, b;
    cin >> t >> a >> b;
    if(t==1){
      a--; b--;
      merge(a, b);
    }else{
      a--;
      a = find(a);
      cout << m[a][b] << endl;
    }
  }
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(ll i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 2147483647
#define INFLL 1000000000000
#define MOD 998244353
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
#define cout_all(v) for(auto e:v)cout<<e<<" ";cout<<endl
#define smart(v) v.erase(all(v),v.end())
typedef vector<vector<int>> graph;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef pair<ll,ll> pll;
//
int main(){
int a,b,c;cin>>a>>b>>c;
string ans;
if(c==0){
  if(a>b)ans="Takahashi";
  else ans="Aoki";
}else{
  if(a>=b)ans="Takahashi";
  else ans="Aoki";
}
cout<<ans<<endl;
}


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

int main(){
    int n,temp;
    cin >> n;
    vector<int> myvec(n);
    for(int i = 0;i < n;i++){
        cin >> myvec[i];
    }
    int result = 0;
    for(int i = 0;i < n;i++){
        cin >> temp;
        result += temp*myvec[i];
    }
    if(result == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vec               vector<int>
#define mii               map<int,int>
#define pqb               priority_queue<int>
#define no_of_test(zzz)   int zzz; cin>>zzz; while(zzz--)
#define p(c)              cout<<c<<'\n';
const int mod = 1e9 + 7;
void speed()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
//Actual Code Is At The Top
int32_t main()
{
	speed();
	//no_of_test(zzz)
	{
		string s;
		int n;
		cin >> n;
		set<string>set;
		for (int i = 0; i < n; i++)
		{
			cin >> s;
			set.insert(s);
		}
		for (auto x : set)
		{
			if (set.count('!' + x))
			{
				cout << x << '\n';
				return 0;
			}
		}
		cout << "satisfiable" << '\n';
	}
	return 0;
}
//cout<<"###"<<'\n';
//cout<<"."<<'\n';
//cout<<"****"<<'\n';
/*
&& abs(a) + abs(b) < abs(c) + abs(d)
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()
ll maxx=0;
ll n,m;
const ll N=18;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
    os << "[";
    for (ll i=0; i < v.size(); ++i) {
        os << v[i];
        if (i != v.size() - 1)
            os << ", ";
    }
    os << "]";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v){
    os << "{";
    for (auto it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}";
    return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v){
    os<<"{";
    for (auto it : v){
        os << it.first << " : "
           << it.second ;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}";
    return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v){
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    return os;
}
vector<vector<ll>> graph(N,vector<ll>(N,0));

void ans(ll idx, vector<vector<ll>> l){
    if(idx==n){
        maxx=min(int(maxx),int(l.size()));
        //cout<<l<<endl;
        return;
    }
    if(l.size()>=maxx){
        return;
    }
    for(ll i=0;i<l.size();i++){
        bool flag=true;
        for(ll j=0;j<l[i].size();j++){
            if(graph[idx][l[i][j]]==0){
                flag=false;
                break;
            }
        }
        if(flag){
            l[i].pb(idx);
            ans(idx+1,l);
            l[i].pop_back();
        }
    }
    vector<ll> temp{idx};
    l.pb(temp);
    ans(idx+1,l);

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m;
    REP(i,m){
        ll a,b;
        cin>>a>>b;
        a--,b--;
        graph[a][b]=1;
        graph[b][a]=1;
    }
    maxx=n;
    vector<vector<ll>> l;
    ans(0,l);
    cout<<maxx<<endl;

}

#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define autoitr(x,it) for(auto it = x.rbegin(); it != x.rend(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
  FAST/**/

  string req = "fox";

  ll n;
  cin>>n;

  string s;
  cin>>s;

  map<char,ll> st;
  repi(j,3)
        st[req[j]] = j;

  stack<string> sta;
  ll ans = 0;
  for(ll i=0;i<n;i++)
  {
      if(st.find(s[i]) == st.end())
      {
          while(sta.size()>0)
                sta.pop();
          continue;
      }

      if(s[i] == 'f')
      {
          sta.push("f");
          continue;
      }

      else if(s[i] == 'o')
      {
          if(sta.size() == 0)
                continue;
          if(sta.top() == "f")
          {
              sta.pop();
              sta.push("fo");
              continue;
          }

          while(sta.size()>0)
                sta.pop();
      }

      else
      {
          if(sta.size() == 0)
                continue;
          if(sta.top() != "fo")
          {
             while(sta.size()>0)
                sta.pop();
              continue;
          }

          ans++;
          sta.pop();
      }
  }

  cout<<n-(3*ans)<<"\n";

  return 0;
}


#include <bits/stdc++.h>
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() {
    // codehere
	string s;
	cin >> s;
	cout << s[1] << s[2] << s[0]<<'\n';

	return 0;

}

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<bitset>
#include<functional>
#include <fstream>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
#define puts(x) cout << (x) << "\n"
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const int intINF = 1000000000;
const ll mod = 1000000007;
const ll MOD = 998244353;
const ld pi = 3.141592653589793238;
//const ld EPS = 1e-9;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
//main関数内に extGCD(a, b, x, y); でx, yに解が格納
ll extGCD(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	ll d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= MOD; }
		x = x * x % MOD; y /= 2;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
//printf("%.10f\n", n);
typedef pair <ll, ll> P;
typedef pair <ld, ll> pp;
ll dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
//struct edge { ll to, cost; };
struct status {
	ll to;
	ll cost;
	ll bai;

	bool operator<(const status& rhs) const { return cost < rhs.cost; };
	bool operator>(const status& rhs) const { return cost > rhs.cost; };
};

signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	//cout << fixed << setprecision(15);

	//input
	string s; cin >> s;
	string t; t.push_back(s[1]); t.push_back(s[2]); t.push_back(s[0]);
	cout << t << endl;
	return 0;
}


#include<iostream>
#include<cstring>
#include<vector>
#include<queue>

using namespace std;

const int N = 1e3 + 10;

int main(){
    int a,b,c;
    cin >> a>> b >>c;
    if(a - b ==  b - c || a - c == c - b || b - a == a -  c || b - c == c - a || c - a == a - b){
        cout << "Yes" <<endl;
    }else cout <<"No" <<endl;

    return 0;
}

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <queue>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
using ll = long long;
typedef vector<int> VI;
typedef vector<VI> VVI;

ll a,b,c;

int main() {
	cin >> a>>b>>c;
	if(a==b)cout<<c<<endl;
	else if(a==c)cout<<b<<endl;
	else if(c==b)cout<<a<<endl;
	else cout<<"0"<<endl;
	return 0;

}


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

void potato() {
  long long n;
  cin >> n;

  int ans = 0;
  for(auto x = 1LL; ; x++) {
    if(stoll(to_string(x) + to_string(x)) > n)
      break;
    ans++;
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tt=1;
  while(tt--) potato();
  return 0;
}

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

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

    if((int)(N*1.08)<206) cout << "Yay!" << endl;
    else if((int)(N*1.08)==206) cout << "so-so" << endl;
    else cout << ":(" << endl;
}


#include<bits/stdc++.h>
typedef int LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn=1e6+9,mod=998244353,inf=0x3f3f3f3f;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
void Chkmin(LL &x,LL y){
	if(y<x) x=y;
}
void Chkmax(LL &x,LL y){
	if(y>x) x=y;
}
LL add(LL x,LL y){
	return x+=y,x>=mod?x-mod:x;
}
LL dec(LL x,LL y){
	return x-=y,x<0?x+mod:x;
}
LL mul(LL x,LL y){
	return 1ll*x*y%mod;
}
LL Pow(LL base,LL b){
	LL ret(1); while(b){
		if(b&1) ret=mul(ret,base); base=mul(base,base); b>>=1;
	}return ret;
}
LL n,k;
LL fa[maxn],size[maxn],fac[maxn];
LL a[100][100];
LL Find(LL x){
	return fa[x]==x?x:fa[x]=Find(fa[x]);
}
void Merge(LL x,LL y){
	LL fx(Find(x)),fy(Find(y));
	if(fx==fy) return;
	size[fx]+=size[fy]; fa[fy]=fx;
}
void Init(){
	for(LL i=1;i<=n;++i) fa[i]=i,size[i]=1;
}
int main(){
	n=Read(); k=Read();
	fac[0]=1; for(LL i=1;i<=n;++i) fac[i]=mul(fac[i-1],i);
	for(LL i=1;i<=n;++i){
		for(LL j=1;j<=n;++j) a[i][j]=Read();
	}
	Init();
	for(LL x=1;x<=n;++x){
		for(LL y=x+1;y<=n;++y){
			LL flag(1);
			for(LL i=1;i<=n;++i) flag&=(a[i][x]+a[i][y]<=k);
			if(flag){
				Merge(x,y);
			}
		}
	}
	LL ret(1);
	for(LL i=1;i<=n;++i) if(Find(i)==i){
		ret=1ll*ret*fac[size[i]]%mod;
	}
	Init();
	for(LL x=1;x<=n;++x){
		for(LL y=x+1;y<=n;++y){
			LL flag(1);
			for(LL i=1;i<=n;++i) flag&=(a[x][i]+a[y][i]<=k);
			if(flag){
				Merge(x,y);
			}
		}
	}
	for(LL i=1;i<=n;++i) if(Find(i)==i){
		ret=1ll*ret*fac[size[i]]%mod;
	}
	printf("%d\n",ret);
	return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define endl '\n'
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define done(x) {cout << x << endl;return;}
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;
uniform_int_distribution<int> rng(0, 1e9);

//DEBUG FUNCTIONS START
#define cerr cout
void __print(int x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "\n";}
template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define deb(x...)  _print(x)
#else
#define deb(x...)
#endif
// DEBUG FUNCTIONS END

const int N = 1e3 + 5;
int a[N][N];
int x[N][N];
int y[N][N];

void solve(){

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

    fr(i,1,n){
        fr(j,1,n){
            cin >> a[i][j];
        }
    }

    int l = 0, h = 1e9;

    while(l < h){

        int mid = (l + h) / 2;

        fr(i,1,n){
            fr(j,1,n){
                x[i][j] = (a[i][j] <= mid) ? -1 : 1;
            }
        }

        fr(i,1,n){
            fr(j,1,n){
                y[i][j] = y[i-1][j] + y[i][j-1] - y[i-1][j-1] + x[i][j];
            }
        }

        bool ok = 0;
        fr(i,k,n){
            fr(j,k,n){
                int z = y[i][j] - y[i-k][j] - y[i][j-k] + y[i-k][j-k];
                if(z <= 0){
                    ok = 1;
                }
            }
        }

        if(ok)
            h = mid;
        else
            l = mid + 1;
    }

    cout << l << endl;

}

signed main() {

    #ifdef LOCAL
        (void)!freopen("input.txt","r",stdin);
        (void)!freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(0), cin.tie(0);
    cout << fixed << setprecision(15);
    int t = 1;
    //cin >> t;

    while (t--)
        solve();
    return 0;
}

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

int divide(int a, int b) {
    return (a % mod) * powm(b % mod, mod - 2) % mod;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";

template<typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;

const int  MOD=1000000007;
const int N=100005;

int n,m;
int a[1505][1505];
bool vis[1505][1505][4];
map< pair<int,int> , int > mp;

void Run(int x,int y,int dx,int dy) {
    if (x <= 0 || y <= 0 || x > n || y > m)
        return;
    if (a[x][y] == -1)
        return;
    if (vis[x][y][mp[{dx, dy}]])
        return;
    vis[x][y][mp[{dx, dy}]] = true;
    Run(x + dx, y + dy, dx, dy);
}

void solve() {
    cin >> n >> m;
    memset(a, 0, sizeof(a));
    memset(vis, false, sizeof(vis));
    long bulb, block;
    cin >> bulb >> block;
    while (bulb--) {
        long x, y;
        cin >> x >> y;
        a[x][y] = 1;
    }
    while (block--) {
        long x, y;
        cin >> x >> y;
        a[x][y] = -1;
    }
    mp[{-1, 0}] = 0;
    mp[{1, 0}] = 1;
    mp[{0, -1}] = 2;
    mp[{0, 1}] = 3;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == 1) {
                Run(i, j, -1, 0);
                Run(i, j, 1, 0);
                Run(i, j, 0, -1);
                Run(i, j, 0, 1);
            }
        }
    }
    int Ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++)
            Ans += (vis[i][j][0] || vis[i][j][1] || vis[i][j][2] || vis[i][j][3]) * 1;
    }
    cout << Ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t=1;
    // cin>>t;                     // DON'T FORGET IT. ^^^
    for(long int tt=1;tt<=t;tt++){
        solve();
    }
    cerr << "Time : " << 1000 * ((double) clock()) / (double) CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MOD 998244353
//#define MAX 100100
#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL h;
    LL w;
    LL n;
    LL m;
    cin >> h >> w >> n >> m;
    vector<vector<LL>> brk(h, vector<LL>(w, 0));
    vector<vector<bool>> x_sft(h, vector<bool>(w, false));
    vector<vector<bool>> y_sft(h, vector<bool>(w, false));
    LL a;
    LL b;
    for(LL i=0; i<n; i++){
        cin >> a >> b;
        a--;
        b--;
        brk[a][b]=1;
        x_sft[a][b]=true;
        y_sft[a][b]=true;
    }
    for(LL i=0; i<m; i++){
        cin >> a >> b;
        a--;
        b--;
        brk[a][b]=NIL;
    }

    for(LL i=0; i<h; i++){
        for(LL j=1; j<w; j++){
            if(x_sft[i][j-1]==true && brk[i][j]!=NIL){
                x_sft[i][j]=true;
            }
        }
        for(LL j=w-2; j>=0; j--){
            if(x_sft[i][j+1]==true && brk[i][j]!=NIL){
                x_sft[i][j]=true;
            }
        }
    }

    for(LL i=0; i<w; i++){
        for(LL j=1; j<h; j++){
            if(y_sft[j-1][i]==true && brk[j][i]!=NIL){
                y_sft[j][i]=true;
            }
        }
        for(LL j=h-2; j>=0; j--){
            if(y_sft[j+1][i]==true && brk[j][i]!=NIL){
                y_sft[j][i]=true;
            }
        }
    }

    /*
    for(LL i=0; i<h; i++){
        for(LL j=0; j<w; j++){
            if(x_sft[i][j]==true){
                cout << 1;
            }else{
                cout << 0;
            }
        }
        cout << endl;
    }

    for(LL i=0; i<h; i++){
        for(LL j=0; j<w; j++){
            if(y_sft[i][j]==true){
                cout << 1;
            }else{
                cout << 0;
            }
        }
        cout << endl;
    }
    */
    LL ans=0;
    for(LL i=0; i<h; i++){
        for(LL j=0; j<w; j++){
            if(x_sft[i][j]==true || y_sft[i][j]==true){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#undef _GLIBCXX_DEBUG
// Problem: F - Rook on Grid
// Contest: AtCoder - Panasonic Programming Contest (AtCoder Beginner Contest 186)
// URL: https://atcoder.jp/contests/abc186/tasks/abc186_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;

struct splitmix64_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = std::chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};

template <typename K, typename V, typename Hash = splitmix64_hash>
using hash_map = __gnu_pbds::gp_hash_table<K, V, Hash>;

template <typename K, typename Hash = splitmix64_hash>
using hash_set = hash_map<K, __gnu_pbds::null_type, Hash>;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int n, m, o;
int row[maxN], col[maxN];

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> m >> o;
	RI(i, m) col[i] = -1;
	RI(i, n) row[i] = -1;
	REP(_, o) {
		int a, b; cin >> a >> b;
		if (row[a] == -1) row[a] = b - 1;
		else row[a] = min(row[a], b - 1);
		if (col[b] == -1) col[b] = a - 1;
		else col[b] = min(col[b], a - 1);
	}
	ll ans = 0;
	vector<pii> vec;
	if (row[1] == -1) row[1] = m;
	RI(i, m) {
		if (col[i] == -1) col[i] = n;
		if (i <= row[1]) {
			ans += col[i];
			vec.pb({col[i], i});
		} else {
			vec.pb({0, i});
		}
	}
	// cout << ans << endl;
	ordered_set s;
	sort(vec.begin(), vec.end());
	int cnt = 0;
	RI(i, col[1]) {
		while (cnt != m && vec[cnt].st < i) {
			s.insert(vec[cnt].nd);
			cnt++;
		}
		if (row[i] == -1) row[i] = m;
		// cout << i << " " << cnt << " " << row[i] << endl;
		ans += s.order_of_key(row[i] + 1);
	}
	cout << ans;
	return 0;
}

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

#define ALL(obj) (obj).begin(),(obj).end()
template<class T> using priority_queue_reverse = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = 1'000'000'000LL + 7; //'
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
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);}
vector<string> split(const string &str, const char delemiter) {vector<string> res;stringstream ss(str);string buffer; while( getline(ss, buffer, delemiter) ) res.push_back(buffer); return res;}
int msb(int x) {return x?31-__builtin_clz(x):-1;}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

/*
 * @title NBase - N進数
 * @docs md/util/NBase.md
 */
class NBase{
public:
	inline static vector<long long> translate(long long X,long long N) {
		assert(abs(N)>1);
		vector<long long> res;
		while(1) {
			long long b = (X%abs(N)+abs(N)) % abs(N);
			res.push_back(b);
			(X -= b) /= N;
			if(X==0) break;
		}
		return res;
	}
	//Digit Sum
	inline static constexpr long long digit_sum(long long N, long long K) {
		long long sum = 0;
		for (; N > 0; N /= K) sum += N % K;
		return sum;
	}
};

/**
 * @url
 * @est
 */
int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int A,B; cin >> A >> B;
    cout << max(NBase::digit_sum(A,10),NBase::digit_sum(B,10)) << endl;
    return 0;
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <sys/time.h>

using namespace std;

class XorShift128 {
private:
    uint32_t x, y, z, w;
public:
    XorShift128() : x(123456789), y(362436069), z(521288629), w(88675123) { }
    uint32_t rnd() {
        uint32_t t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    }
    uint32_t rnd(int n) {
        return rnd() % n;
    }
    uint32_t rnd(int l, int r) {
        return rnd() % (r - l + 1) + l;
    }
};

long long get_time() {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    long long result =  tv.tv_sec * 1000LL + tv.tv_usec / 1000LL;
    return result;
}

template<typename TYPE>
ostream& operator<<(ostream& ostr, const vector<TYPE>& vec) {
    ostr << "(";
    for(TYPE e : vec) {
        ostr << e << ", ";
    }
    ostr << ")";
    return ostr;
}

long long start;
XorShift128 xor_shift_128;

const int SIZE = 50;

class Solver {
    int sh, sw;
    int tile[SIZE][SIZE];
    int point[SIZE][SIZE];
public:
    Solver();
    void run();
};

Solver::Solver() {
    cin >> sh >> sw;
    for(int hi = 0; hi < SIZE; ++hi) {
        for(int wi = 0; wi < SIZE; ++wi) {
            cin >> tile[hi][wi];
        }
    }
    for(int hi = 0; hi < SIZE; ++hi) {
        for(int wi = 0; wi < SIZE; ++wi) {
            cin >> point[hi][wi];
        }
    }
}

void Solver::run() {

}

int main() {
    start = get_time();

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

    Solver solver;
    solver.run();
}

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

#define int long long
#define mat vector<vector<int>>
#define vi vector<int>
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define pi pair<int, int>
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for(int i=a; i<b; i++)
#define rrep(i,a,b) for(int i=b; i>=a; i--)
//#define endl "\n"

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
char dir[4]={'D','R','U','L'};

//****DO NOT TOUCH ABOVE THIS LINE****//
//#define kk

const int maxN=1e5+5;

int arr[50][50];
int joiner[50][50];
int vis[50][50];
int maxCost;
string ans;

bool isValid(int x, int y){
	if(x<0 || x>49 || y<0 || y>49 || vis[x][y]) return false;
	return true;
}

void dfs(int x, int y, int cost, string path){
	vis[x][y]=1;

	rep(i,0,4){
		int a=x+dx[i], b=y+dy[i];
		if(isValid(a,b) && joiner[a][b]==joiner[x][y]){
			vis[a][b]=1;
		}
	}

	int cnt=0;

	rep(i,0,4){
		int a=x+dx[i], b=y+dy[i];

		if(isValid(a,b)){
			cnt++;
			dfs(a,b,cost+arr[a][b],path+dir[i]);
		}
	}

	if(cnt==0){
		if(maxCost<cost){
			maxCost=cost;
			ans=path;
		}
	}

	//vis[x][y]=0;

	//rep(i,0,4){
		//int a=x+dx[i], b=y+dy[i];
		//if(joiner[a][b]==joiner[x][y]){
			//vis[a][b]=0;
		//}
	//}
}

void solve(){
	int x,y;
	cin>>x>>y;

	rep(i,0,50){
		rep(j,0,50){
			cin>>joiner[i][j];
		}
	}

	rep(i,0,50){
		rep(j,0,50){
			cin>>arr[i][j];
		}
	}

	dfs(x,y,arr[x][y],"");

	cout<<ans<<endl;
}

//****DO NOT TOUCH BELOW THIS LINE****//

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

	cout<<fixed<<setprecision(5);

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

	int T=1;
	//cin>>T;

	while(T--){
		solve();
	}
}