#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
#include<set>
#include<complex>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
    if(vec_n==-1)vec_n=vec_s.size();
    for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

namespace sol{
    const int N=7;
    bool twin[220000][N];

    void solve(){
        int n,m;
        int i,j,k;
        int a,b,c;
        cin>>n;
        string sa,sb;
        cin>>sa>>sb;
        twin[n][0]=true;
        for(i=n-1;i>=0;i--){
            a=sa[i]-'0';
            for(j=0;j<N;j++){
                b=j*10+a,c=j*10;
                b%=N,c%=N;
                if(sb[i]=='T')twin[i][j]=twin[i+1][b] || twin[i+1][c];
                else twin[i][j]=twin[i+1][b] && twin[i+1][c];
            }
        }
        if(twin[0][0])cout<<"Takahashi"<<endl;
        else cout<<"Aoki"<<endl;
    }
}

int main(){
    sol::solve();
}

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

using ll = long long;
using ld = long double;
using ii = pair<int, int>;

#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const int INF = 2e9;
const ll LINF = 9e18;
const int dr4[4] = {1, -1, 0, 0};
const int dc4[4] = {0, 0, 1, -1};
const int dr8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dc8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

double r, x, y;

void solve() {
  cin >> r >> x >> y;
  ld dist = sqrt(ld(x * x) + ld(y * y));
  ll ans = 0;
  while(1) {
    if(double(dist) <= double(r * 2)) break;
    dist -= r; ans++;
  }
  cout << ans + (dist == r ? 1 : 2) << "\n";
}

int main() {

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

  int T = 1;
  // cin >> T;
  for(int tc = 1; tc <= T; tc++) {
    solve();
  }

}


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

#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define FOR(i, j, k) for (int i = j; i < k; i++)
#define rloop(i, j, k) for (int i = j; i >= k; i--)
#define rep(i, k) for (int i = (0); i < (k); i++)
#define forall(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define lin "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(0)
#define PI 2 * acos(0.0)

typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;

void solve(){
    string s;
    cin >> s;
    int cnt = 0;
    for(char i: s){
        if(i == '.')
            break;
        cnt++;
        cout << i;
    }
    if(!cnt)
        cout << "0";
}

int main()
{
    auto start = clock();
    fast_io;
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    auto stop = clock();
    cerr << "time taken:" << double(stop - start) / double(CLOCKS_PER_SEC) << " s" << endl;
    return 0;
 }

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
#define scl(n) scanf("%lld", &n)
#define pcl(n) printf("%lld\n", n)
#define pcl1(n) printf("%lld ", n)
#define nln printf("\n")
#define yes printf("YES\n")
#define no printf("NO\n")
#define dev(x) cout << #x << " " << x << " ";
#define PTT pair<ll, ll>

map<ll, ll> mp, mp1;
map<ll, ll>::iterator itr;

int main()
{
    ll t, n, k, x, y, a, b, d;
    string s;
    cin >> s;
    bool bl = true;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '.')
        {
            bl = false;
        }

        if (bl)
        {
            cout << s[i];
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7
#define INF LONG_MAX/3
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
	ll N, M, K;
	cin >> N >> M >> K;
	vector<bool> loop(N, false);
	rep(i, K) {
		ll a;
		cin >> a;
		loop[a] = true;
	}
	vector<pair<double, double> >dp(N + M - 1);
	rep(i, N + M - 1) dp[i].first = 0;
	rep(i, N + M - 1) dp[i].second = 0;

	double a = 0;
	double b = 0;
	for(ll i = N - 1; i >= 0; i--) {
		a += dp[i + 1].first;
		b += dp[i + 1].second;
		a -= dp[i + 1 + M].first;
		b -= dp[i + 1 + M].second;

		if(loop[i]) {
			dp[i].first = 1;
			dp[i].second = 0;
		} else {
			dp[i].first = a/(double)M;
			dp[i].second = b/(double)M + 1;
		}
		//cout << "dp[" << i << "] = " << dp[i].first << " x + " << dp[i].second << endl;
	}

	if(dp[0].first > 1 - 0.000001 && dp[0].first <  1 + 0.000001) {
		cout << -1 << endl;
	} else {
		printf("%.10f\n", dp[0].second/(1-dp[0].first));
	}
}

#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

const double eps = 1e-9;

template <typename T>
struct SegmentTree
{
    using F = function<T(T, T)>;

    const F f;
    const T e;

    int n;
    vector<T> seg;

    SegmentTree(int nn, const F f, const T e) : f(f), e(e){
        n = 1;
        while(n < nn) n <<= 1;
        seg.assign(n * 2, e);
    }

    void set(int i, T x){
        seg[i + n] = x;
    }

    void build(){
        for(int k = n - 1; k > 0; k--){
            seg[k] = f(seg[k * 2], seg[k * 2 + 1]);
        }
    }

    void update(int i, T x){
        int k = i + n;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k * 2], seg[k * 2 + 1]);
        }
    }

    T query(int l, int r){
        l += n, r += n;
        T L = e, R = e;
        for(; l != r; l >>= 1, r >>= 1){
            if(l % 2) L = f(L, seg[l++]);
            if(r % 2) R = f(seg[--r], R);
        }
        return f(L, R);
    }

    T operator[](const int i)const {
        return seg[i + n];
    }

    template<typename C>
    int right_bound_sub(int k, const C &check, T x){
        while(k < n){
            if(check(f(x, seg[k * 2]))){
                k = k * 2;
            }
            else{
                x = f(x, seg[k * 2]);
                k = k * 2 + 1;
            }
        }
        return k - n;
    }

    template <typename C>
    int right_bound(int i, const C &check){
        T x = e;
        for(int l = i + n, r = n * 2; l != r; l >>= 1, r >>= 1){
            if(l % 2){
                if(check(f(x, seg[l]))){
                    return right_bound_sub(l, check, x);
                }
                x = f(x, seg[l]);
                l++;
            }
        }
        return -1;
    }

    template <typename C>
    int left_bound_sub(int k, const C &check, T x){
        while(k < n){
            if(check(f(seg[k * 2 + 1], x))){
                k = k * 2 + 1;
            }
            else{
                x = f(seg[k * 2 + 1], x);
                k = k * 2;
            }
        }
        return k - n;
    }

    template <typename C>
    int left_bound(int i, const C &check){
        T x = e;
        for(int l = n, r = i + n; l != r; l >>= 1, r >>= 1){
            if(r % 2){
                if(check(f(seg[--r], x))){
                    return left_bound_sub(r, check, x);
                }
                x = f(x, seg[r]);
            }
        }
        return -1;
    }
};

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    SegmentTree<double> seg0(n + m, [](double a, double b){return a + b;}, 0);
    SegmentTree<double> sego(n + m, [](double a, double b){return a + b;}, 0);
    for(int i = 0; i < k; i++){
        int a;
        cin >> a;
        seg0.update(a, 1);
    }
    seg0.build();
    for(int i = n - 1; i >= 0; i--){
        if(seg0[i] > 0.5) continue;
        seg0.update(i, seg0.query(i, i + m + 1) / m);
        sego.update(i, sego.query(i, i + m + 1) / m + 1);
    }
    if(seg0[0] > 1 - eps) cout << -1 << endl;
    else cout << fixed << setprecision(15) << sego[0] / (1 - seg0[0]) << endl;
}


#include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
using ll = long long;
ll MOD = 1e9+7;

ll g(ll x){
	int ret = 1;
	for(int i = 0;i<x;i++){
		(ret*=2)%=MOD;
	}
	return ret;
}

ll f(ll x){
	ll ret;
	ll ret_1 = 1;
	ll ret_2 = 1;
	for(int i = 0;i<x-1;i++){
		(ret = ret_1 + ret_2)%=MOD;
		ret_2 = ret_1;
		ret_1 = ret;
	}
	return ret;
}
int main()
{
	int n;cin >> n;
	char c[4];
	for(int i = 0;i<4;i++)cin >> c[i];
	if(n<4){
	cout<<1<<endl;
	return 0;
	}
	ll ans;
	if(     c[0]=='A'&&c[1]=='A')                      ans=1;
	else if(           c[1]=='B'&&           c[3]=='B')ans=1;
	else if(           c[1]=='B'&&c[2]=='A'&&c[3]=='A')ans = g(n-3);
	else if(c[0]=='B'&&c[1]=='A'&&c[2]=='B')           ans = g(n-3);
	else if(           c[1]=='B'&&c[2]=='B'&&c[3]=='A')ans = f(n-2);
	else if(c[0]=='B'&&c[1]=='A'&&c[2]=='A')           ans = f(n-2);
	cout<<ans<<endl;
}

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

//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long double db;

#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

template<typename T> void print(const T& a, ostream& out){
	for(auto i: a) out << i << ' ';
	out << endl;
}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace IntModulo
{
	const int mod = 1e9 + 7;

	inline int add(int x, int y, int m = mod)
	{
		if (x + y < m)
			return x + y;
		return x + y - m;
	}

	inline int sub(int x, int y, int m = mod)
	{
		if (x >= y)
			return x - y;
		return x - y + m;
	}

	inline int mult(int x, int y, int m = mod)
	{
		return x * (LL) y % m;
	}

	inline int power(int x, LL y, int m = mod)
	{
		int r = 1;
		while(y)
		{
			if (y & 1)
				r = mult(r, x, m);
			x = mult(x, x, m);
			y >>= 1;
		}

		return r;
	}

	inline int inverse(int x, int m = mod)
	{
		return power(x, m - 2, m);
	}

	inline void ADD(int& x, int y, int m = mod){
		x += y;
		if (x >= m) x -= m;
	}

	inline void SUB(int& x, int y, int m = mod){
		x -= y;
		if (x < 0) x += m;
	}

	inline void MULT(int& x, int y, int m = mod){
		x = (x * (LL) y) % m;
	}
};

using namespace IntModulo;
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n; cin >> n;
	string s;
	FOR(i, 0, 4){
		char x; cin >> x;
		s += x;
	}

	if (s == "BAAA" || s == "ABBA" || s == "BBBA" || s == "BAAB"){
		vector<int> f(n + 1);
		f[1] = f[2] = 1;
		FOR(i, 3, n + 1) f[i] = add(f[i - 1], f[i - 2]);
		cout << f[n - 1] << endl;
	}else if (s == "ABAA" || s == "BBAA" || s == "BABA" || s == "BABB"){
		cout << (n == 2 ? 1 : power(2, n - 3)) << endl;
	}else cout << 1 << endl;

	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
    return 0;
}


#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
string a[200100], b[200100];
int main()
{
    int n;
    cin >> n;

    string p, t;
    int numa = 0, numb = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> p;
        if (p[0] == '!')
        {
            t = "";
            for (int x = 1; p[x] != 0; x++)t += p[x];
            b[numb++] = t;
        }
        else a[numa++] = p;
    }
    sort(a, a + numa);
    sort(b, b + numb);
    for (int i = 0; i < numb; i++)
        if (binary_search(a, a + numa, b[i]))
        {
            cout << b[i];
            return 0;
        }
    cout << "satisfiable";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long double ld;
#define int long long
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define vii vector<int>
#define pii pair<int,int>
#define piii pair<int, pii>
#define yes cout<<"YES\n";
#define no  cout<<"NO\n";
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define PI 3.1415926535897932384626433832795
#define dec(x) fixed<<setprecision(x)
#define tc int t;cin>>t;while(t--)
#define pr(x) for(auto it : x)cout<<it<<" ";
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a*b/__gcd(a,b))
#define fi(i,n) for(int i=0;i<n;i++)
#define f(i, a, b) for(int i=a;i<b;i++)
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
#define cint4(a,b,c,d) int a,b,c,d;cin>>a>>b>>c>>d
#define all(v)  v.begin(),v.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
#define endl cout<<"\n";
#define print1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<" ";}endl;}
#define scan1(a,n) for(int i=1;i<=n;i++) cin>>a[i]
#define scan(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "
#define cout1(a) cout<<a;endl
#define cout2(a,b) cout<<a<<" "<<b;endl
#define cout3(a,b,c) cout<<a<<" "<<b<<" "<<c;endl
#define cout4(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d;endl

map<int,int>mp;

int comp(int a, int b){
    return (a>b);
}

bool prime(int n)
{
   if(n==0 or n==1) return false;
   if(n==2) return true;
   else if(n%2==0) return false;
   for(int i=3;i*i<=n;i+=2)
   {
       if(n%i==0)
       {
           return false;
       }
   }
   return true;
}

int binCo(int n, int r){
    int C[n+1][r+1];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=min(i,r);j++)
        {
            if(j==0 or j==i)
            C[i][j] = 1;
            else
            C[i][j] = C[i-1][j] + C[i-1][j-1];
        }
    }
    return C[n][r];
}

//Modular Exponentiation O(Log y)
int power(int x, int y, int MODL) {
	int res = 1;
	x = x % MODL;
	while (y > 0) {
		if (y & 1)
			res = (res*x) % MODL;
		y = y>>1;
		x = (x*x) % MODL;
	}
	return res;
}

//Fermat's Little theorem, O(Log m)
int modInverse(int a, int m) {
	   return power(a, m-2, m);
}
int binSearch(int arr[], int n, int x)
{
    int l = 0, r=n-1;
    while(l<=r)
    {
        int mid = (l+r)/2;
        if(x==arr[mid])
        return mid;
        if(x>arr[mid])
        {
           l = mid+1;
        }
        else
        if(x<arr[mid])
        {
            r = mid-1;
        }
    }
    return -1;
}

bool sortBySec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}

void solve()
{
   int n;
   cin>>n;
   map<int,string>mp;
   vii v(n),v2;
   for(int i=0; i<n; i++){
       string s;int n1;
       cin>>s>>n1;
       v[i] = n1;
       mp[v[i]] = s;
   }
   int mx = *max_element(all(v));
   for(int i=0;i<n;i++){
       if(v[i]!=mx)v2.pb(v[i]);
   }
   mx  = *max_element(all(v2));
   cout<<mp[mx];

}
int32_t main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<ll> A(N), P(N), X(N);
    REP(i, 0, N) cin >> A[i] >> P[i] >> X[i];

    ll ans = 1LL << 60;

    vector<int> I(N);
    iota(ALL(I), 0); sort(ALL(I), [&](auto l, auto r) { return A[l] < A[r]; });

    for (auto i : I) {
        if (X[i] - A[i] > 0) {
            ans = min(ans, P[i]);
        }
    }
    if (ans < (1LL << 60)) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

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

int main()
{
    io;
    int n; cin >> n;
    vector<int> a(n), b(n);
    vector<vector<int>> c(n, vector<int>(n, 0));
    rep(i, n) rep(j, n) {
        cin >> c[i][j];
    }
    b = c[0];
    a[0] = 0;
    bool flag = true;
    for (int i = 1; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            int diff = c[i][0] - c[0][0];
            if (c[i][j] - c[0][j] != diff) {
                flag = false;
                break;
            }
            a[i] = diff;
        }
    }

    int mn = *min_element(a.begin(), a.end());
    if (mn < 0) {
        rep(i, n) {
            a[i] -= mn;
            b[i] += mn;
            if (b[i] < 0) {
                flag = false;
                break;
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
        rep(i, n) {
            cout << a[i];
            if (i != n-1) cout << " ";
        }
        cout << endl;
        rep(i, n) {
            cout << b[i];
            if (i != n-1) cout << " ";
        }
        cout << endl;
    } else cout << "No" << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  if (a==191){
    cout<<"so-so";
  }
  else if (a<191){
    cout<<"Yay!";
  }
  else {
    cout<<":(";
  }
}

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

#define endl ('\n')
#define pi (3.141592653589)
#define mod 1e9 + 7
#define int long long
#define float double
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define ret return 0;

void solve()
{

    /*Write the Solution Here*/
    int N;
    cin >> N;
    if (floor(1.08 * N) < 206)
        cout << "Yay!" << endl;
    else if (floor(1.08 * N) == 206)
        cout << "so-so" << endl;
    else
        cout << ":(" << endl;
}

int32_t main()
{
    fast
    // test
    solve();
    ret
}


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

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

using namespace std;

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

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

int main() {

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

  int A, B; cin >> A >> B;
  cout << A * 2 + 100 - B << endl;

  return 0;
}

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

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

int main(){
	int64_t a, b, c, d;
	cin >> a >> b;
	cin >> c >> d;

	cout << b - c << endl;

	return 0;
}


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

int main(void) {
  int a,b;
  cin >> a >> b;
  int ans;
  int x;
  for(int i=1 ; i<=b/2 ; i++)
  {
    if(a%i==0)
    {
      x=a/i;
    }
    else
    {
      x=a/i+1;
    }

    if(i*(x+1)<=b)
    {
      ans=i;
    }
  }
  cout << ans << endl;
  return 0;
}

// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int main() {
    ll A, B; cin >> A >> B;

    vector<int> cnt(200010);
    for(int i=A; i<=B; i++) {
        int v = i;
        for(ll j=1; j*j<=v; j++) {
            if(v % j == 0) {
                cnt[j]++;
                if(j != v/j) cnt[v/j]++;
            }
        }
    }

    int ans = 0;
    for(int i=1; i<200010; i++) {
        if(cnt[i] >= 2) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
const ll mod = (ll) 1e9+7;
using namespace std;

int main()
{
    int N,T;
    cin >> N >> T;
    vector<ll> A,B;

    for(int i=0;i<N;i++)
     {
        if (i<N/2) {
            int a;
            cin >> a;
            A.push_back(a);
        }
        else {
            int b;
            cin >> b;
            B.push_back(b);
        }
    }

    vector<ll> C,D;

    for(int bit=0; bit< (1 << A.size()) ;bit++)
     {
        ll sum = 0;
         for(int i=0; i<  A.size() ;i++)
       {
            if (bit & 1<<i) {
                sum += A[i];
            }
        }
        C.push_back(sum);
    }
    for(int bit=0; bit< (1 << B.size()) ;bit++)
     {
        ll sum = 0;
         for(int i=0; i<  B.size() ;i++)
       {
            if (bit & 1<<i) {
                sum += B[i];
            }
        }
        D.push_back(sum);
    }

    sort(D.begin(),D.end());
    ll ans = 0;
   for(int i=0; i<  C.size() ;i++)
    {
        ll res = T-C[i];
        if (res>0)
         {
            int idx = upper_bound(D.begin(),D.end(),res) - D.begin();
            if (idx>0)
            {
                res -= D[idx-1];
            }
            ans = max(ans,T-res);
        }
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

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

const int N = 1e3 + 5;

vector <int> Edge[N][26];

int n, m;
struct info { int x, y; } E[N];

int dis[N][N];
queue < pair <int, int> > q;
bool inq[N][N];

inline void spfa()
{
	memset(dis, 0x3f, sizeof(dis));
	dis[1][n] = 0; q.push(make_pair(1, n)); inq[1][n] = 1;

	int x, y;
	while (!q.empty())
	{
		x = q.front().first, y = q.front().second; q.pop(); inq[x][y] = 0;

		for (int p = 0; p < 26; p++)
		for (int i = 0; i < (int) Edge[x][p].size(); i++)
		for (int j = 0; j < (int) Edge[y][p].size(); j++)
		{
			int px = Edge[x][p][i], py = Edge[y][p][j];
			if (dis[x][y] + 2 < dis[px][py])
			{
				dis[px][py] = dis[x][y] + 2;
				if (!inq[px][py])
				{
					inq[px][py] = 1;
					q.push(make_pair(px, py));
				}
			}
		}
	}
}

int main()
{
	read(n); read(m);
	char s[2];
	for (int i = 1; i <= m; i++)
	{
		read(E[i].x); read(E[i].y); scanf ("%s", s);

		int p = s[0] - 'a';
		Edge[E[i].x][p].push_back(E[i].y);
		Edge[E[i].y][p].push_back(E[i].x);
	}
	spfa();
	int ans = 0x3f3f3f3f;
	for (int i = 1; i <= n; i++) ans = min(ans, dis[i][i]);
	for (int i = 1; i <= m; i++)
	{
		int x = E[i].x, y = E[i].y;
		ans = min(ans, dis[x][y] + 1);
		ans = min(ans, dis[y][x] + 1);
	}
	if (ans == 0x3f3f3f3f) puts("-1");
	else printf ("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

// using mint = long double;
// using mint = modint998244353;
// using mint = modint1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 2e18;
const ll fact_table = 1200008;

priority_queue<ll> pql;
priority_queue<P> pqp;
// big priority queue
// priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue<P, vector<P>, greater<P>> pqps;
// small priority queue
// top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/

#define p(x) cout << x << endl;
#define el cout << endl;
#define pe(x) cout << x << " ";
#define ps(x) cout << fixed << setprecision(25) << x << endl;
#define pu(x) cout << (x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = a; i <= (b); i++)
#define rep3(i, a, b) for (ll i = a; i >= (b); i--)
#define all(c) begin(c), end(c)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

// vec v(n) -> 長さnのベクトルを宣言
// mat dp(h, vec(w)) -> h * w の行列を宣言

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {
    ll x = 1;
    while (b) {
        while (!(b & 1)) {
            (a *= a) %= m;
            b >>= 1;
        }
        (x *= a) %= m;
        b--;
    }
    return x;
}
vec rv(ll read) {
    vec res(read);
    for (int i = 0; i < read; i++) {
        cin >> res[i];
    }
    return res;
}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod) * rfact[n - r]) % mod;
}
*/
bool icpc = false;
bool multicase = false;

ll n, k;
ll dist = 0, cnt = 0;

vec G[500005];

P dfs(int v, int p) {
    // first  : 一番近い黒までの距離
    // second : 一番遠い白までの距離
    ll black = INF, white = 0;

    for (auto nv : G[v]) {
        if (nv == p) continue;
        auto [b, w] = dfs(nv, v);
        b++;
        w++;
        black = min(black, b);
        white = max(white, w);
    }

    if (white + black <= dist) {
        white = -1;
    }
    if (white == dist) {
        cnt++;
        white = -1, black = 0;
    }
    if (p == -1 && white >= 0) {
        cnt++;
    }
    return P(black, white);
}

int calc(ll mid) {
    dist = mid;
    cnt = 0;
    P res = dfs(1, -1);
    return cnt;
}

bool solve() {
    cin >> n >> k;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }

    ll ok = n, ng = -1;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (calc(mid) <= k) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    p(ok);
    return true;
}

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

    if (icpc) {
        while (solve())
            ;
        return 0;
    }
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        solve();
        testcase++;
    }

    // solve();
    return 0;
}

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

//head

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vvi G(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  vi check(n);
  auto dfs = [&](auto self, int i, int j, int ud)->tuple<int, int> {
    int d = ud, mid = i;
    int to = -1;
    for(auto ne:G[i]) {
      if(ne == j) continue;
      auto [nd, nmid] = self(self, ne, i, ud+1);
      if(chmax(d, nd)) {
        mid = nmid;
        to = ne;
      }
    }
    for(auto ne:G[i]) {
      if(ne == j) continue;
      if(to != ne) check[ne] = 1;
    }
    return {d, mid};
  };
  auto [d, mid] = dfs(dfs, 0, -1, 0);
  int z = mid;
  fill(all(check), 0);
  tie(d, mid) = dfs(dfs, z, -1, 0);
  vi e(n);
  int now = 1;
  auto dfs2 = [&](auto self, int i, int j)->void {
    e[i] = now++;
    int to = -1;
    for(auto ne:G[i]) {
      if(ne == j) continue;
      if(check[ne] == 0) {
        to = ne;
        continue;
      }
      self(self, ne, i);
    }
    if(to != -1) {
      self(self, to, i);
    }
    now++;
  };
  dfs2(dfs2, z, -1);
  rep(i, n) cout << e[i] << (i == n-1?'\n':' ');
}


#include <bits/stdc++.h>

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

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

const ll MOD = 1000000007;
const int _max = 2000000;
vector<ll> fact(_max+1), factinv(_max+1);

//Fast modular exponentiation
long long fast_exp(long long base, long long exp, long long mod) {
    long long res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       exp/=2;
    }
    return res%mod;
}

void precompute(){
        fact[0] = 1;
        for(int i = 1; i <= _max; i++){
                fact[i] = (fact[i-1]*i)%MOD;
        }
        for(int i = 0; i <= _max; i++){
                factinv[i] = fast_exp(fact[i], MOD-2, MOD);
        }
}

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    if(n-k-1 >= m){
            cout << 0 << "\n";
    }
    else{
            ll total = (((fact[n+m]*factinv[n])%MOD)*factinv[m])%MOD;
            //cout << total << "\n";
            if(n == k){
                    cout << total << "\n";
            }
            else{
                    ll bad = (((fact[n+m]*factinv[n-k-1])%MOD)*factinv[m+k+1])%MOD;
                    ll ans = total - bad;
                    if(ans < 0) ans += MOD;
                    cout << ans << "\n";
            }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    precompute();
    //ll t;
    //cin >> t;
    t = 1;
    while(t--)solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 5;
const int mod = 1e9 + 7;

int n, m, k, fact[N], ifact[N];

void add(int &x, int y) {
    x += y;
    if (x >= mod) x -= mod;
}

void sub(int &x, int y) {
    x -= y;
    if (x < 0) x += mod;
}

int binPow(int x, int y) {
    int ans = 1;
    while (y > 0) {
        if (y & 1) ans = 1LL * ans * x % mod;
        x = 1LL * x * x % mod;
        y >>= 1;
    }

    return ans;
}

int C(int n, int k) {
    if (k > n || k < 0 || n < 0) return 0;
    return 1LL * fact[n] * ifact[k] % mod * ifact[n - k] % mod;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m >> k; fact[0] = ifact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = 1LL * fact[i - 1] * i % mod;
        ifact[i] = binPow(fact[i], mod - 2);
    }

    if (m <= n - k - 1) {
        cout << 0 << "\n";
        return 0;
    }

    int ans = C(n + m, n);
    sub(ans, C(n + m, n - k - 1));
    cout << ans << "\n";
    return 0;
}


/*HAR HAR MAHADEV
ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
//think twice code once
//when its getting hard why you started
# include   <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;//typedef for datatype and #define for macro

# define    fast                ios_base::sync_with_stdio(false);cin.tie(NULL);
# define    MOD                 1000000007
# define    endl                '\n'
# define    FOR(i, a, b)        for (int i=a; i<(b); i++)
# define    F0R(i, a)           for (int i=0; i<(a); i++)
# define    FORd(i,a,b)         for (int i = (b)-1; i >= a; i--)
# define    F0Rd(i,a)           for (int i = (a)-1; i >= 0; i--)
# define    INF                 9e18
# define    PI                  3.14159265358979323846
# define    lb                  lower_bound
# define    ub                  upper_bound
# define    mp                  make_pair
# define    pb                  push_back
# define    fi                  first
# define    se                  second
# define    all(a)              a.begin(), a.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
    fast;
    ll t = 1;
    // cin >> t;
    while (t--)
    {
        ll n, x, i, ans = -1, sum = 0;
        cin >> n >> x;
        vector<pair<ll, ll>> v;
        for (i = 0; i < n; i++)
        {
            ll a, b; cin >> a >> b;
            v.emplace_back(a, b);
        }
        for (i = 0; i < n; i++)
        {
            sum += (v[i].fi * v[i].se);
            if (sum > 100 * x)
            {
                ans = i + 1;
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}
/* stuff you should look for
* stack/set/gcd/palindrome/twopointer/slidingwindow
prefix sum/range query/ patterns/matrices/string
lexographicaly/xoor/subsequence subarray/overlapping intervals
factors(rootn)   primefactorisation  vectorofallfactors dfs bfs msdfs

availaible snip-dfs,mint,quadraticformula,2dvector
mytemp,negativemod,primefactorisation
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
  * WRITE STUFF DOWN
  * DON'T GET STUCK ON ONE APPROACH
*/

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

int main() {
  int N;
  ll X;
  cin >> N >> X;
  X *= 100;
  rep(i,N) {
    ll V,P;
    cin >> V >> P;
    X -= V*P;
    if (X<0) {
      print(i+1);
      return 0;
    }
  }
  print(-1);
  return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include "bits/stdc++.h"
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update>
//    ost;
#define rep(i,l,r)   for (int i = (l); i < (r); i++)
#define here cout << " Hey!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
template <typename T>
void etch(T V) {
    for (auto x : V)    cout << x << ' ' ;
    cout << '\n';
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld EPS = 1e-12;
const ld PI = 3.141592653589793116;
int dx[] = {1, -1, 1, -1};
int dy[] = {1, -1, -1, 1};
int32_t main()
{
    SYNC
    int h, w; cin >> h >> w;
    int a[h][w];
    memset(a, 0, sizeof a);
    rep(i,0,h) {
        rep(j,0,w) {
            char ch; cin >> ch;
            if (ch != '#') a[i][j] = 1;
        }
    }
    int ans = 0;
    rep(i,1,h-1) {
        rep(j,1,w-1) {
            if (a[i][j])    continue;
            rep(k,0,4) {
                if (a[i+dx[k]][j+dy[k]] && !(a[i][j+dy[k]] ^ a[i+dx[k]][j])) {
                    ans++;
                }
            }
        }
    }
    cout << ans;
    return 0;
}

#include<iostream>
#include<math.h>
using namespace std;
int main(){

    long int n, m, x, arr[1001]={0}, total=0;

    cin>>n>>m;

    while(n>0){
        cin>>x;
        arr[x-1] = 1;
        total++;
        n--;
    }
    while(m>0){
        cin>>x;
        if(arr[x-1] == 1){
            arr[x-1] = 0;
            total--;
        }
        else{
            arr[x-1] = 1;
            total++;
        }
        m--;
    }

    n=0;    m=total;
    while(total>0){
        if(arr[n] != 0) {
            if(total != m) cout<<" ";
            cout<<n+1;
            total--;
        }
        n++;
    }

    return 0;
}


#include <bits/stdc++.h>
#include<sstream>
#include<string>
#include<vector>
#include <set>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
long long M=1000000007;
using namespace std;
ll fact[1000000];
ll power(ll x, unsigned ll y, unsigned ll m)
{
    if (y == 0)
        return 1;
    ll p = power(x, y / 2, m) % m;
    p = (p * p) % m;

    return (y % 2 == 0) ? p : (x * p) % m;
}
unsigned long long modInverse(unsigned long long n,
                                            int p)
{
    return power(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n,
                                 unsigned long long r, int p)
{
    // If n<r, then nCr should return 0
    if (n < r)
        return 0;
    // Base case
    if (r == 0)
        return 1;
    return (fact[n] * modInverse(fact[r], p) % p
            * modInverse(fact[n - r], p) % p)
           % p;
}
int32_t main()
{
  IOS
  char c1,c2,c3;
  cin>>c1>>c2>>c3;
  if(c1==c2 && c2==c3)
  {
      cout<<"Won"<<endl;
  }
  else
  {
      cout<<"Lost";
  }
  return 0;
}

#pragma region Region_1

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
using ll = long long;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VP = vector<P>;
using VS = vector<string>;
using VC = vector<char>;
using VVC = vector<vector<char>>;
#define MOD 1000000007
const int INF = 1e9 + 10;          // int max > 2*10^9
const long long INFL = 2e18 + 10;  // ll max > 9*10^18

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

template <class T>
T sum(const vector<T>& v) {
    T res = 0;
    for (size_t i = 0; i < v.size(); ++i) res += v[i];
    return res;
}

/////////////////////////////////////////////////////////
// print like python
// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed
/////////////////////////////////////////////////////////
void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T>& vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << " ";
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>>& df) {
    for (auto& vec : df) {
        print(vec);
    }
}

#pragma endregion Region_1
/////////////////////////////////////////////////////////

int main() {
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::cout << std::setprecision(15);
    //////////////////////////////////////////
    string c;
    cin >> c;
    set<char> s;
    rep(i, 3) { s.insert(c[i]); }
    if(s.size()>1){
        print("Lost");
    }else{
        print("Won");
    }

    return 0;
}


#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#pragma GCC optimize "trapv"
#endif

#include <bits/stdc++.h>
using namespace std;
#define fast \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL); \
 cout << setprecision(12) << fixed;
#define ll long long int
#define line cout << endl;
#define all(x) x.begin(), x.end()
#define pb emplace_back
#define mp make_pair
#define I emplace
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define maxPQi priority_queue<int>
#define minPQi priority_queue<int, vector<int>, greater<int>>

const int MAXN = 1000002;
const int MOD = 1000000007;
const int MOD2 = 998244353;
const ll INF = 1e18L;

// TEMPLATES
// cin >> pair<T1, T2>
template <typename T1, typename T2>
istream &operator>>(istream &istream, pair<T1, T2> &p) {
  istream >> p.first >> p.second;
  return istream;
}
// cin >> vector<T>
template <typename T> istream &operator>>(istream &istream, vector<T> &v) {
  for (auto &it : v)
    cin >> it;
  return istream;
}
// cout << pair<T1, T2>
template <typename T1, typename T2>
ostream &operator<<(ostream &ostream, const pair<T1, T2> &p) {
  ostream << p.first << " " << p.second;
  return ostream;
}
// cout << vector<T>
template <typename T>
ostream &operator<<(ostream &ostream, const vector<T> &c) {
  for (auto &it : c)
    cout << it << " ";
  return ostream;
}
// Debugging
template <typename T> void DEB(T &&t) {
#ifndef ONLINE_JUDGE
  cout << t << "\n";
#endif
}
template <typename T, typename... Args> void DEB(T &&t, Args &&... args) {
#ifndef ONLINE_JUDGE
  cout << t << " ";
  DEB(forward<Args>(args)...);
#endif
}

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

map<ll, ll> getPF(ll n) {
  map<ll, ll> ans;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ans[i]++;
      n /= i;
    }
  }
  if (n > 1)
    ans[n]++;
  return ans;
}

ll modexp(ll n, ll p, int mod = 1e9 + 7) {
  ll ans = 1;
  n %= mod;
  while (p) {
    if (p & 1)
      ans = (ans * n) % mod;
    p >>= 1; // divide by 2
    n = (n * n) % mod;
  }
  return ans;
}

ll LCM(ll a, ll b) { return (a * b) / __gcd(a, b); }

ll fact[MAXN] = {0};
void getFactorials() {
  fact[0] = fact[1] = 1;
  for (int i = 2; i < MAXN; i++) {
    fact[i] = (fact[i - 1] * i * 1LL) % MOD;
  }
}

vector<int> primes;
void sieve(int n) {
  vector<bool> prime(n + 1, true);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p)
        prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) primes.pb(p);
}

ll ncr(ll n, ll r, int mod = 1e9 + 7) {
  if (n < r)
    return 0;
  if (r == 0)
    return 1;
  ll num = fact[n], den = (fact[n - r] * fact[r]) % mod;
  ll inv = modexp(den, mod - 2);
  return (num * inv) % mod;
}

// *** SOLVE HERE *** //
void presolve() {}

void solve(int test_case) {
  int a,b;
  cin>>a>>b;
  int ans=1,lim=b/2,diff = b-a;
  if (lim>=a) {
    cout << lim << '\n';
    return ;
  }
  for (int i = diff; i >= 1; i--) {
    int t1 = (a+i-1)/i, t2 = b/i;
    int l1 = t1*i, l2 = t2*i;
    // cout << i<<" "<<l2<<" "<<l1 << '\n';
    if (l1<=b and l2>=a and l1!=l2 ) {
      cout << i << '\n';
      return;
    }
  }
}

int main() {
  fast
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt", "w", stdout);
  // #endif
  presolve();
  int t = 1;
  // cin >> t;
  for (int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    int ans=1;
    for(int i=2;i<=b-a;i++){
        int c=ceil(a/(double) i),d=b/(double) i;
        if(d-c>0) ans=i;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pi (3.141592653589)
#define pb push_back
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define pll pair<ll , ll>
#define ff first
#define ss second

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll t = 1;
//cin>>t;
while(t--){
  string s;
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2]) cout << "Won\n";
  else cout << "Lost\n";
}
return 0;
}

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

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

	int n;
	cin >> n;

	if (n == 0) {
		cout << "Yes\n";
		return 0;
	}

	vector < int > digits;
	while (n > 0) {
		digits.push_back(n % 10);
		n /= 10;
	}

	int i = 0, j = (int)digits.size() - 1;
	while(i < (int)digits.size() && digits[i] == 0) i++;
	while(j >= 0 && digits[j] == 0) j--;

	bool ok = true;
	while (i <= j) {
		if (digits[i] != digits[j]) {
			ok = false;
			break;
		}
		i++;
		j--;
	}

	cout << (ok ? "Yes" : "No") << '\n';
}


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

using namespace std;

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

char ispis[500];

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	cout<<(1<<n)-1<<"\n";
	for(int i=1;i<(1<<n);i++){
		for(int j=0;j<(1<<n);j++){
			int x=__builtin_popcount((i&j));
			if(x%2) ispis[j]='A';
			else ispis[j]='B';
		}
		for(int j=0;j<(1<<n);j++){
			cout<<ispis[j];
		}
		cout<<"\n";
	}

return 0;
}


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

#define ll long long
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define print_upto(a,n)        for(ll i=1;i<=n;i++)    cout<<a[i]<<" "; cout<<endl
#define take(a,n)           for(ll i=1;i<=n;i++)  cin>>a[i];

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"

#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define inf INT_MAX
// cout << fixed << setprecision(9) << ans << nl;

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll, ll> pll;
typedef map< ll, ll> mll;

const ll N = 200009;

void solve() {
	ld x, y, r;
	cin>>x>>y>>r;

	double ep = 1e-14;
	r = r + ep;

	ld lx = x-r;
	ld rx = x+r;

	ld llx = ceil(lx);
	ld rrx  = floor(rx);

	ll ans=0;
	for(ld i=llx;i<=rrx;i++){
		ld res = (r*r) - (i-x)*(i-x);
		if(res<0)
			continue;
		res = sqrt(res);

		ld ly = res + y;
		ld ry = -res + y;

		ld lly = ceil(ry);
		ld rry = floor(ly);

		ans += (ll)(rry-lly+1);
	}

	cout<<ans<<nl;
}

int main() {

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

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

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

	return 0;
}

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

ll solve(ld x, ld y, ld r) {
    ll res = 0ll;
    ll top = floor(y + r);
    ll under = ceil(y - r);
    r= nextafter(r, INFINITY);

    for(ll i = top; i >= under; i--) {
        ld width = sqrt(r * r - abs(i - y) * abs(i - y));
        res += floor(x + width) - ceil(x - width) + 1;
    }

    return res;
}

int main() {
    ld x, y, r;
    cin >> x >> y >> r;
    cout << solve(x, y, r) << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> aj[200005];
ll arr[200005],m,cnt2 = 0;
pair<bool, ll> f[200005];
void dfs(ll x,ll p){
	ll mt = -2e9,mf = 0;
	for(auto it:aj[x]){
		if(it==p)continue;
		dfs(it,x);
		if(f[it].first)mt = max(mt,f[it].second);
		else mf = max(mf,f[it].second);
	}
	if(mt>=mf){
		f[x] = make_pair(true,mt-1);
	}else{
		f[x] = make_pair(false,mf+1);
	}
	if(f[x].first&&f[x].second<0)f[x] = make_pair(false,0);
	else if(!f[x].first&&f[x].second>m){
		cnt2++;
//		cout<<x<<" added\n";
		f[x] = make_pair(true,m-1);
	}
//	cout<<m<<" "<<x<<" "<<f[x].first<<" "<<f[x].second<<'\n';
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,h,q,t,i,e,j,k,a,b,c,x,y,z,sum=0,cnt=0,minx=2e9,maxn=0,x1,y1;
	string str;
	cin>>n>>k;
	for(i=0;i<n-1;i++){
		cin>>a>>b;
		aj[a].push_back(b);
		aj[b].push_back(a);
	}
	ll lo = 0,hi = n,mid,ans=0;
	while(lo<=hi){
		mid = (lo+hi)/2;
		m = mid;
		cnt2 = 0;
		dfs(1,0);
//		cout<<m<<" ";
		if(!f[1].first&&f[1].second>0)cnt2++;
//		cout<<cnt2<<'\n';
		if(cnt2<=k){
			hi = mid-1;
			ans = mid;
		}else lo = mid+1;
	}
	cout<<ans;
}

#include <bits/stdc++.h>

using namespace std;

// using mint = long double;
// using mint = modint998244353;
// using mint = modint1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 2e18;
const ll fact_table = 1200008;

priority_queue<ll> pql;
priority_queue<P> pqp;
// big priority queue
// priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue<P, vector<P>, greater<P>> pqps;
// small priority queue
// top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/

#define p(x) cout << x << endl;
#define el cout << endl;
#define pe(x) cout << x << " ";
#define ps(x) cout << fixed << setprecision(25) << x << endl;
#define pu(x) cout << (x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = a; i <= (b); i++)
#define rep3(i, a, b) for (ll i = a; i >= (b); i--)
#define all(c) begin(c), end(c)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

// vec v(n) -> 長さnのベクトルを宣言
// mat dp(h, vec(w)) -> h * w の行列を宣言

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {
    ll x = 1;
    while (b) {
        while (!(b & 1)) {
            (a *= a) %= m;
            b >>= 1;
        }
        (x *= a) %= m;
        b--;
    }
    return x;
}
vec rv(ll read) {
    vec res(read);
    for (int i = 0; i < read; i++) {
        cin >> res[i];
    }
    return res;
}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod) * rfact[n - r]) % mod;
}
*/
bool icpc = false;
bool multicase = false;

ll n, k;
ll dist = 0, cnt = 0;

vec G[500005];

P dfs(int v, int p) {
    // first  : 一番近い黒までの距離
    // second : 一番遠い白までの距離
    ll black = INF, white = 0;

    for (auto nv : G[v]) {
        if (nv == p) continue;
        auto [b, w] = dfs(nv, v);
        b++;
        w++;
        black = min(black, b);
        white = max(white, w);
    }

    if (white + black <= dist) {
        white = -1;
    }
    if (white == dist) {
        cnt++;
        white = -1, black = 0;
    }
    if (p == -1 && white >= 0) {
        cnt++;
    }
    return P(black, white);
}

int calc(ll mid) {
    dist = mid;
    cnt = 0;
    P res = dfs(1, -1);
    return cnt;
}

bool solve() {
    cin >> n >> k;
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        G[a].pb(b);
        G[b].pb(a);
    }

    ll ok = n, ng = -1;
    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng) / 2;
        if (calc(mid) <= k) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    p(ok);
    return true;
}

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

    if (icpc) {
        while (solve())
            ;
        return 0;
    }
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        solve();
        testcase++;
    }

    // solve();
    return 0;
}


//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define int long long
const int maxn = 2e5+10;
int lst[300];
int Minus[300];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = s.size();
	for(int i = 'a';i <= 'z';i++)lst[i] = n;
	ll ans = 0;
	if(s[n-1] != s[n-2])Minus[(int)s[n-1]]++;

	for(int i = n-2;i >= 0;i--){
		if(i > 0 and s[i-1] != s[i] and s[i+1] != s[i])Minus[(int)s[i]]++;
		if(s[i] == s[i+1] and lst[(int)s[i]] != i+1){
			ans += lst[(int)s[i]] - i - 2 - (Minus[(int)s[i]]?Minus[(int)s[i]]:0ll);
			// cout << i << " " << lst[(int)s[i]] << " " << Minus[(int)s[i]] << " ans: " << lst[(int)s[i]] - i - 2 - (Minus[(int)s[i]]?Minus[(int)s[i]]:0ll) << endl;
			lst[(int)s[i]] = i;
			for(int j = 'a';j <= 'z';j++)if(j != s[i])lst[j] = n;
			for(int j = 'a';j <= 'z';j++)Minus[j] = 0;
		}
		if(s[i] == s[i+1] and lst[(int)s[i]] == i+1)lst[(int)s[i]] = i;
		// lst[(char)s[i]] = i;
		// Minus[(int)s[i]]++;
	}
	cout << ans;
	return 0;
}

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

using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef vector<vector<bool> > vvb;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rrep(i, n) for (int i = 1; i <= int(n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = int(n)-1; i >= 0; --i)

#define MES(a) MES2 a
#define MES2(a0,a1,a2,a3,a4,x,...) x
#define mes_1(x1) cout<<x1<<endl
#define mes_2(x1,x2) cout<<x1<<" "<<x2<<endl
#define mes_3(x1,x2,x3) cout<<x1<<" "<<x2<<" "<<x3<<endl
#define mes_4(x1,x2,x3,x4) cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<endl
#define mes_5(x1,x2,x3,x4,x5) cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4<<" "<<x5<<endl
#define mes(...) CHOOSE((__VA_ARGS__,mes_5,mes_4,mes_3,mes_2,mes_1,~))(__VA_ARGS__)

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,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(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)

#define ynmes(a) (a) ? mes("Yes") : mes("No")
#define YNmes(a) (a) ? mes("YES") : mes("NO")
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

ll fact_mod(ll n, ll mod) {
    ll f = 1; for (ll i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}

ll modpow(ll x, ll n, ll mod) {
    if(n == 0) return 1;
    ll res = modpow((x * x) % mod, n / 2 , mod);
    if(n & 1) res = (res * x) % mod;
    return res;
}

ll modncr(ll n, ll r, ll mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    ll a = 1;
    rep(i, r) a = a * ((n-i) % mod) % mod;
    ll b = modpow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

signed main() {
	string s;
	cin >> s;
	ll r = 0;
	ll n = s.size();
	stack <char> stk;

	rep(i, n) {
		if (i && s[i] == s[i-1]) stk.push(s[i]);
	}

	if (stk.empty()) {
		mes(0);
		re0;
	}

	ll tmp = 0;
	drep(i, n) {
		if (stk.empty()) break;

		if (i && s[i] == s[i-1]) {
			stk.pop();
			r += tmp;
			tmp = 0;
			if (!stk.empty() && stk.top() != s[i-1]) tmp += n-i;
		} else {
			if (stk.top() != s[i]) tmp++;
		}
	}

	mes(r);

}


#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << (x) << "\n"
constexpr int mod = 1000000007;
using namespace std;
int input() { int t; cin >> t; return t; }
signed main() {
	int n, x[123], y[123];
	cin >> n;
	for1(i, n)cin >> x[i] >> y[i];
	bool b = 0;
	for1(i, n)for1(j, i - 1)for1(k, j - 1) {
		if ((x[j] - x[i]) * (y[k] - y[j]) == (x[k] - x[j]) * (y[j] - y[i]))b = 1;
	}
	puts(b ? "Yes" : "No");
}

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

using namespace std;

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

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

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

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

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

#if 1

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

  string S; cin >> S;
  deque<char> T;
  bool flip = false;
  F0R(i, sz(S)) {
    char c = S[i];
    if (c == 'R') {
      flip = !flip;
    }
    else {
      if (!flip) {
        if (sz(T) && T.back() == c) {
          T.pop_back();
        }
        else {
          T.push_back(c);
        }
      }
      else {
        if (sz(T) && T.front() == c) {
          T.pop_front();
        }
        else {
          T.push_front(c);
        }
      }
    }
  }
  if (!flip) {
    F0R(i,sz(T)) {
      cout << T[i];
    }
  }
  else {
    RF0(i, sz(T)) {
      cout << T[i];
    }
  }
  cout << newl;
}
#endif


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9 + 7;
int inf = 1000000000; //10e9

ll power(int x, int n)
{

    ll xn = 1;

    rep(i, n)
    {
        xn *= x;
    }

    return xn;
}

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

    bool ans = false;
    ll tmp = 1;
    int a, b;

    for (int i = 1; tmp <= n; i++)
    {
        for (int j = 1; tmp <= n; j++)
        {
            tmp = power(5, i) + power(3, j);
            if (tmp == n)
            {
                ans = true;
                a = j;
                b = i;
                break;
            }
        }
        if (ans)
        {
            break;
        }
        tmp = power(5, i) + 3;
    }

    if (ans)
    {
        cout << a << ' ' << b << endl;
    }
    else
    {
        cout << -1 << endl;
    }

    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define rep(i, a, n) for(int i = a; i < n; ++i)
#define per(i, a, n) for(int i = n-1; i >= a; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
using namespace std;
ll myPow(ll x, ll p){
	ll y = 1;
	while(p--){
		y *= x;
	}
	return y;
}

void test_case(){
	ll s;
	scanf("%lld", &s);
	for(ll a = 1; ; a++){
		ll x = myPow(3, a);
		if(x >= s) break;
		for(ll b = 1; ; ++b){
			ll y = myPow(5, b);
			if(y >= s) break;
			if(x+y == s){
				printf("%lld %lld", a, b);
				return;
			}
		}
	}
	printf("-1\n");
}
int main()
{
	test_case();
}


#include <bits/stdc++.h>

using namespace std;

#define int long long
#define double long double

#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define mii map<int,int>

#define F first
#define S second

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define eb emplace_back
#define ef emplace_front

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-12;

int a,b,c;
double prob[102][102][102];
double res;

signed main(){

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

    cin>>a>>b>>c;

    prob[a][b][c]=1;

    for(int i=a;i<=100;i++){
        for(int j=b;j<=100;j++){
            for(int k=c;k<=100;k++){

                if( (i==100 and j!=100 and k!=100) or (i!=100 and j==100 and k!=100) or (i!=100 and j!=100 and k==100) ) continue;

                prob[i][j][k+1]+=prob[i][j][k]*(double)k/(i+j+k);
                prob[i][j+1][k]+=prob[i][j][k]*(double)j/(i+j+k);
                prob[i+1][j][k]+=prob[i][j][k]*(double)i/(i+j+k);

            }
        }
    }

    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            for(int k=0;k<=100;k++){
                if( (i==100 and j!=100 and k!=100) or (i!=100 and j==100 and k!=100) or (i!=100 and j!=100 and k==100) ){
                    res+=prob[i][j][k]*((double)i+j+k-a-b-c);
                }
            }
        }
    }

    cout<<fixed<<setprecision(10)<<res<<endl;

    /***debug***
    for(int i=a;i<=100;i++){
        for(int j=b;j<=100;j++){
            for(int k=c;k<=100;k++){
                cout<<fixed<<setprecision(10)<<prob[i][j][k]<<" ";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    cout<<endl;
    ***debug***/

    return 0;

}

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

map<string,double> dp;
double solve(int a,int b,int c) {
	if(a==100 or b==100 or c==100)
		return 0;
	string key=to_string(a)+" "+to_string(b)+" "+to_string(c);
	if(dp.find(key)!=dp.end())
		return dp[key];
	double p=((solve(a+1,b,c)+1)*a)/(a+b+c);
	double q=((solve(a,b+1,c)+1)*b*1.0)/(a+b+c);
	double r=((solve(a,b,c+1)+1)*c*1.0)/(a+b+c);
	return dp[key]=p+q+r;
}

signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	printf("%0.9lf",solve(a,b,c));
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#define N 2005
#define mp make_pair
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*f;
}
int n,m,f[N][N],dist[N],vis[N],v[N],w[N],head[N],nxt[N],cnt,self_circle[N];
void add(int a,int b,int c)
{
	v[++cnt]=b;
	w[cnt]=c;
	nxt[cnt]=head[a];
	head[a]=cnt;
}
void dij(int S)
{
	memset(dist,0x3f,sizeof(dist));
	memset(vis,0,sizeof(vis));
	priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >q;
	q.push(mp(0,S));
	dist[S]=0;
	while(!q.empty())
	{
		int c=q.top().second;q.pop();
		if(vis[c])continue;
		vis[c]=1;
		for(int i=head[c];i;i=nxt[i])
		{
			if(dist[v[i]]>dist[c]+w[i])
			{
				dist[v[i]]=dist[c]+w[i];
				q.push(mp(dist[v[i]],v[i]));
			}
		}
	}
}
int main()
{
	memset(self_circle,0x3f,sizeof(self_circle));
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read(),z=read();
		if(x==y)self_circle[x]=min(self_circle[x],z);
		else add(x,y,z);
	}
	for(int i=1;i<=n;i++)
	{
		dij(i);
		memcpy(f[i],dist,sizeof(f[i]));
	}
//	for(int i=1;i<=n;i++)
//	{
//		for(int j=1;j<=n;j++)
//		{
//			printf("%d ",f[i][j]);
//		}
//		puts("");
//	}
	for(int i=1;i<=n;i++)
	{
		int minn=self_circle[i];
		for(int j=1;j<=n;j++)
		{
			if(i==j)continue;
			minn=min(minn,f[i][j]+f[j][i]);
		}
		if(minn==0x3f3f3f3f)puts("-1");
		else printf("%d\n",minn);
	}
	return 0;
}

#include <bits/stdc++.h>
#define ll int
#define MAXN 2005
#define MAX 2005
using namespace std;

vector<ll> adjlist[MAX];
ll n, m;

ll bfs(ll start) {
    ll mark[MAX], res = 0;
    memset(mark, 0, sizeof(mark));
    queue<ll> q;
    q.push(start);
    mark[start] = 1;
    while(!q.empty()) {
        ll top = q.front();
        q.pop();
        for(ll i = 0; i < adjlist[top].size(); i++) {
            ll next_cur = adjlist[top][i];
            if(!mark[next_cur]) {
                q.push(next_cur);
                mark[next_cur] = 1;
            }
        }
    }

    for(ll i = 1; i <= n; i++) {
        if(mark[i])
            res++;
    }

    return res;
}

int main() {

    cin>>n>>m;
    for(ll i = 0 ; i < m; i++) {
        ll u,v;
        cin>>u>>v;
        adjlist[u].push_back(v);
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++) {
        ans += bfs(i);
    }
    cout<<ans<<endl;
	return 0;
}


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

using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int inf = 1001001001;
const ll mod = 1000000007;
const ll INF = 1ll<<60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct UnionFind {
    vector<int> parents;

    UnionFind() {}
    UnionFind(int n) : parents(n, -1) {}

    int leader(int x) {
        if (parents[x] < 0) return x;
        else return parents[x] = leader(parents[x]);
    }
    bool merge(int x, int y) {
        x = leader(x);
        y = leader(y);
        if (x == y) return false;
        if (parents[x] > parents[y]) swap(x, y);
        parents[x] += parents[y];
        parents[y] = x;
        return true;
    }
    bool same(int x, int y) { return leader(x) == leader(y); }
    int size(int x) { return -parents[leader(x)]; }
    void init(int n) { parents.assign(n, -1);}      // reset
};

int main() {
    int n; cin >> n;
    vl a(n); rep(i,n) cin >> a[i];
    vector<pl> aa(n);
    rep(i,n) aa[i].first = a[i], aa[i].second = i;
    sort(all(aa));
    reverse(all(aa));
    UnionFind uf(n);
    ll ans = 0;
    ll m = 1;
    rep(i,n) {
        ll ai = aa[i].first, id = aa[i].second;
        ans = max(ans, m*ai);
        if (id > 0 && a[uf.leader(id)] <= a[uf.leader(id-1)]) {
            chmin(a[uf.leader(id-1)], a[uf.leader(id)]);
            chmin(a[uf.leader(id)], a[uf.leader(id-1)]);
            uf.merge(id, id-1);
            m = max(m, (ll)uf.size(id));
            ans = max(ans, m*ai);
        }
        if (id < n-1 && a[uf.leader(id)] <= a[uf.leader(id+1)]) {
            chmin(a[uf.leader(id+1)], a[uf.leader(id)]);
            chmin(a[uf.leader(id)], a[uf.leader(id+1)]);
            uf.merge(id, id+1);
            m = max(m, (ll)uf.size(id));
            ans = max(ans, m*ai);
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

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

    int ans = 0;
    for(int i = 0, h; i<n; i++){
        h = a[i];
        for(int j = i; j<n; j++){
            h = min(h, a[j]);
            ans = max(ans, h*(j-i+1));
        }
    }
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
#define re register
#define ll long long
using namespace std;
const int lzw=2e5+3;
int n,a[lzw];
ll ans,sum[lzw],Max[lzw],maxx;
int main(){
	scanf("%d",&n);
	for(re int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(re int i=1;i<=n;i++){
		sum[i]=sum[i-1]+a[i];
		maxx=max(maxx,sum[i]);
		Max[i]=maxx;
	}
	ll pos=0;
	for(re int i=1;i<=n;i++){
		ans=max(ans,pos+Max[i]);
		pos+=sum[i];
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
#define ll						long long int
#define us						unsigned
#define t()						int test;cin>>test;while(test--)
#define ip(a)					int a;cin>>a
#define ipll(a)					ll a;cin>>a
#define iparr(a,n)				int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define ipllarr(a,n)			ll a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define rep(i,a,n)				for(int i=a;i<n;i++)
#define repr(i,a,n)				for(int i=a;i>n;i--)
#define llrep(i,a,n)			for(ll i=a;i<n;i++)
#define llrepr(i,a,n)			for(ll i=a;i>n;i--)
#define urep(i,a,n)				for(us int i=a;i<n;i++)
#define urepr(i,a,n)			for(us int i=a;i>n;i--)
#define nl						cout<<endl
#define pb						push_back
#define IOS						ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define prblocks(v,n)			cout<<"\t";rep(i,0,n){cout<<v[i]<<" ";}nl
#define no						cout<<"NO";nl
#define yes						cout<<"YES";nl
#define all(a)					a.begin(),a.end()

vector<bool> v((int)1e6 +1,1);
void set_v(){
	for(int i=2;i< (int)1e6+1;i++){
		if(v[i]){
			for(int j=i;(i*j)<(int)1e6+1;j++){
				v[i*j]=0;
			}
		}
	}
}

////	A->
//void solve(){
//
//}

//	B->
void solve(){
	ip(n);
	int tepm,sum=0;
	rep(i,0,n){
		cin>>tepm;
		sum += max(0,tepm-10);
	}
	cout<<sum;
}

////	C->
//bool adj[2001][2001];
//int counts[2001];
//void solve(){
//	memset(adj,0,sizeof(adj));
//	memset(counts,0,sizeof(counts));
//	ip(N);
//	rep(i,1,N+1){
//		adj[i][i]=1;
//	}
//	while(N--){
//		ip(a);
//		ip(b);
//		adj[a][b]=1;
//	}
//
//}

void testing(int t){
}

int main(){
	IOS
//	set_v();
//	memset(t,0,sizeof(t));
	int qwertyuiop=1;
//	cin>>qwertyuiop;
//	qwertyuiop++;
	while(qwertyuiop--){
			solve();
//			testing(qwertyuiop);
	}
	return 0;
}


#include "bits/stdc++.h"
#include "random"
#include <unistd.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x, y) x = max(x,y)
#define chmin(x, y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i, n) for(int i = 0 ; i < n; ++i)

const int dx2[4] = {0,1,0,1};
const int dy2[4] = {0,0,1,1};
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

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

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

int Uniform_Random(int a, int b){ // (a <= x <= b)

  random_device rd;
  mt19937 mt(rd());

  uniform_int_distribution<int> rv1(a, b);
  return rv1(mt);
}

int main(){

  ll N; cin >> N;
  ll ans = N;
  set<ll> st;
  for(ll i = 2; i <= sqrt(N); ++i){
    ll cnt = 2;
    if(st.find(i) == st.end()){
      while(pow(i, cnt) <= N){
        st.insert(pow(i, cnt));
        ans --;
        cnt ++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

bool can_evaluate(string &X, long long B, long long M){
  long long val = 0;

  for(int i = 0; i < X.size(); i++){
    int x = X[i] - '0';
    if(val > (M-x)/B) return false;
    val = val*B + x;
  }

  return val <= M;
}

int main(){
  string X; long long M;
  while(cin >> X >> M){
    if(X.size() == 1){
      printf("%d\n", stod(X) <= M ? 1 : 0);
      continue;
    }

    int min_b = 0;
    for(char ch : X){
      min_b = max(min_b, ch-'0'+1);
    }

    if(!can_evaluate(X, min_b, M)){
      printf("0\n");
      continue;
    }

    long long max_b = min_b;
    while(can_evaluate(X, max_b, M)) max_b <<= 1;

    long long lo = min_b, up = max_b, B = min_b;

    while(lo <= up){
      long long mid = (lo + up) >> 1;

      if(can_evaluate(X, mid, M)){
	lo = mid+1;
	B = mid;
      } else {
	up = mid-1;
      }
    }

    printf("%lld\n", B - min_b + 1);
  }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-9;
long double pi = acos(-1);

using lll = __int128_t;

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

	string s;
	cin>>s;
	ll n;
	cin>>n;
	ll ma = 0;
	for(ll i=0;i<(int)s.size();i++)chmax(ma,s[i]-'0');
	if(s.size() == 1){
		// assert(ma>n);
		if(ma > n)cout << 0 << endl;
		else cout << 1 << endl;
		return 0;
	}
	int x = s.size();
	lll low=0,up=1000000000000000009,mid;
	while(up-low>1){
		mid=(up+low)/2;
		lll m = n;
		bool pos = 1;
		for(int i=1;i<x;i++)m/=mid;
		if(m == 0)pos=false;
		if(pos){
			lll now = 0;
			for(int i=0;i<x;i++){
				now *= mid;
				now += s[i]-'0';
			}
			if(now > n)pos=false;
		}
		if(pos){
			low=mid;
		}
		else{
			up=mid;
		}
	}
	chmin(low,n);
  ll ans = low - ma;
  chmax(ans,0);
        cout << ans << endl;

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define ll long long
#define min3(a,b,c) min(min((a),(b)),(c))
#define min4(a,b,c,d) min(min((a),(b)),min((c),(d)))
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define S second
#define F first
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 3.14159265358979323846;
#define MOD 1000000007
using namespace std;

bool check1 (int n)
{
    while(n)
    {
        int r = n % 10;

        if(r == 7)
            return true;

        n /= 10;
    }

    return false;
}

bool check2 (int n)
{
    while(n)
    {
        int r = n % 8;

        if(r == 7)
            return true;

        n /= 8;
    }

    return false;
}

int main()
{
    FAST;

    int n;
    cin >> n;

    int c = 0;

    for(int i = 1; i <= n; i++)
    {
        if(check1(i) || check2(i))
        {
            c += 1;
        }
    }

    cout << n - c << "\n";

    return 0;
}


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

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

int N;
ll A[202020];
const ll mo=998244353;

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

	cin>>N;
	FOR(i,N) cin>>A[i];
	sort(A,A+N);
	ll ret=0;
	ll sum=0;
	FOR(i,N) {
		(ret=ret+(sum+A[i])*A[i])%=mo;
		sum=(sum*2+A[i])%mo;
	}
	cout<<ret<<endl;

}

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

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

// ascii value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space

#define int long long
#define endl "\n"
#define mem1(a) memset(a,-1,sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

// use error(args..)
const long long INF=1e18;
const int32_t MOD=1e9+7;
const int32_t MM=998244353;
const int N=2e7+5;

void solve() {

    int n;
    cin>>n;

    vector <int> v(n);
    int sum = 0;

    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        sum += v[i];
    }

    vector <bool> dp(sum + 1);
    dp[0] = true;

    int ans = 1e18;

    for(int i=0; i<n; i++)
    {
        for(int j = sum; j>= v[i]; j--)
            dp[j] = dp[j] | dp[j - v[i]];
    }

    for(int i = 0; i<=sum; i++)
    {
        //cout<<i<<" "<<dp[i]<<endl;
        if(dp[i])
        {
            ans = min(ans, max(i, sum-i));
        }
    }

    cout<<ans<<endl;

}

signed main() {

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
    freopen("newop.txt", "w", stdout);
    #endif

    int t = 1;

    // cin>>t;

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


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

struct Matrix{
  vector<vector<ll>> M;
  Matrix(int H,int W):M(H,vector<ll>(W,0)){}
  Matrix(int H,int W,ll init):M(H,vector<ll>(W,init)){}

  void assign(int H,int W,ll init) { M.assign(H,vector<ll>(W,init)); }

  void build_E(){
    int h=M.size();
    int w=M[0].size();
    assign(h,w,0);
    for(int i=0;i<h&&i<w;i++){
      M[i][i]=1;
    }
  }

  // note:for 2D
  void build_rotR(){
    int h=M.size();
    int w=M[0].size();
    assign(h,w,0);
    M[0][0]=0;
    M[0][1]=1;
    M[1][0]=-1;
    M[1][1]=0;
  }

  // note:for 2D
  void build_rotL(){
    int h=M.size();
    int w=M[0].size();
    assign(h,w,0);
    M[0][0]=0;
    M[0][1]=-1;
    M[1][0]=1;
    M[1][1]=0;
  }

  Matrix operator*(Matrix a){
    int h1=M.size();
    int w1=M[0].size();
    int w2=a.M[0].size();
    Matrix res(h1,w2);
    for(int i=0;i<h1;i++){
      for(int j=0;j<w2;j++){
        for(int k=0;k<w1;k++){
          res[i][j]+=M[i][k]*a[k][j];
        }
      }
    }
    return res;
  }

  vector<ll>& operator[](int i){ return M[i]; }
};

int main(){
  int n;
  cin>>n;
  vector<Matrix> ms(n,Matrix(3,1));
  for(auto &m:ms){
    cin>>m[0][0]>>m[1][0];
    m[2][0]=1;
  }

  int m;
  cin>>m;
  const Matrix dim3(3,3,0);
  vector<Matrix> accum_m(m+1,dim3);
  accum_m[0].build_E();

  Matrix rotL(dim3);
  rotL.build_rotL();
  rotL[2][2]=1;

  Matrix rotR(dim3);
  rotR.build_rotR();
  rotR[2][2]=1;

  Matrix mx(dim3);
  mx.build_E();
  mx[0][0]=-1;

  Matrix my(dim3);
  my.build_E();
  my[1][1]=-1;

  for(int i=0;i<m;i++){
    int op,p;
    cin>>op;
    switch(op){
    case 1:
      accum_m[i+1]=rotR*accum_m[i];
      break;
    case 2:
      accum_m[i+1]=rotL*accum_m[i];
      break;
    case 3:
      cin>>p;
      mx[0][2]=2*p;
      accum_m[i+1]=mx*accum_m[i];
      break;
    case 4:
      cin>>p;
      my[1][2]=2*p;
      accum_m[i+1]=my*accum_m[i];
      break;
    }
  }

  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    ll a,b;
    cin>>a>>b;
    b--;
    Matrix ans=accum_m[a]*ms[b];
    cout<<ans[0][0]<<' '<<ans[1][0]<<'\n';
  }
}

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")
//#pragma GCC optimize("branch-target-load-optimize")
//#pragma GCC optimize("branch-target-load-optimize2")
//#pragma GCC optimize("btr-bb-exclusive")

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cassert>
#include <random>

using namespace std;

void solve();

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    solve();
}

#define int long long

const int N = 5e5 + 100, K = 3e5, A = 2e5 + 100, MOD = 1e9 + 7, base = 131, INF = 1e18;

int n, q, c[N], p[N], ans[N], sum;
vector < int > a[N];
vector < pair < int, int > > b;

void dfs(int v, int pp) {
    p[v] = pp;
    for (int i = 0; i < a[v].size(); i++) {
        int to = a[v][i];
        if (to == pp) continue;
        dfs(to, v);
    }
}

void dfs1(int v) {
    sum += c[v];
    ans[v] = sum;
    for (int i = 0; i < a[v].size(); i++) {
        int to = a[v][i];
        if (to == p[v]) continue;
        dfs1(to);
    }
    sum -= c[v];
}

void solve() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int f, s;
        cin >> f >> s;
        f--, s--;
        a[f].push_back(s);
        a[s].push_back(f);
        b.push_back({f, s});
    }
    dfs(0, -1);

    cin >> q;
    while (q--) {
        int t, e, x;
        cin >> t >> e >> x;
        e--;
        if (t == 1) {
            int f = b[e].first, s = b[e].second;
            if (p[f] == s) {
                c[f] += x;
            } else {
                c[0] += x;
                c[s] -= x;
            }
        } else {
            int f = b[e].first, s = b[e].second;
            if (p[s] == f) {
                c[s] += x;
            } else {
                c[0] += x;
                c[f] -= x;
            }
        }
    }
    dfs1(0);
    for (int i = 0; i < n; i++) {
        cout << ans[i] << '\n';
    }
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

// clang-format off
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
#define Endl endl
#define itn int
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define _max(x) *max_element(ALL(x))
#define _min(x) *min_element(ALL(x))
#define _sum(x) accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(begin(A), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(begin(A), upper_bound(ALL(A), key))

const int MOD   = 1000000007;
// const int MOD    = 998244353;
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-8;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
int _mod(int &a) {a = a >= 0 ? a % MOD : a - (MOD * _ceil(a, MOD));return a;}
int _pow(int a, int b) {int res = 1;for (a %= MOD; b; a = a * a % MOD, b >>= 1)if (b & 1) res = res * a % MOD;return res;}
struct mint {long long x;mint(long long 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(long long t) const {if (!t) return 1;mint a = pow(t >> 1);a *= a;if (t & 1) a *= *this;return a;}mint inv() const { return pow(MOD - 2); }mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }};istream &operator>>(istream &is, mint &a) { return is >> a.x; }ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }
// clang-format on

class ABrick {
public:
  static void solve(istream &cin, ostream &cout) {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int N, W;
    cin >> N >> W;
    cout << N / W << endl;
  }
};

signed main() {
  ABrick solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;

unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 eng(seed);

ll random2(){
    return (1ll << 31ll)*eng()+eng();
}

ll n,m,k,q,T;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 400001;

vi P,PI;
vi moves;

void mov(int i){
    assert(i%2 == sz(moves)%2);
    assert(i < n-1);
    swap(P[i], P[i+1]);
    PI[P[i]] = i;
    PI[P[i+1]] = i+1;
/*
    cerr << i+1 << " d\n";
    rep(c1,0,n){
        cerr << P[c1]+1 << " ";
    }cerr << "\n";
*/
    moves.push_back(i+1);
}

void solve(int i){
    if(PI[i] == i)return;
  //  cerr << PI[i]+1 << "  fds\n";
    if(PI[i]%2 != sz(moves)%2){
        while(PI[i] != i){
            mov(PI[i]-1);
        }
        return;
    }

    int j = PI[i];

    if(j < n-3){
        mov(j+2);
        solve(i);
        return;
    }

    if(j > i+1){
        mov(j-2);
        solve(i);
        return;
    }

    if(j >= 2 && j-1 == i){
        mov(j-2);
        mov(j-1);
        mov(j-2);
        mov(j-1);
        mov(j-2);
        //mov(j-1);
        solve(i);
        return;
    }

    mov(j);
    solve(i);

    return;

}

bool srt(){
    rep(c1,0,n-1){
        if(P[c1] > P[c1+1])return 0;
    }
    return 1;
}

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

    //freopen("fhc.txt","r",stdin);
    //freopen("autput.txt","w",stdout);

    ll a,b,c,d,e;

    cin >> T;
    rep(c4,0,T){
        cin >> n;
        P.clear();
        PI.clear();
        moves.clear();
        rep(c1,0,n){
            cin >> a;
            a--;
            P.push_back(a);
            PI.push_back(1);
        }
        rep(c1,0,n){
            PI[P[c1]] = c1;
        }
        rep(c1,0,n){
            solve(c1);
        }

        if(sz(moves) > n*n){
            cerr << "ERROR: " << sz(moves) << " moves for n=" << n << "\n";
        }
        if(!srt()){
            cerr << "ERROR: not sorted n=" << n << "\n";
        }
        cout << sz(moves) << "\n";
        trav(y, moves){
            cout << y << " ";
        }cout << "\n";
    }

    return 0;
}


/*
  This C++ Source Is
  Writen By syksykCCC
  (2020)
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for(register int i = x; i < y; i++)
#define REP(i, x, y) for(register int i = x; i <= y; i++)
#define per(i, x, y) for(register int i = x; i > y; i--)
#define PER(i, x, y) for(register int i = x; i >= y; i--)
#define repl(i, x, y) for(register long long i = x; i < y; i++)
#define REPL(i, x, y) for(register long long i = x; i <= y; i++)
#define perl(i, x, y) for(register long long i = x; i > y; i--)
#define PERL(i, x, y) for(register long long i = x; i >= y; i--)
#define LLL __int128
#define int128 __int128
#define DEBUG(x) cerr << #x << " : " << x << endl
using namespace std;
typedef unsigned int uint;
typedef long long int64;
typedef long long LL;
typedef unsigned long long uint64;
typedef unsigned long long ULL;
typedef long double LLF;
inline void NO() { cout << "NO\n"; }
inline void YES() { cout << "YES\n"; }
inline void NEG() { cout << "-1\n"; }
template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; }
template<typename T> inline void read(T &val)
{
	val = 0; char c = getchar(); int f = 1;
	while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
	while(isdigit(c)) { val = (val << 3) + (val << 1) + (c ^ 48); c = getchar(); }
	val *= f;
}
template<typename T> void write_(T val) { if(!val) return; write_(val / 10); putchar(val % 10 + 48); }
template<typename T> inline void write(T val)
{
	if(val == 0) putchar(48);
	else if(val < 0) { putchar('-'); write_(-val); }
	else write_(val);
}

#define int long long

const int MOD = 1e9 + 7;
int T, N, A, B;

signed main()
{
#ifdef LOCAL
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif
//	ios::sync_with_stdio(false);
	read(T);

	while(T--)
	{
		read(N); read(A); read(B);
		if(A + B > N)
		{
			puts("0");
			continue;
		}
		int x = N - A - B + 2;
		printf("%lld\n", (2LL * x * (x - 1) % MOD * (N - A + 1) % MOD * (N - B + 1) % MOD
		- (x * (x - 1) % MOD * x % MOD * (x - 1) % MOD) + MOD) % MOD);
	}
	return 0;
}

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <string>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

//infの設定
#define INF32 2147483647
#define INF64 9223372036854775807
#define PRIME (ll)1000000007
#define PI 3.141592653589793238
//repマクロ
#define rep(i,m,n) for (int i=(m); (i)<(int)(n); ++(i))
#define rrep(i,m,n) for (int i=(m); (i)>(int)(n); --(i))
//その他
#define eb emplace_back
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<long long,long long> Pl;
//#define int long long

//Combinatonを巨大素数で割った余りを出力するやーつ)
vector<ll> fac(5050505,INF64),finv(5050505,INF64),inv(5050505,INF64);
ll MOD=1000000007;
void cprimeInit(ll n){
    fac.at(0)=fac.at(1)=1;
    finv.at(0)=finv.at(1)=1;
    inv.at(1)=1;
    for(ll i=2;i<n+1;i++){
        fac.at(i)=fac.at(i-1)*i%MOD;
        inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
        finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
    }
}
long long cprime(ll n,ll k){
    if(n<k) return 0;
    if(n<0||k<0) return 0;
    return fac.at(n)*(finv.at(k)*finv.at(n-k)%MOD)%MOD;
}

int main(){
    ll N,M,K; cin>>N>>M>>K;
    ll ans=0;

    if(N-K>M){
        ans=0;
    }else{
        cprimeInit(2020202);
        ans=cprime(N+M,N)-cprime(N+M,N-K-1);
    }
    cout<<(ans+PRIME)%PRIME<<endl;

    return 0;
}