#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    rep(i, n){
        int x, y, r;
        cin >> x >> y >> r;
        cout << x << " " << y << " " << x+1 << " " << y+1 << endl;
    }
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 1e9 + 7;

int main() {
    ll N; cin >> N;
    vector<ll> a(N), t(N);
    rep(i,N) cin >> a[i] >> t[i];
    ll l = -inf, r = inf, add = 0;
    ll L = -inf, R = inf;
    bool is_straight = false;
    rep(i,N) {
        if (t[i]==1) {
            if (is_straight) {
                L += a[i];
                R += a[i];
                continue;
            }
            add += a[i];
            if (l!=-inf) L += a[i];
            if (r!=inf) R += a[i];
        } else if (t[i]==2) {
            if (is_straight) {
                chmax(L,a[i]);
                chmax(R,a[i]);
                continue;
            }
            if (a[i]<=L) continue;
            if (R<=a[i]) {
                L = a[i];
                R = a[i];
                is_straight = true;
                continue;
            }
            L = a[i];
            l = L - add;
        } else {
            if (is_straight) {
                chmin(L,a[i]);
                chmin(R,a[i]);
                continue;
            }
            if (R<=a[i]) continue;
            if (a[i]<=L) {
                L = a[i];
                R = a[i];
                is_straight = true;
                continue;
            }
            R = a[i];
            r = R - add;
        }
    }

    ll Q; cin >> Q;
    vector<ll> res(Q);
    rep(q,Q) {
        ll x; cin >> x;
        if (is_straight) {
            res[q] = L;
        } else {
            if (x<=l) res[q] = L;
            else if (x<r) res[q] = x + add;
            else res[q] = R;
        }
    }
    for (ll ans : res) cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    if(m==0){
        cout<<1<<endl;
        return 0;
    }
    vector<ll> arr(m);
    REP(i,m){
        cin>>arr[i];
        arr[i]--;
    }
    if(n==m){
        cout<<0<<endl;
        return 0;
    }
    sort(all(arr));
    vector<ll> gaps;
    if(arr[0]){
        gaps.pb(arr[0]);
    }
    for(ll i=1;i<m;i++){
        ll x=arr[i]-arr[i-1]-1;
        if(x){
            gaps.pb(x);
        }
    }
    if(n-arr.back()-1!=0){
        gaps.pb(n-arr.back()-1);
    }
    sort(all(gaps));
    ll x=gaps[0];
    ll ans=0;
    for(ll i=0;i<int(gaps.size());i++){
        ll temp=gaps[i];
        temp=temp%x?temp/x+1:temp/x;
        ans+=temp;
    }
    cout<<ans<<endl;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
#include<stack>
#include <map>
#include <vector>
using namespace std;
int main(){
	int n,m,p=0,mp[10][10],ad=0,k=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>mp[i][j];
		}
	}
	int a[10]={0,1,2,3,4,5,6,7,8,9};
	while(p==0){
		ad=0;
		for(int i=1;i<n;i++){
			ad+=mp[a[i]][a[i-1]];
		}
		ad+=mp[a[n-1]][0];
		//cout<<ad<<endl;
		if(ad==m)k++;
		next_permutation(a,a+n);
		p=1;
		if(a[0]==0)p=0;
	}
	cout<<k;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <cstring>
#include <map>
#include <string>
#define inf 0x3f3f3f3f
#define  _for(i,a,b) for( int i=(a); i<(b); ++i)
#define  __for(i,a,b) for( int i=(b); i>=(a); --i)
using namespace std;
typedef pair<int,int>pii;
typedef unsigned long long ll;
const int mod =1e9+7;
const int N=1e5+7;

int main( )
{
   int a,b,c;
    cin>>a>>b>>c;
   cout<<7-a+7-b+7-c;

    return 0;
}

//================code===================//

#define TLE

#ifdef TLE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define ld long double
#define fa(i,a,b) for(LL i=(a);i<(LL)(b);++i)
#define fd(i,a,b) for(LL i=(a);i>(LL)(b);--i)
#define setp pair<pair<int,int>,int>
#define setl pair<LL,LL>

#define M_PI 3.14159265358979323846
#define micro 0.000001

using namespace std;

#ifdef OHSOLUTION
#define ce(t) cerr<<t
#define AT cerr << "\n=================ANS=================\n"
#define AE cerr << "\n=====================================\n"
LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
#else
#define AT
#define AE
#define ce(t)
#define __popcnt __builtin_popcount
#define gcd __gcd
#define lcm __lcm
#endif

pair <int, int> vu[9] = { {0,1},{1,0},{0,-1} ,{-1,0},{0,1},{1,0}, {-1,1} , {1,-1},{-1,-1} }; //RDLU EWSN

template<typename T, typename U> void ckmax(T& a, U b) { a = a < b ? b : a; }
template<typename T, typename U> void ckmin(T& a, U b) { a = a > b ? b : a; }
struct gcmp { bool operator()(LL a, LL b) { return a < b; } bool operator()(setl a, setl b) { return a.second < b.second; } };
struct lcmp { bool operator()(LL a, LL b) { return a > b; } bool operator()(setl a, setl b) { return a.second > b.second; } };

const int max_v = 2e5 + 7;
const int INF = 1e9 + 7;
const LL LNF = (LL)5e18 + 7ll;
const LL mod = 1e9+7;

int main()
{
#ifdef OHSOLUTION
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	LL n; ci(n);
	LL x;
	fa(i, 1, n+1)
	{
		if (i * i * i > n) break;
		x = i;
	}

	LL ans = x * x * x;

	fa(i, x + 1, n+1)
	{
		bool ck = false;
		fa(j, 1, i+1)
		{
			if (i * j > n) break;

			fa(t, 1,j+1)
			{
				if (i * j * t <= n)
				{
					//ce(i << " " << j << " " << t << endl);

					int c = (i == j) + (i == t) + (j == t);

					ck = true;

					if (c == 3) ++ans;
					else if (c == 1) ans += 3ll;
					else ans += 6ll;
				}
				else break;
			}
		}

		if (!ck) break;
	}

	co(ans);

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(){
    cout << fixed << setprecision(15);

    int N; cin >> N;
    vector<ll> X; ll x; for (int i=0; i<N; i++) { cin >> x; X.push_back(x); }

    ll m_dist = 0;
    for (int i=0; i<N; i++) m_dist += abs(X[i]);
    cout << m_dist << endl;

    double u_dist = 0;
    for (int i=0; i<N; i++) u_dist += double(X[i]) * double(X[i]);
    u_dist = sqrt(u_dist);
    cout << u_dist << endl;

    ll c_dist = 0;
    for (int i=0; i<N; i++) c_dist = max(c_dist, abs(X[i]));
    cout << c_dist << endl;

    return 0;
}

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

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

using namespace std;
/* using namespace atcoder; */

using ll = long long;
using P = pair<int, int>;

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

int main() {
  ll x, y, a, b;
  cin >> x >> y >> a >> b;
  ll tmp = x;
  ll mul = 0;
  while (y / a > tmp && (tmp * a < tmp + b)) {
    tmp *= a;
    mul++;
  }
  ll res = mul + (y - tmp - 1) / b;
  cout << res << endl;
  return 0;
}


#include <bits/stdc++.h> //yaad rkhne layak baatein
#include <bits/stdc++.h> // bool found = false use it to find some number after the given number with some cond.
                         // while (!found)
#include <iostream>      // freq.table-> int freq[26] = {0}; for (ll i = 0; i < s1.length(); i++) freq[s1[i] - 'A']++;
#define ll long long     //[s[i] - 'a'] ->this convers char to corr.int eg. 'c' to 3.
// if(a<=min1){
//         min2 = min1;
//         index2 = index1;
//         min1 = a;
//         index1 = i;         to find index of 2nd smallest element
//       }
//       else if(a<=min2){
//         min2 = a;
//         index2 = i;
//       }
#define INF 2000000000
#define pb push_back
using namespace std;
//cout<<fixed<<setprecision(12)<<ans<<endl;
const int M = 1e9 + 7;
#define loop0(i, n) for (ll i = 0; i < n; i++)            //  str.insert(0, 5, '1'); => it will insert 1 five times in start of str.
#define loop00(i, n) for (ll i = 0; i <= n; i++)
#define loop1(i, n) for (ll i = 1; i < n; i++)
#define loop11(i, n) for (ll i = 1; i <= n; i++)
#define loopab(i, a, b) for (ll i = a; i <= b; i++)

void flashSpeed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
}
long long mod(long long x)
{
    return ((x % M + M) % M);
}
long long add(long long a, long long b)
{
    return mod(mod(a) + mod(b));
}
long long mul(long long a, long long b)
{
    return mod(mod(a) * mod(b));
}
ll modPow(ll a, ll b)
{
    if (b == 0)
        return 1LL;
    if (b == 1)
        return a % M;
    ll res = 1;
    while (b)
    {
        if (b % 2 == 1)
            res = mul(res, a);
        a = mul(a, a);
        b = b / 2;
    }
    return res;
}
const int N = 2e5 + 2;
int fact[N];

void precalc()
{
    fact[0] = 1;
    for (int i = 1; i < N; i++)
    {
        fact[i] = mul(fact[i - 1], i);
    }
}

ll inv(ll x)
{
    return modPow(x, M - 2);
}

ll divide(ll a, ll b)
{
    return mul(a, inv(b));
}

ll nCr(ll n, ll r)
{
    return divide(fact[n], mul(fact[r], fact[n - r]));
}
double Round(double var)
{
    float value = (int)(var * 100 + .5);
    return (float)value / 100;
}
ll ceils(ll x, ll y) {
	return x / y + ((x % y) != 0);
}
ll Gcd(ll a, ll b)
{
    if (b > a)
    {
        return Gcd(b, a);
    }
    if (b == 0)
        return a;
    else
        return Gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / Gcd(a, b) * b;
}

bool isPal(string s)
{
    for (int i = 0; i < (int)s.size() / 2; i++)
    {
        if (s[i] != s[(int)s.size() - 1 - i])
            return false;
    }
    return true;
}

ll Sumdigits(ll a)
{
    ll total = 0;
    while (a)
    {
        total += a % 10;
        a /= 10;
    }
    return total;
}
bool isPerfectSquare(int n)
{
    for (int i = 1; i * i <= n; i++) {
        if ((n % i == 0) && (n / i == i)) {
            return true;
        }
    }
    return false;
}
bool isPowerOfTwo(int n){
   return (ceil(log2(n)) == floor(log2(n)));
}
void lexosmallest(string s,string c){
    string t1 = s;
    sort(t1.begin(), t1.end());
    int index = -1;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != t1[i]) {
            index = i;
            break;
        }
    }
    int j;
    for (int i = 0; i < s.length(); i++) {        //khela yha pe hua hai..loop poora chala hai
        if (s[i] == t1[index])
            j = i;
    }
    swap(s[index], s[j]);
}
void solution(){
   int a,b,c;
   cin>>a>>b>>c;
   cout<<21-(a+b+c)<<endl;
}

int main()
{
    flashSpeed();
    int t=1;
   // cin>>t;
    while(t--)
    {
    solution();
}
    return 0;
}

/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<13;
LL mypow(LL x,LL y){
    x%=MOD;
    LL res=1%MOD;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
int h,w,K;
char d[SIZE][SIZE];
LL dp[SIZE][SIZE];
int inv3;
void solve() {
    inv3=mypow(3,MOD-2);
    dp[1][1]=1;
    FOR(i, 1, h){
        FOR(j, 1, w) {
            if(!d[i][j]){
                ADD(dp[i+1][j],inv3*dp[i][j]*2);
                ADD(dp[i][j+1],inv3*dp[i][j]*2);
            }else{
                if(d[i][j]&1){
                    ADD(dp[i][j+1],dp[i][j]);
                }
                if(d[i][j]&2){
                    ADD(dp[i+1][j],dp[i][j]);
                }
            }
        }
    }
    W(dp[h][w]*mypow(3,h*w-K)%MOD);
}
void input() {
    R(h,w,K);
    REP(i,K){
        int x,y;
        char c[4];
        R(x,y);
        RS(c);
        if(c[0]=='X'||c[0]=='R')d[x][y]|=1;
        if(c[0]=='X'||c[0]=='D')d[x][y]|=2;
    }
}
int main(){
    MOD=998244353;
    input();
    solve();
    return 0;
}


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

const int N = 2005;
const int oo = 0x3f3f3f3f;

int Gcd(int a, int b) {
	return (b ? Gcd(b, a % b) : a);
}

int a[N], ans = 0, mn, f = 1;

map<int,int> mp;

void get(int a, int b) {

	if (!mp.count(a)) {
		mp[a] = b;
		return;
	}

	if (mp[a] == a) return;

	int x = mp[a];

	x = Gcd(x, b);

	if (x == a) {
		ans++;
		if (a == mn) f = 0;
		// cout << a << '\n';
	}

	mp[a] = x;

}

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

	mn = oo;

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		mn = min(mn, a[i]);
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j * j <= a[i]; j++) {
			if (a[i] % j == 0) {
				if (j <= mn)
				get(j, a[i]);
				if (j * j != a[i] && a[i] / j <= mn)
					get(a[i] / j, a[i]);
			}
		}
	}

	cout << ans + f;

}

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

	#ifdef local
	freopen("inp.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif

	solve();

}

#include <bits/stdc++.h>

using namespace std;

#define closeSync ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef long double ld;
const int MAXN = 3005;

typedef pair<ld,ld> pll;

ll a[MAXN][7];
int flag[MAXN];
int n;

inline bool check(ll x)
{
    set<int> s;
    for (int i=1;i<=n;i++)
    {
        ll tmp = 0;
        for (int j=1;j<=5;j++)
        {
            if (a[i][j] >= x)
                tmp |= (1LL<<(j-1));
        }
        s.insert(tmp);
    }
    for (auto x : s)
        for (auto y : s)
            for (auto z : s)
            {
                // cout << x << " " << y << " " << z << "\n";
                if ((x|y|z) == 31)
                    return true;
            }
    return false;
}

inline void solve()
{
    cin >> n;
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=5;j++)
        {
            cin >> a[i][j];
        }
    }

    ll l = 0,r = 1e10;
    // cout << check(4) << "\n";
    // cout << check(r) << endl;
    while (r - l > 1)
    {
        ll mid = (l + r) >> 1;
        if (check(mid))
            l = mid;
        else
            r = mid;
    }

    if (check(r))
        cout << r << "\n";
    else
        cout << l << "\n";

    return ;
}

int main()
{closeSync;
    // int T;  cin >> T;
    // while (T--)
        solve();
    return 0;
}

/*
aRbRcRd
*/


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) \
    do               \
    {                \
    } while (0)
#endif
#include <cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(), i##_end = (c).end(); i != i##_end; ++i)

template <class T>
inline void amin(T &x, const T &y)
{
    if (y < x)
        x = y;
}
template <class T>
inline void amax(T &x, const T &y)
{
    if (x < y)
        x = y;
}
#define rprintf(fmt, begin, end)                       \
    do                                                 \
    {                                                  \
        const auto end_rp = (end);                     \
        auto it_rp = (begin);                          \
        for (bool sp_rp = 0; it_rp != end_rp; ++it_rp) \
        {                                              \
            if (sp_rp)                                 \
                putchar(' ');                          \
            else                                       \
                sp_rp = true;                          \
            printf(fmt, *it_rp);                       \
        }                                              \
        putchar('\n');                                 \
    } while (0)

int H, W;
char S[111][111];

void MAIN()
{
    scanf("%d%d", &H, &W);
    REP(i, H)
    scanf("%s", S[i]);

    int ans = 0;
    REP(i, H - 1)
    REP(j, W - 1)
    {
        int cnt = 0;
        if (S[i][j] == S[i][j + 1])
            cnt++;
        if (S[i][j] == S[i + 1][j])
            cnt++;
        if (S[i][j] == S[i + 1][j + 1])
            cnt++;

        if (cnt == 0 || cnt == 2)
            ans++;
    }

    printf("%d\n", ans);
}

int main()
{
    int TC = 1;
    //    scanf("%d", &TC);
    REP(tc, TC)
    MAIN();
    return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <iomanip>
using namespace std;

using VI = vector <int>;
using VVI = vector <VI>;
using VVVI = vector <VVI>;
using VLL = vector <long long>;
using VVLL = vector <VLL>;
using UMI = unordered_map<int, int>;
using UMLL = unordered_map<long long, long long>;

int main() {
    long long ans = 0;
    int L;
    int R;
    cin >> L >> R;

    VI primes;
    int UPPER = R+10;
    VI np(UPPER);
    VI factCnt(UPPER, 0);
    VI onlyOne(UPPER, 1);
    VI ooo(UPPER, 1);

    // 2*2*3
    // 2, 3, 2*2, 2*3, 2*2*3
    for (long long v = 2; v < np.size(); ++v) {
        if (np[v] == 0) {
            primes.push_back(v);

            ++factCnt[v];
            for (long long j = v*2; j < np.size(); j += v) {
                ++factCnt[j];
                np[j] = 1;
                if (j%(v*v) == 0) {
                    // onlyOne[j] = 0;
                    ooo[j] = 0;
                }
            }

            for (long long j = v*v; j < np.size(); j += v*v) {
                // if (j == 14369) {
                //     cout << "DEBUG " << v << endl;
                // }
                onlyOne[j] = 0;
            }
        }

        // for (int j = 0; j < primes.size() && v*primes[j] < np.size(); ++j) {
        //     np[v*primes[j]] = 1;
        //     factCnt[v*primes[j]] = factCnt[v];

        //     if (v%primes[j] == 0) {
        //         onlyOne[v*primes[j]] = 0;
        //         break;
        //     } else {
        //         ++factCnt[v*primes[j]];
        //     }
        // }
    }

    // for (long long v = 2; v < np.size(); ++v) {
    //     if (ooo[v] != onlyOne[v]) {
    //         cout << "WHY " << v << " " << ooo[v] << " " << onlyOne[v] << endl;
    //     }
    // }

    for (long long g = 2; g <= R; ++g) {
        long long from = max(1LL, (L+g-1)/g);
        long long to = R/g;

        long long cho = to-from+1;
        // long long cho = to - (L-1)/g;
        long long sign = factCnt[g]%2 == 0 ? -1 : 1;

        // cout << "CHO " << cho << endl;
        if (cho >= 1 && onlyOne[g]) {
            ans += sign * cho * (cho-1) / 2;
        }

        if (from <= 1 && to >= from) {
            ans -= (to-1);
        }

        // cout << sign << " " << onlyOne[g] << " " << g << " DEBUG " << from << " " << to << " " << ans << endl;
    }

    cout << ans*2 << endl;

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;

const int m = 1e9+7;
int main() {
  int n;
  cin >> n;
  const char a='A',b='B';
  char aa,ab,ba,bb;
  cin >> aa >> ab >> ba >> bb;
  auto p = [&]{
    int res = 1;
    rep(_,n-3) res = (res<<1)%m;
    return res;
  };
  int ans = [&]{
    if(n<=3) return 1;
    if(ab==a&&aa==a) return 1;
    if(ab==b&&bb==b) return 1;
    if(ab==a&&ba==b) return p();
    if(ab==b&&ba==a) return p();
    int x[2] = {0,1};
    rep(_,n-2){
      int y[2] = {x[1],(x[0]+x[1])%m};
      swap(x,y);
    }
    return x[1];
  }();
  cout << ans << endl;
}

/*input
2
A
B
A
A
*/
#include <bits/stdc++.h>
using namespace std;

namespace my_template {
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

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

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<pi> vpi;
typedef vector<vpi> vpii;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef std::string str;
typedef std::vector<str> vs;

#define x first
#define y second
#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"

const ld PI = 3.14159265358979323846264338327950288419716939937510582097494L;

template<typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x + b.x, a.y + b.y); }
template<typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x - b.x, a.y - b.y); }
template<typename T>
T operator*(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.x + a.y * b.y); }
template<typename T>
T operator^(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.y - a.y * b.x); }

template<typename T>
void print(vector<T> vec, string name = "") {
	cout << name;
	for (auto u : vec)
		cout << u << ' ';
	cout << '\n';
}
}
using namespace my_template;

const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;

ll mypow(ll a, ll b) {
	a %= MOD;

	ll ret = 1;

	while (b) {
		if (b & 1) ret = (ret * a) % MOD;

		b >>= 1;
		a = (a * a) % MOD;
	}

	return ret;
}

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

	vii mp(2, vi(2));

	for (int a = 0; a < 2; ++a)
	{
		for (int b = 0; b < 2; ++b)
		{
			char ch;
			cin >> ch;
			mp[a][b] = ch - 'A';
		}
	}

	if (N == 2) return !printf("1\n");
	vl fac(N + 1, 1);
	for (int i = 2; i <= N; ++i)
	{
		fac[i] = (i * fac[i - 1]) % MOD;
	}

	{
		int k = mp[0][1];
		if (mp[k][k] == k) {
			printf("1\n");
			return 0;
		}
	}

	if (mp[0][1] != mp[1][0]) {
		ll ats = mypow(2, N - 3);

		// ll ats = 1;
		// for (int i = 0; i < N - 3; ++i)
		// {
		// 	ats = (ats * 2) % MOD;
		// }
		printf("%lld\n", ats);
		return 0;
	}

	// A (N-3) AB
	// A   A   AB
	ll ats = 0;

	for (int reik = N - 3; reik >= 0; --reik)
	{
		int vietu = N - 3 - reik + 1;

		if (reik > vietu) continue;

		ll plus = (fac[vietu] * mypow(fac[vietu - reik], MOD - 2)) % MOD;

		plus = (plus * mypow(fac[reik], MOD - 2)) % MOD;

		ats = (ats + plus) % MOD;
	}

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

}

/* Look for:
* special cases (n=1?)
* overflow (ll vs int?)
* the exact constraints (multiple sets are too slow for n=10^6 :( )
* array bounds
*/


//#pragma GCC optimize(2)
//#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#define rush()      int T; while(cin>>T) while(T--)
#define ms(a,b)     memset(a,b,sizeof a)
#define lowbit(x)   ((x)&(-x))
#define inf         0x7f7f7f7fll
#define eps         1e-11
#define sd(a)       scanf("%d",&a)
#define sll(a)      scanf("%lld",&a)
#define sll2(a,b)   scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define sdd(a,b)    scanf("%d%d",&a,&b)
#define sddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sf(a)       scanf("%lf",&a)
//#define sc(a)       scanf("%c\n",&a)
#define ss(a)       scanf("%s",a)
#define pd(a)       printf("%d\n",a)
#define pdd(a,b)    printf("%d %d\n",a,b)
#define pddd(a,b,c) printf("%d %d %d\n",a,b,c)
#define pll(a)      printf("%lld\n",a)
#define pf(a)       printf("%.1lf\n",a)
#define pc(a)       printf("%c",a)
#define ps(a)       printf("%s\n",a)
#define forn(i,a,b) for(int i=(a);i<=(b);i++)
#define pb(a)       push_back(a)
#define mp(a,b)     make_pair(a,b)
#define debug(a)    cout<<#a<<" : "<<a<<" "<<" ; "
#define dbg(a)      cout<<#a<<" : "<<a<<endl
#define show(a,b)   cout<<a<<" :\t"<<b<<"\t*"<<endl
#define IOS         ios::sync_with_stdio(0); cin.tie(0)
#define PAUSE       system("pause")
//#define print(a)    cout<<a<<endl;continue;
#define fr          first
#define sc          second
#define ceils(a,b)  ((a-1ll+b)/(b))
#define floors(a,b) floor(double(a)/double(b))
using namespace std;
//inline void swap(int &x,int &y){x^=y^=x^=y;}
typedef long long ll;
//using ui=unsigned int;
typedef unsigned long long ull;
typedef pair<int,int> Pair;
const double pi=acos(-1.0);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
const int limit=5e5;

int read()
{
	int s=0;
	char c=getchar(),lc='+';
	while (c<'0'||'9'<c) lc=c,c=getchar();
	while ('0'<=c&&c<='9') s=s*10+c-'0',c=getchar();
	return lc=='-'?-s:s;
}

void write(int x)
{
	if (x<0) putchar('-'),x=-x;
	if (x<10) putchar(x+'0');
	else write(x/10),putchar(x%10+'0');
}

void print(int x,char c='\n')
{
	write(x);
	putchar(c);
}

ll mod=998244353;
const int N=1e6+5;

    int n, m, _;
    int i, j, k;
    //int a[N];
    char s[N],t[N];
    vector<int> u,v;

signed main()
{
    //IOS;
    while(cin>>n){
        ss(s+1); ss(t+1);
        for(int i=1;i<=n;i++){
            if(s[i]=='0') u.pb(i);
            if(t[i]=='0') v.pb(i);
        }
        if(u.size()!=v.size()) puts("-1");
        else{
            int ans=0;
            for(int i=0;i<u.size();i++){
                if(u[i]==v[i]) continue;
                ans++;
            }
            pd(ans);
        }
    }
    //PAUSE;
    return 0;
}

#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> A(2 * N);
    for(auto&& i : A)cin >> i;
    vector<pair<unsigned long, unsigned long>> B;
    B.reserve(2 * N);
    transform(begin(A), end(A), back_inserter(B), [cnt{0UL}](unsigned long a) mutable {return make_pair(a, cnt++);});
    nth_element(begin(B), begin(B) + N, end(B));
    vector<unsigned long> HL(2 * N);
    for(unsigned long i{}; i < N; ++i)HL[B[i].second] = 1;
    vector<pair<unsigned long, unsigned long>> rem_idx{};
    string ans(2 * N, ' ');
    for(unsigned long i{}; i < 2 * N; ++i)if(!rem_idx.empty() && rem_idx.back().second != HL[i]){
        ans[rem_idx.back().first] = '(';
        ans[i] = ')';
        rem_idx.pop_back();
    }else rem_idx.emplace_back(i, HL[i]);
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
signed main(){
    int n;
    string s,t;
    cin>>n>>s>>t;
    int ans=0;
    vector<int>s1;
    for(int i=n-1;i>=0;i--)
        if(s[i]=='1')
            s1.push_back(-i);
    for(int i=0;i<n;i++){
        if(s[i]==t[i])
            continue;
        int pos=lower_bound(s1.begin(),s1.end(),-i)-s1.begin()-1;
        if(pos==-1){
            cout<<-1<<endl;
            return 0;
        }
        ans+=-i-s1[pos];
        s[-s1[pos]]='0'+'1'-s[-s1[pos]];
        s1[pos]=-i;
    }
    cout<<ans<<endl;
}

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

int main(){
  cii(n);
  cci(x0,y0);
  cci(x2,y2);

  db pi=acos(-1);
  db S=pi/n*2;

  db sinS=sin(S);
  db cosS=cos(S);

// co(sinS);co(cosS);
  db hx=1.*(x0+x2)/2;
  db hy=1.*(y0+y2)/2;
// co(hx);co(hy);

  db xd=x0-hx;
  db yd=y0-hy;

  db x,y;
  x= xd*cosS - yd*sinS +hx;
  y= xd*sinS + yd*cosS +hy;

  // x=xd*sinS-yd*cosS+hx;
  // y=xd*cosS+yd*sinS+hy;

  printf("%.9lf %.9lf\n",x,y);
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

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

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

char janken(char c1, char c2) {
  if (c1 == 'R') {
    if (c2 == 'P') return 'P';
    if (c2 == 'S') return 'R';
  }
  if (c1 == 'P') {
    if (c2 == 'R') return 'P';
    if (c2 == 'S') return 'S';
  }
  if (c1 == 'S') {
    if (c2 == 'R') return 'R';
    if (c2 == 'P') return 'S';
  }
  return c1;
}

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string tmp = s;

  for (int j = 0; j < k; j++) {
    tmp = s + s;
    for (int i = 0; i < n; i++) {
      s[i] = janken(tmp[i * 2], tmp[i * 2 + 1]);
    }
  }

  cout << s[0] << '\n';
  return 0;
}

#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

struct Data
{
  int cnt, value;
  Data operator+(const Data &other)
  {
    if (cnt == 0 && other.cnt == 0)
      return value < other.value ? *this: other;
    if (cnt == 0)
      return *this;
    if (other.cnt == 0)
      return other;
    return *this;
  }
};
const Data nil = Data{1, (int)1e9};

// DON'T FORGET TO DEFINE THE NIL!!!
template<class T>
struct Segtree
{
  int size;
  T nil;
  vector<T> data;
  vector<T> st;
  Segtree() { }
  Segtree(int size, T nil) : size(size), nil(nil)
  {
    data.resize(size, nil);
    st.resize(4*size, nil);
  }
  Segtree(vector<T> &data, T nil) : size(data.size()), data(data), nil(nil)
  {
    st.resize(4*size);
    build();
  }
  void build() { build(1, 0, size - 1); }
  T query(int qlo, int qhi) { return query(qlo, qhi, 1, 0, size - 1); }
  void update(int pos, T value) { update(pos, value, 1, 0, size - 1); }
  void build(int i, int lo, int hi)
  {
    if (lo == hi)
    {
      st[i] = data[lo];
      return;
    }
    int mid = (lo + hi) >> 1;
    build(2*i, lo, mid), build(2*i + 1, mid + 1, hi);
    st[i] = st[2*i] + st[2*i + 1];
  }
  T query(int qlo, int qhi, int i, int lo, int hi)
  {
    if (hi < qlo || lo > qhi) return nil;
    if (lo >= qlo && hi <= qhi) return st[i];
    int mid = (lo + hi) >> 1;
    return query(qlo, qhi, 2*i, lo, mid) + query(qlo, qhi, 2*i + 1, mid + 1, hi);
  }
  void update(int pos, T &value, int i, int lo, int hi)
  {
    if (lo == hi)
    {
      // st[i] = data[lo] = value;
      st[i].cnt += value.cnt;
      return;
    }
    int mid = (lo + hi) >> 1;
    if (pos <= mid) update(pos, value, 2*i, lo, mid);
    else update(pos, value, 2*i + 1, mid + 1, hi);
    st[i] = st[2*i] + st[2*i + 1];
  }
};
Segtree<Data> segtree;

const int maxN = 1500000; int n, m;
int a[maxN];

int main()
{
  while (~scanf("%d %d", &n, &m))
  {
    segtree = Segtree<Data>(maxN + 1, nil);
    for (int i = 0; i < n; i++)
      scanf("%d", &a[i]);

    int ans = 1e9;
    for (int i = 0; i <= maxN; i++)
      segtree.data[i] = Data{0, i};
    segtree.build();
    for (int i = 0; i < m; i++)
      segtree.update(a[i], Data{1, 0});

    for (int i = 0; i + m - 1 < n; i++)
    {
      // [i : i + m - 1]
      ans = min(ans, segtree.query(0, maxN).value);
      segtree.update(a[i], Data{-1, 0});
      if (i + m < n) segtree.update(a[i + m], Data{1, 0});
    }
    printf("%d\n", ans);
  }
  return 0;
}


#include <bits/stdc++.h>
#define f(i,j,k) for(long long i=j;i<k;i++)
#define f2(i,j,k) for(long long i=j;i>=k;i--)
#define ll long long
#define ld long double
using namespace std;
const long long mod=1e9+7;
const long long mod2=998244353;
const long long INF = (1 << 29);
void chmin(int& a, int b){ if(a > b) a = b; }
void chmax(int& a, int b){ if(a < b) a = b; }
void yn(ll a){
    if(a==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}
int main(){
    string s,t,u;
    ll a,b,c,d,e,n,k,ans=0,ans3=0;
    ld x,y,z,ans2=0;
    cin>>n;
    f(i,0,n){
        cin>>x;
        ans+=abs(x);
        ans2+=x*x;
        a=abs(x);
        ans3=max(ans3,a);
    }
    cout<<ans<<endl;
    cout<<fixed<<setprecision(10)<<sqrt(ans2)<<endl;
    cout<<ans3<<endl;
    return 0;
}

#include <bits/stdc++.h>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
const ul mod = 1000000007;

void output(ll a, ll b, ll c, ll d) {
    cout << a << " " << b << " " << c << " " << d << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> x(n), y(n), r(n);
    rep(i, n) { cin >> x[i] >> y[i] >> r[i]; }

    rep(i, n) { output(x[i], y[i], x[i] + 1, y[i] + 1); }
    return 0;
}


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

#define ll long long

int main()
{

     int t;
    /* cin>>t;
     while(t--)
{*/
         ll n;

         vector<ll>v,v1;

         string s,s1;
         ll a,k,rem,b,x,y,coun=0,new_coun=0,sum=0,flag=0,ans=0,c_0=0,c_1=0,c_2=0;
         cin>>n>>k;

         ans=n;

         while(k--)
         {
             a=n;
             while(n != 0)
             {
               rem= n%10 ;
               v.push_back(rem);
               n/=10;
             }

             sort(v.begin(),v.end());
             ll temp=0;
             for(ll i=0;i<v.size();i++)
             {
                 temp*=10;
                 temp+=v[i];
             }
              sort(v.begin(),v.end(),greater<ll>());
              ll temp1=0;
             for(ll i=0;i<v.size();i++)
             {
                 temp1*=10;
                 temp1+=v[i];
             }

            ans =temp1-temp;
             n=ans;

             v.clear();
        }

         cout<<ans<<endl;

//}
return 0;

}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz(x) (int)x.size()
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

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

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

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

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	ll n,k;
	cin>>n>>k;
	if(!k)
	{
		cout<<n<<"\n";
		return;
	}
	for(int i=1;i<=k;i++)
	{
		VL xf;
		while(n)
		{
			xf.pb(n%10);
			n /= 10;
		}
		sort(begin(xf), end(xf), [](ll A, ll B){ return (A < B); });
		ll n1 = 0;
		for(auto &&u : xf)
		n1 = 10*n1 + u;
		sort(begin(xf), end(xf), [](ll A, ll B){ return (A > B); });
		ll n2 = 0;
		for(auto &&u : xf)
		n2 = 10*n2 + u;
		n = n2 - n1;
	}
	cout<<n<<"\n";
	return;
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

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

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll mod = 1e9 + 7;
const ll linf = 1LL << 62;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, M;
vector<pii> v;
map<int, vector<int>> mp;
int ok[400010];
vector<int> xs[400010];
int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int X, Y;
        cin >> X >> Y;
        v.push_back({X, Y});
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < M; i++) {
        if (N - M <= v[i].second && v[i].second <= N + M) xs[v[i].second - N + M].push_back(v[i].first);
    }
    for (int i = 0; i <= 2 * M; i++) {
        xs[i].push_back(2 * N + 1);
    }
    if (xs[M].empty()) {
        ok[M] = 2 * N;
    } else {
        ok[M] = xs[M][0];
    }
    vector<pii> up;
    for (int i = 0; i < M; i++) {
        int y = v[i].second;
        if (N - M <= y && y <= N + M) {
            y -= N - M;
            if (y > 0 && ok[y - 1] >= v[i].first) {
                up.push_back({y, *(upper_bound(xs[y].begin(), xs[y].end(), v[i].first))});
            }
            if (y < 2 * M && ok[y + 1] >= v[i].first) {
                up.push_back({y, *(upper_bound(xs[y].begin(), xs[y].end(), v[i].first))});
            }
        }
        if (i == M - 1 || v[i].first != v[i + 1].first) {
            for (auto u : up) {
                chmax(ok[u.first], u.second);
            }
            up.clear();
        }
    }
    int cnt = 0;
    for (int i = 0; i <= 2 * M; i++) {
        cnt += (ok[i] == 2 * N + 1);
    }
    cout << cnt << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define Next(i, u) for (int i = h[u]; i; i = e[i].next)
const int N = 2e3 + 5;
const int M = 3e7 + 5;
const int inf = 1e9;
struct edge { int v, next, w;} e[M];
queue <int> Q;
char s[N][N]; int n, m, S, T, tot, h[N * N], dis[N * N];
int read() {
    char c; int x = 0, f = 1;
    c = getchar();
    while (c > '9' || c < '0') { if(c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int c(int x, int y) { return (x - 1) * m + y;}
void add(int u, int v, int w) { e[++tot].v = v, e[tot].w = w, e[tot].next = h[u], h[u] = tot;}
int main () {

    n = read(), m = read();
    rep(i, 1, n) scanf("%s", s[i] + 1);
    rep(i, 1, n) rep(j, 1, m) if(s[i][j] == 'S') S = c(i, j);
    rep(i, 1, n) rep(j, 1, m) if(s[i][j] == 'G') T = c(i, j);
    rep(i, 1, n) rep(j, 1, m) if(s[i][j] != '#') {
        if(s[i - 1][j] != '#' && i > 1) add(c(i, j), c(i - 1, j), 1);
        if(s[i][j - 1] != '#' && j > 1) add(c(i, j), c(i, j - 1), 1);
        if(s[i + 1][j] != '#' && i < n) add(c(i, j), c(i + 1, j), 1);
        if(s[i][j + 1] != '#' && j < m) add(c(i, j), c(i, j + 1), 1);
        if(s[i][j] >= 'a' && s[i][j] <= 'z') add(c(i, j), n * m + s[i][j] - 'a' + 1, 0), add(n * m + s[i][j] - 'a' + 1, c(i, j), 1);
    }
    memset(dis, 0x3f, sizeof(dis));
    dis[S] = 0, Q.push(S);
    while (!Q.empty()) {
        int u = Q.front(); Q.pop();
        Next(i, u) {
            int v = e[i].v; if(dis[v] < inf) continue;
            dis[v] = dis[u] + e[i].w, Q.push(v);
        }
    }
    printf("%d", dis[T] < inf ? dis[T] : -1);
    return 0;
}


#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Oct 11 23:22:41 JST 2020
 **/

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

const Int INF = 1e18;
signed main() {
    Int n, m;
    std::cin >> n >> m;
    std::vector<Int> w(n);
    REP(i, n) std::cin >> w[i];
    std::map<Int, Int> mp;
    mp[0] = 0;
    mp[INF] = INF;
    REP(i, m) {
        Int l, v;
        std::cin >> l >> v;
        if (v < *std::max_element(ALL(w))) {
            std::cout << -1 << std::endl;
            return 0;
        }
        chmax(mp[v], l);
    }
    Int ma = 0;
    for (auto& p : mp) {
        chmax(ma, p.second);
        p.second = ma;
    }
    Int ans = INF;
    std::sort(ALL(w));
    do {
        std::vector<Int> d(n);
        REP(i, 1, n) {
            Int sum = w[i];
            for (Int j = i - 1; j >= 0; j--) {
                sum += w[j];
                auto it = std::prev(mp.lower_bound(sum));
                chmax(d[i], d[j] + it->second);
            }
        }
        chmin(ans, d.back());
    } while (std::next_permutation(ALL(w)));
    std::cout << ans << std::endl;
}

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

int main() {
    int n, m;
    cin >> n >> m;

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

    vector<int> ls(m), vs(m), indices(m);
    for (int i = 0; i < m; i++) {
        cin >> ls[i] >> vs[i];
    }

    if (*max_element(begin(ws), end(ws)) > *min_element(begin(vs), end(vs))) {
        cout << -1 << endl;
        return 0;
    }

    iota(begin(indices), end(indices), 0);
    sort(begin(indices), end(indices), [&](int i, int j) { return vs[i] < vs[j]; });

    map<int, int, greater<int>> map;    // map[x] := 対荷重x以下のパーツの中で最長の長さ
    int max_length = 0;
    map[0] = 0;
    for (int i : indices) {
        max_length = max(max_length, ls[i]);
        map[vs[i]] = max_length;
    }

    vector<int> perm(n);
    iota(begin(perm), end(perm), 0);

    int64_t ans = 1LL << 50;

    do {
        vector<vector<int>> cost(n, vector<int>(n, 0));

        for (int i = 0; i < n; i++) {
            int w_sum = ws[perm[i]];
            for (int j = i + 1; j < n; j++) {
                w_sum += ws[perm[j]];
                cost[i][j] = map.upper_bound(w_sum)->second;
            }
        }
        vector<int> table(n, 0);

        for (int i = n - 1; i >= 0; i--) {
            for (int j = i + 1; j < n; j++) {
                table[i] = max(table[i], cost[i][j] + table[j]);
            }
        }
        ans = min(ans, (int64_t)table[0]);
    } while (next_permutation(begin(perm), end(perm)));

    cout << ans << endl;

    return 0;
}


/*
f[n][k] = f[n - 1][k - 1] + f[n][2k]
*/

#include <cstdio>
#include <algorithm>

const int N = 3000 + 10;
const int MOD = 998244353;

int n, m;
int f[N][N << 1];

inline int qmod(int x) { return (x>=MOD)?(x-MOD):x; }

int main() {
	int i, j;

	scanf("%d %d", &n, &m);

	f[0][0] = 1;
	for(i=1; i<=n; i++)
		for(j=i; j; j--)
			f[i][j] = qmod(f[i - 1][j - 1] + f[i][j << 1]);
	printf("%d\n", f[n][m]);
	return 0;
}

#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb push_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 3e5 + 5;
int n,k,cnt[MAXN];

int main(){
    scanf("%d%d",&n,&k);
    FOR(i,1,n){
        int x;scanf("%d",&x);++cnt[x];
    }
    int rem = k;LL ans = 0;
    FOR(i,0,n-1){
        rem = std::min(rem,cnt[i]);
        ans += rem;
    }
    printf("%lld\n",ans);
    return 0;
}


#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}
template <class Con>
string concat(const Con &c, const string &spr){
	stringstream ss;
	typename Con::const_iterator it = c.begin(), en = c.end();
	bool fst = true;
	for(; it != en; ++it){
		if(!fst){ ss << spr; }
		fst = false;
		ss << *it;
	}
	return ss.str();
}

template <class Con, class Fun>
vector<typename Con::value_type> cfilter(const Con &c, Fun f) {
	vector<typename Con::value_type> ret;
	typename Con::const_iterator it = c.begin(), en = c.end();
	for(; it != en; ++it){
		if(f(*it)){
			ret.emplace_back(*it);
		}
	}
	return ret;
}
#if __cplusplus >= 201103L
template <class Con, class Fun>
auto cmap(const Con &c, Fun f) -> vector<decltype(f(*c.begin()))> {
	vector<decltype(f(*c.begin()))> ret;
	ret.reserve(c.size());
	for(const auto &x: c){
		ret.emplace_back(f(x));
	}
	return ret;
}
#endif

#if __cplusplus >= 201402L
#define lambda(e) ([&](const auto &_){ return (e); })
#define lambda2(e) ([&](const auto &_a, const auto &_b){ return (e); })
#endif

#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()
#define tget(t,i) get<i>(t)

#define MOD 1000000007LL
#define EPS 1e-8

vint input(map<char,int> &mp){
	string s;
	cin >> s;
	vint v;
	for(char c : s){
		v.push_back(mp.emplace(c, mp.size()).first->second);
	}
	return v;
}

LL calc(const vector<int> &perm, const vector<int> &v){
	LL r = 0;
	for(int x : v){
		r = r * 10 + perm[x];
		if(r == 0){ return -1; }
	}
	return r;
}

void mainmain(){
	map<char,int> mp;
	vint a = input(mp);
	vint b = input(mp);
	vint c = input(mp);
	if(mp.size() <= 10){
		vint perm(10);
		iota(ALL(perm), 0);
		do{
			LL d = calc(perm, a);
			LL e = calc(perm, b);
			LL f = calc(perm, c);
			if(d > 0 && e > 0 && f > 0 && d + e == f){
				cout << d << '\n' << e << '\n' << f << '\n';
				return;
			}
		} while(next_permutation(ALL(perm)));
	}
	cout << "UNSOLVABLE\n";
}

}
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}

/**
 *    author:  otera
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
#include<array>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	char s, t; cin >> s >> t;
    if(s == 'Y') {
        cout << (char)('A' + (t - 'a')) << endl;
    } else {
        cout << t << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long r, x, y;
  cin >> r >> x >> y;
  long long cnt = 0;
  long long rad = 0;
  while (rad * rad < x * x + y * y) {
    cnt = cnt + 1;
    rad = rad + r;
  }
  if (cnt == 1) {
    if (rad * rad > x * x + y * y) {
      cnt = cnt + 1;
    }
  }
  cout << cnt << '\n';
  return 0;
}

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


#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...)
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};

const int N=202020;
vector<int> g[N];
int c[N];
int cc[N];
int d[N];
int h[N];
void dfs1(int v,int p=0,int dd=0){
    d[v]=dd;
    for(int to:g[v])
        if(to^p)
            dfs1(to,v,dd+1);
}
void dfs2(int v,int p=0){
    h[v]=0;
    for(int to:g[v])
        if(to^p){
            dfs2(to,v);
            upx(h[v],h[to]+1);
        }
}
int q;
void dfs3(int v,int p=0){
    c[v]=q;
    sort(g[v].begin(),g[v].end(),[&](int x,int y){
        return h[x]<h[y];
    });
    for(int to:g[v]){
        if(to^p){
            q++;
            dfs3(to,v);
            q++;
        }
    }
}
int32_t main(){
    int n;
    cin>>n;
    forn(i,n-1){
        int x,y;
        cin>>x>>y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs1(1);
    int s1=max_element(d+1,d+n+1)-d;
    dfs1(s1);
    int s2=max_element(d+1,d+n+1)-d;
    dfs2(s1);
    q=1;
    dfs3(s1);
    for(int i=1;i<=n;++i){
        cc[i]=c[i];
    }
    dfs2(s2);
    q=1;
    dfs3(s2);
    int o1=*max_element(c+1,c+n+1);
    int o2=*max_element(cc+1,cc+n+1);
    if(o1<o2){
        for(int i=1;i<=n;++i)cout<<c[i]<<' ';
    }else{
        for(int i=1;i<=n;++i)cout<<cc[i]<<' ';
    }
    cout<<'\n';
    return 0;
}

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//Dijkstra法
typedef pair<ll, ll> P;

void Dijkstra(int s, vector<vector<pair<ll,ll>>>& g, vector<ll>& d) {
	priority_queue<P, vector<P>, greater<P>> q;
	d = vector<ll>(g.size(), INF_LL);
	d[s] = 0;
	q.push(P{ 0,s });

	while (!q.empty()) {
		P p = q.top(); q.pop();
		ll v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < g[v].size(); i++) {
			auto e = g[v][i];
			if (d[e.first] > d[v] + e.second) {
				d[e.first] = d[v] + e.second;
				q.push(P{ d[e.first] , e.first });
			}
		}
	}
}

int main() {
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	a--; b--;
	vector < vector<pair<ll, ll>>> G(200);
	for (int i = 0; i < 100; i++) {
		G[i].push_back({ i+100,x });
		G[i+100].push_back({ i,x });
	}
	for (int i = 0; i < 99; i++) {
		G[i + 1].push_back({ i + 100,x });
		G[i + 100].push_back({ i + 1 ,x });
		G[i + 1].push_back({ i,y });
		G[i].push_back({ i + 1,y });
	}
	vector<ll> d;
	Dijkstra(a, G, d);
	cout << d[b + 100] << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug true
#define debug2 false

class segmenttree{
    /*
    Copyright (c) 2021 0214sh7
    https://github.com/0214sh7/library/
    */
    private:
    int n;
    long long identity = 0;//単位元
    std::vector<long long> dat;
    public:

    void init(int N){
        n=1;
        while(n<N)n*=2;
        dat.clear();
        for(int i=0;i<2*n-1;++i){
            dat.push_back(identity);
        }
    }

    segmenttree(int N){
        init(N);
    }

    long long calc();

    void update(int k,long long a){
        k+=n-1;
        dat[k]=a;
        while(k>0){
            k=(k-1)/2;
            dat[k]=calc(dat[2*k+1],dat[2*k+2]);
        }
    }

    long long query(long long a,long long b){
        a+=n;
        b+=n;
        long long R=0;
        while(a < b){
            if(a % 2 == 1){
                R = calc(R, dat[a - 1]);
                a += 1;
            }
            a /= 2;
            if(b % 2 == 1){
                b -= 1;
                R = calc(R, dat[b - 1]);
            }
            b /= 2;
        }
        return R;
    }

    long long calc(long long a,long long b){
        //your monoid here
        return max(a,b);
    }

};

int main(void){

    ll N;
    vector<ll> A,B(214514);

    cin >> N;
    REP(i,N){
        ll a;
        cin >> a;
        A.push_back(a);
    }

    B[0]=A[0];
    REP(i,N-1){
        B[i+1]=B[i]+A[i+1];
    }

    segmenttree SEG(N);
    REP(i,N){
        SEG.update(i,A[i]);
    }

    ll num = 0;
    REP(i,N){
        ll m = SEG.query(0,i+1);
        num += B[i];

        ll Ans = num;
        Ans += (i+1)*m;
        cout << Ans << endl;
    }

    return 0;
}

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

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

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


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define N 2114514
const ll mod = 998244353;
const ll inf = 1000000000000000000;
ll a[N],b[N];
int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    for(int i=0;i<n;i++)sum+=a[i]*b[i];
    if (sum)
        cout << "No";
    else
        cout << "Yes";
    return 0;
}

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

#define pb          push_back
#define ll         long long
// #define ll			unsigned long long
#define mp          make_pair
#define pi         pair<int,int>
#define vi          vector<int>
#define vc 			vector<char>
#define vs 			vector<string>
#define vl			vector<ll>
#define vb			vector<bool>
#define vu			vectorll>
#define vpi         vector<pi>
#define ve(a)		vector<a>
#define mi          map<int,int>
#define all(a)      (a).begin(),(a).end()
#define fr(i, a, b)	for(int i = a; i < b; i++)
#define rf(i, a, b)	for(int i = a; i >= b; i--)
#define M 1000000007
#define faster ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mem(a)      memset(a, 0, sizeof(a))
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)   ((a)*(b)) / __gcd((a),(b))
#define exists(v, e) binary_search(v.begin(), v.end(), e)
#define index(v, e) (int)(find(v.begin(), v.end(), e) - v.begin())
#define lw(v, e) lower_bound(v.begin(), v.end(), e) - v.begin()
#define up(v, e) upper_bound(v.begin(), v.end(), e) - v.begin()
#define maxh(a) priority_queue<a>
#define minh(a) priority_queue<a, vector<a>, greater<a>>
#define fi first
#define se second
#define nob(a) __builtin_popcount(a)

ll i, j, k, l, m, n, o, p, q, x, y, z, res, ans;
string s, r, str, s1, s2, s3, s4;
char c, c1, c2, c3, c4;

void solve(){
	cin >> n;
	ans = 0;
	vi a, b;
	fr(i, 0, n){
		cin >> x;
		a.pb(x);
	}
	fr(i, 0, n){
		cin >> x;
		b.pb(x);
	}
	fr(i, 0, n){
		ans += a[i] * b[i];
	}
	if(ans == 0){
		cout << "Yes\n";
		return;
	}
	cout << "No\n";
}

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


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" "
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;cin>>n;
    v a(n);in(a,n);
    v b(n);in(b,n);
    v M=a;
    for (int i = 1; i < n; ++i)
    {
    	M[i]=max(M[i-1],M[i]);
    }
    v c(n);
    c[0]=a[0]*b[0];
    for (int i = 1; i < n; ++i)
    {
    	c[i]=max(c[i-1],M[i]*b[i]);
    }
    for (int i = 0; i < n; ++i)
    {
    	cout<<c[i]<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INF 2147483607
#define common cout << "Case #" << w+1 << ": "

int main()
{
    int n;
    cin >> n;
    char aa,ab,ba,bb;
    cin >> aa >> ab >> ba >> bb;
    if(ab=='A')
    {
        if(aa=='A')
            cout << "1" << endl;
        else
        {
            if(ba=='A')
            {
                vector<int>v(1005);
                v[2]=1;v[3]=1;
                for(int i=4;i<=n;i++)
                    v[i]=(v[i-1]*1LL+v[i-2])%mod;
                cout << v[n] << endl;
            }
            else
            {
                int p=max(0,n-3);
                int ans=1;
                for(int i=0;i<p;i++)
                    ans=(ans*1LL*2)%mod;
                cout << ans << endl;
            }
        }
    }
    else
    {
        if(bb=='B')
            cout << "1" << endl;
        else
        {
            if(ba=='B')
            {
                vector<int>v(1005);
                v[2]=1;v[3]=1;
                for(int i=4;i<=n;i++)
                    v[i]=(v[i-1]*1LL+v[i-2])%mod;
                cout << v[n] << endl;
            }
            else
            {
                int p=max(0,n-3);
                int ans=1;
                for(int i=0;i<p;i++)
                    ans=(ans*1LL*2)%mod;
                cout << ans << endl;
            }
        }

    }
}


//:::: Alien :::://
// Muhammad Eid //
#include <bits/stdc++.h>
using namespace std;

void Mo35() {
//    ios_base::sync_with_stdio(false);
//    cin.tie(nullptr);
//    cout.tie(nullptr);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
}

int main() {  Mo35();

    string s;
    cin >> s;
    int sz = s.size();
    for (int i = 1; i < sz; i += 2) {
        if (islower(s[i])) {
            cout << "No";
            return 0;
        }
    }
    for (int i = 0; i < sz; i += 2) {
        if (isupper(s[i])) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define REP(i, m, n) for (int i = m; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define dup(x, y) (((x) + (y)-1) / (y))
#define PI 3.14159265359
typedef long long LL;
const LL MOD = 1e9 + 7;
const LL LLINF = 1LL << 60;
const int INF = 1 << 30;

template <class T>
inline void chmax(T &a, T b) {
    if (a < b) {
        a = b;
    }
}
template <class T>
inline void chmin(T &a, T b) {
    if (a > b) {
        a = b;
    }
}
template <class T>
inline T lcm(T x, T y) {
    return x / __gcd(x, y) * y;
}
template <class T>
inline void print_vector(vector<T> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    cout << endl;
}
template <class T>
inline T mpower(T x, T n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        return mpower(x * x % MOD, n / 2);
    } else {
        return x * mpower(x, n - 1) % MOD;
    }
}

template <class T>
inline T q_power(T x, T n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        return q_power(x * x, n / 2);
    } else {
        return x * q_power(x, n - 1);
    }
}

LL mfrac(LL x) {
    LL res = 1;
    for (LL i = x; i >= 1; i--) {
        res *= i;
        res %= MOD;
    }
    return res;
}

int main(void) {
    string S;
    cin >> S;

    for (int i = 1; i <= S.size(); i++)
    {
        if(i%2 == 1 and ('a' > S[i-1] or S[i-1] > 'z')){
            cout << "No" << endl;
            return 0;
        }

        if(i%2 == 0 and ('A' > S[i-1] or S[i-1] > 'Z')){
            cout << "No" << endl;
            return 0;
        }
    }

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


#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  set<int> st;
  int cur = 0;
  REP(_, n) {
    int p; cin >> p;
    st.emplace(p);
    while (st.count(cur) == 1) ++cur;
    cout << cur << '\n';
  }
  return 0;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int N;
char S[100011];

void MAIN() {
    scanf("%d%s", &N, S);

    int ans = -1;
    if (S[0] != S[N-1]) {
	ans = 1;
    } else {
	bool f = false;
	REP (i, N-1) {
	    if (S[i] != S[0] && S[i+1] != S[0]) {
		f = true;
	    }
	}

	if (f) ans = 2;
	else ans = -1;
    }
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}


#define _GLIBCXX_DEBUG
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<queue>
#include<ctime>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);i++)

constexpr double et = 1.8;

int N = 30;
int Si, Sj, Ti, Tj;

int main() {
  srand(time(nullptr));
  int ti = clock();

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

  vector<double> est_D(N * N * N * N, 0);
  vector<double> checked_num(N * N * N * N, 0);

  double epsilon = 1;

  rep(qi, 1000) {
    // init start

    cin >> Si >> Sj >> Ti >> Tj;

    // init end

  //   double cur_time = (double)(clock() - ti) / CLOCKS_PER_SEC;
  //   while (cur_time < et) {
  //
  //     // main loop start
  //
  //
  //     // main loop end
  //
  //     cur_time = (double)(clock() - ti) / CLOCKS_PER_SEC;
  //   }

    vector<char> output;

    priority_queue<pair<int, int>> Q;
    vector<int> color(N * N, 0);
    vector<int> dist(N * N, 1 << 28);
    vector<int> prev_dir(N * N, '.');
    vector<int> prev_u(N * N, -1);
    Q.emplace(0, Si * N + Sj);
    dist[Si * N + Sj] = 0;
    while (!Q.empty()) {
      auto [d, u] = Q.top(); Q.pop();
      if (-d > dist[u]) continue;
      if (color[u] == 1) continue;
      color[u] = 1;
      if (u == Ti * N + Tj) break;
      vector<pair<int, char>> next_vs;
      if (u % N > 0) next_vs.emplace_back(u - 1, 'L');
      if (u % N < N - 1) next_vs.emplace_back(u + 1, 'R');
      if (u / N > 0) next_vs.emplace_back(u - N, 'U');
      if (u / N < N - 1) next_vs.emplace_back(u + N, 'D');
      for (auto [next_v, dir_char] : next_vs) {
        int cur_edge = min(u, next_v) * N * N + max(u, next_v);
        int edge_cost = est_D[cur_edge] / (checked_num[cur_edge] + 0.001);
        if (color[next_v] == 0 && dist[next_v] > -d + edge_cost) {
          dist[next_v] = -d + edge_cost;
          prev_dir[next_v] = dir_char;
          prev_u[next_v] = u;
          Q.emplace(-dist[next_v], next_v);
        }
      }
    }
    vector<int> edges;
    int U = Ti * N + Tj;
    while (U != Si * N + Sj) {
      output.emplace_back(prev_dir[U]);
      edges.emplace_back(min(U, prev_u[U]) * N * N + max(U, prev_u[U]));
      U = prev_u[U];
    }
    reverse(output.begin(), output.end());

    // output start

    cout << string(output.begin(), output.end()) << endl;

    // output end

    int e;
    cin >> e;
    double new_est_D = (double) e / edges.size();
    for (int edge : edges) {
      if (edge / (N * N) + 1 == edge % (N * N)) {
        int i = edge / N % N;
        rep(j, N - 1) {
          double factor = 1 / (abs(edge % N - (j + 1)) / 10 + 1);
          int edge2 = (i * N + j) * N * N + (i * N + j + 1);
          est_D[edge2] += factor * new_est_D;
          checked_num[edge2] += factor;
        }
      } else {
        int j = edge % N;
        rep(i, N - 1) {
          double factor = 1 / (abs(edge / N % N - (i + 1)) / 10 + 1);
          int edge2 = (i * N + j) * N * N + (i * N + j + N);
          est_D[edge2] += factor * new_est_D;
          checked_num[edge2] += factor;
        }
      }
    }
    epsilon = epsilon * 0.996;
  }
}

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#ifdef NDEBUG
  #define assert(e) if(!(e)){stod("");}
#endif
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int a, b, c;
  scan(a, b, c);
  if ((0 <= a and 0 <= b) or c % 2 == 0) {
    a = max(a, -a);
    b = max(b, -b);
    if (a < b) {
      print("<");
    } else if (a > b) {
      print(">");
    } else {
      print("=");
    }
  } else if (a < 0 and 0 <= b) {
    print("<");
  } else if (b < 0 and 0 <= a) {
    print(">");
  } else {
    if (-a < -b) {
      print("<");
    } else if (-a > -b) {
      print(">");
    } else {
      print("=");
    }
  }
}

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


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

int main(){
    long n, m, mod = 998244353, ans = 0, mans, a, k, h = 200001;
    cin >> n >> m;
    long dp[19][h];
    bool s[h] = {};
    vector<long> v;
    for(int i = 2; i < h; i++){
        if(s[i] == 0){
            v.push_back(i);
            for(int j = 2 * i; j < h; j += i) s[j] = 1;
        }
    }
    for(int i = 0; i < 19; i++) dp[i][0] = 0;
    for(int i = 1; i < h; i++){
        dp[0][i] = 1;
        for(int j = 1; j < 19; j++) dp[j][i] = (dp[j - 1][i] + dp[j][i - 1]) % mod;
    }
    for(int i = 1; i <= m; i++){
        mans = 1;
        a = i;
        for(int j = 0; j < v.size(); j++){
            if(sqrt(a) < v[j]){
                if(a > 1) mans = mans * dp[1][n] % mod;
                break;
            }
            k = 0;
            while(a % v[j] == 0){
                k++;
                a /= v[j];
            }
            mans = mans * dp[k][n] % mod;
        }
        ans = (ans + mans) % mod;
    }
    cout << ans << endl;
}

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

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

void scan()
{
  return;
}

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

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

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

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

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

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

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

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

int main()
{
  i64 constexpr mod=1000000007;
  i64 H,W;
  scan(H,W);
  vector<string> S(H);
  scan_array(S.begin(),S.end());
  i64 K=0;
  for(i64 i=0;i<H;++i)
  {
    for(i64 j=0;j<W;++j)
    {
      if(S[i][j]=='.')
      {
        K+=1;
      }
    }
  }
  i64 d[H][W],u[H][W],r[H][W],l[H][W];
  for(int j=0;j<W;++j)
  {
    int now=0;
    for(int i=0;i<H;++i)
    {
      now=(S[i][j]=='#')?0:now+1;
      d[i][j]=now;
    }
    now=0;
    for(int i=H-1;i>=0;--i)
    {
      now=(S[i][j]=='#')?0:now+1;
      u[i][j]=now;
    }
  }
  for(int i=0;i<H;++i)
  {
    int now=0;
    for(int j=0;j<W;++j)
    {
      now=(S[i][j]=='#')?0:now+1;
      r[i][j]=now;
    }
    now=0;
    for(int j=W-1;j>=0;--j)
    {
      now=(S[i][j]=='#')?0:now+1;
      l[i][j]=now;
    }
  }
  i64 sum=0;
  for(int i=0;i<H;++i)
  {
    for(int j=0;j<W;++j)
    {
      if(S[i][j]=='.')
      {
        sum+=pow_mod(2,K-(l[i][j]+r[i][j]+u[i][j]+d[i][j]-3),mod);
      }
    }
  }
  sum%=mod;
  i64 ans=pow_mod(2,K,mod)*K%mod-sum;
  ans=(ans%mod+mod)%mod;
  println(ans);
}


//*****************************************************************************
//*     __      ________        __________         __________      __      __ *
//*    |  |    |        |      ||_________|       ||________|      ||      || *
//*    |  |    |        |      ||                 ||               ||      || *
//*    |  |    |________|      ||                 ||               ||      || *
//*    |  |    |________|      ||     ______      ||      ______   ||      || *
//* ___|  |    |        |      ||____| | | |      ||_____| | | |   ||______|| *
//*|______|    |        |      ||______| |_|      ||_______| |_|   ||______|| *
//*                                                                           *
//******************************************************************************
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define prnt(a) for(auto _:a) {cout<<_<<' ';}cout<<endl;
#define prnt_map(a) for(auto x : a) {cout<<x.first<<' '<<x.second; cout<<endl;}
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower)
#define upper(a) transform(a.begin(),a.end(),a.begin(),::toupper)
#define pll pair<ll,ll>
#define int long long
#define umap unordered_map
#define vi vector< long long >
#define vec_read(x) for(auto &i:x) cin>>i;
#define str string
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define min_(a) *min_element(a.begin(),a.end())
#define max_(a) *max_element(a.begin(),a.end())
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define deb(x) cout << #x << ' ' << x << endl;
#define se second
#define fi first
#define si size
#define MOD ll(1e9+7)
template<typename... T>
void read(T&... args) {
    ((cin>>args), ...);
}
template<typename... T>
void print(T... args) { //rvalue reference is new to C++
    ((cout<<args<<' '), ...);
    cout<<endl;
}
int msb(int N) {
    return N ? 32 - __builtin_clz(N) : -MOD;
}
//....................................
void solve(){
	//WRITE YOUR CODE HERE.....
	ld r,x,y; read(r,x,y);
	ld dis = (ld)sqrt(pow(x,2)+pow(y,2));
	if (dis<r) print(2);
	else print(ceil(dis/r));
}
void test_case(){
    int testCase;
    cin>>testCase;
    while(testCase--) solve();
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // test_case();
      solve();
    return 0;
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define sz(v) ((int)v.size())
#define all(v) (v).begin(), (v).end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
template<int mod>
struct modint{
	int v;
	modint(ll vv=0){s(vv%mod+mod);}
	modint& s(int vv){
		v=vv<mod?vv:vv-mod;
		return *this;
	}
	modint operator-()const{return modint()-*this;}
	modint& operator+=(const modint&rhs){return s(v+rhs.v);}
	modint&operator-=(const modint&rhs){return s(v+mod-rhs.v);}
	modint&operator*=(const modint&rhs){
		v=ll(v)*rhs.v%mod;
		return *this;
	}
	modint&operator/=(const modint&rhs){return *this*=rhs.inv();}
	modint operator+(const modint&rhs)const{return modint(*this)+=rhs;}
	modint operator-(const modint&rhs)const{return modint(*this)-=rhs;}
	modint operator*(const modint&rhs)const{return modint(*this)*=rhs;}
	modint operator/(const modint&rhs)const{return modint(*this)/=rhs;}
	modint pow(int n)const{
		modint res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}
	modint inv()const{return pow(mod-2);}
	/*modint inv()const{
		int x,y;
		int g=egcd(v,mod,x,y);
		assert(g==1);
		if(x<0)x+=mod;
		return modint(x);
	}*/
	friend modint operator+(int x,const modint&y){return modint(x)+y;}
	friend modint operator-(int x,const modint&y){return modint(x)-y;}
	friend modint operator*(int x,const modint&y){return modint(x)*y;}
	friend modint operator/(int x,const modint&y){return modint(x)/y;}
	friend ostream& operator<<(ostream&os,const modint&m){return os<<m.v;}
	friend istream& operator>>(istream&is,modint&m){
		ll x;is>>x;
		m=modint(x);
		return is;
	}
	bool operator<(const modint&r)const{return v<r.v;}
	bool operator==(const modint&r)const{return v==r.v;}
	bool operator!=(const modint&r)const{return v!=r.v;}
	explicit operator bool()const{return v;}
};
using mint=modint<998244353>;
int n,a[200010];
mint pw[200010];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	int i,j;
	pw[0]=1;
	for(i=1;i<=n;i++)pw[i]=pw[i-1]*2;
	for(i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	mint ans,sum;
	for(i=1;i<=n;i++) {
		// a[i]*a[j]*2^(i-j-1)=a[i]*2^i * a[j]*2^(-j-1)
		ans+=a[i]*pw[i]*sum+mint(a[i])*mint(a[i]);
		sum+=a[i]*pw[i+1].inv();
	}
	cout<<ans.v;
	return 0;
}


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

ll cnt(ll y,ll x,map<ll,ll> &data){
  if(data.count(y)){
    return data[y];
  }
  if(x>=y){
    data[y] = x-y;
    return (ll) x-y;
  }
  if(y%2==0){
    ll z = min(cnt(y/2,x,data)+1,abs(y-x));
    data[y] = z; return z;
  }
  else{
    ll z = min(min(cnt(y+1,x,data)+1,abs(y-x)),cnt(y-1,x,data)+1);
    data[y] = z; return z;
  }
}

int main(){
  long long X,Y;
  cin >> X >> Y;
  map<ll,ll> data;
  cout << cnt(Y,X,data) << endl;
}

/*
Nguyen Duc Anh Phuc_Jacke
*/

#include <limits.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <unordered_set>
#include <set>
#include <fstream>
#include "bits/stdc++.h"
using namespace std;

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

#define fi first
#define se second.first
#define th second.second

map<ll, ll> mp;

ll sol(ll x, ll y)
{
	if (mp[x])
		return mp[x];

	if (x == y)
	{
		mp[x] = 0;
		return 0;
	}
	if (x / 2 == y && x % 2 == 0 )
	{
		mp[x] = 1;
		return 1;
	}
	if (x / 2 < y)
	{
		if (x % 2 == 0)
			return mp[x]=min(x - y, y - x / 2 + 1);
		else
			return mp[x]=min(x - y, min(y - x / 2 + 2, (y - (x / 2 + 1) + 2)));
	}

	ll le = LLONG_MAX;
	ll ri = LLONG_MAX;
	if (x % 2 == 0)
	{
		le = sol(x / 2, y) + 1;
	}
	else
	{
		le = sol(x / 2, y) + 2;
		ri = sol(x / 2 + 1, y) + 2;
	}
	return mp[x]=min(le, ri);
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll x, y;
	cin >> x >> y;
	if (x >= y)
	{
		cout << x - y;
		return 0;
	}
	cout << sol(y, x);
	return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;

int main() {
    int t, n;
    scanf("%d %d", &t, &n);

    ll l = 0, r = 1e14, ans;
    while (l <= r) {
        ll mid = (l+r)/2, nex = (100*mid + t*mid) / 100;

        if (nex-mid < n)
            ans = nex+1, l = mid+1;
        else
            r = mid-1;
    }

    printf("%lld\n", ans);
    return 0;
}

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

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

#define all(x) x.begin(), x.end()

using namespace std;
//using namespace atcoder;

using ll = long long;
using P = pair<ll, ll>;

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> xy(m);
  rep(i, m) {
    ll x, y;
    cin >> x >> y;
    xy.at(i) = make_pair(x, y);
  }
  sort(xy.begin(), xy.end());
  vector<set<ll>> xxyy;
  ll curX = -1;
  int curI = -1;
  rep(i, m) {
    ll x = xy.at(i).first;
    ll y = xy.at(i).second;
    if (curX == x) {
      xxyy.at(curI).insert(y);
    } else {
      curI++;
      xxyy.emplace_back();
      xxyy.at(curI).insert(y);
      curX = x;
    }
  }
  set<ll> res;
  res.insert(n);
  vector<ll> dj = {1, -1};
  for (auto &s : xxyy) {
//    cerr << "s: " << endl;
//    for (auto v : s) {
//      cerr << v << ", ";
//    }
//    cerr << endl;

    vector<ll> insertV;
    vector<ll> eraseV;
    for (auto &ss : s) {
      if (res.count(ss) != 0) {
        eraseV.push_back(ss);
      }
      rep(j, dj.size()) {
        ll nj = ss + dj[j];
        if (nj >= 0 && nj <= n * 2) {
          if (res.count(nj) != 0) {
            insertV.push_back(ss);
          }
        }
      }
    }
    for (auto &x : eraseV) {
      res.erase(x);
    }
    for (auto &x : insertV) {
      res.insert(x);
    }
//    cerr << "res: " << endl;
//    for (auto v : res) {
//      cerr << v << ", ";
//    }
//    cerr << endl;
  }
  cout << res.size() << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

int main(void){
  int n,k,m; cin >> n >> k >> m;
  int a[n-1];
  int sum = 0;
  FOR(i,0,n-2) {
    cin >> a[i];
    sum += a[i];
  }

  if(n*m-sum<=k) cout << max(0,n*m-sum) << endl;
  else cout << -1 << endl;

}

#include<bits/stdc++.h>
#include<chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;
#define ll long long int
#define ull unsigned long long int
#define FOR(I,a,b) for(ll I=a;I<b;I++)
#define FORit(it,a) for(auto it=a.begin();it!=a.end();it++)
#define ROF(I,a,b) for(int I=a;I>=b;I--)
#define vec vector
#define vi vec<int>
#define vll vec<ll>
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define testcases ll tc;cin>>tc;while(tc--)
#define mem(a,k) memset(a,k,sizeof(a))
#define FF first
#define SS second
#define MP(x,y) make_pair(x,y)
#define rt return
#define br break
#define ct continue
#define elif else if
#define ii pair<ll,ll>
#define vecin(a,n,index) for(int I=index;I<n;I++)cin>>a[I]
#define vecout(a,n,index) for(int I=index;I<n;I++)cout<<a[I]<<" ";cout<<endl;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// ll mod = 1000000007;
// int max_size = 1000001;
// vi sv(max_size, 1);
// vi primes;
// void sieve();
// ll power(ll a, ll b);
// ll powerMod(ll a, ll b, ll mod);
// ll modIn(ll n);
// vll fact(200001);
ll val(char c) {
	if (c >= '0' && c <= '9')
		rt (ll)c - '0';
	else
		rt (ll)c - 'A' + 10;
}
ll toDecimal(string s, ll base) {
	ll l = s.length();
	ll power = 1;
	ll res = 0;
	ROF(i, l - 1, 0) {
		if (val(s[i]) >= base) {
			rt - 1;
		}
		// cout << power << endl;
		if (res > 1e18 - (val(s[i])*power))rt - 1;
		res += val(s[i]) * power;
		if (power > (1e18 + base - 1) / base && i >= 1)rt - 1;
		power = power * base;
	}
	rt res;
}
bool fun(string x, ll n, ll m) {
	if (toDecimal(x, n) != -1  && toDecimal(x, n) <= m )rt true;
	rt false;
}
void solve() {
	string x;
	ll m;
	cin >> x >> m;
	string k = x;
	sort(all(k));
	int d = k[k.size() - 1] - 48;
	if (x.length() == 1) {
		if (x[0] - 48 <= m)cout << "1\n";
		else cout << "0\n";
		rt;
	}
	ll L = d + 1, H = 1e18, res = 0;

	while (L <= H) {
		ll mid = (L + H) / 2;
		// cout << res << endl;
		if (fun(x, mid, m)) {
			res = mid;
			L = mid + 1;
		}
		else H = mid - 1;
	}
	cout << max(0LL, res - d) << endl;

}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// testcases
	solve();
}

/*void sieve() {
	sv[0] = 0; sv[1] = 0;
	for (int i = 2; i * i <= max_size; i++) {
		if (sv[i]) {
			for (int j = i * i ; j <= max_size; j += i) {
				sv[j] = 0;
			}
		}
	}
}*/

/*ll power(ll a , ll b) {
	ll res = 1;
	while (b) {
		if (b % 2) {res *= a; b--;}
		else {a *= a; b /= 2;}
	}
	rt res;
}*/
/*
ll powerMod(ll a, ll b, ll mod) {
	ll res = 1;
	while (b != 0) {
		if (b % 2) {
			res = (res % mod * a % mod) % mod;
			b--;
		}
		else {
			a = (a % mod * a % mod) % mod;
			b /= 2;
		}
	}
	rt res % mod;
}*/
/*
ll modIn(ll n) {rt powerMod(n, mod - 2) % mod;}
*/


#include <bits/stdc++.h>

using namespace std;

int main()
{
    char arr[3];
    for (int i=0; i<3; i++) {
        cin >> arr[i];
    }
    char temp = arr[0];
    for (int i=0; i<2; i++) {
        arr[i] = arr[i+1];
    }
    arr[2] = temp;
    for (int i=0; i<3; i++) {
        cout << arr[i];
    }

    return 0;
}

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

#define ll long long
#define endl '\n'
const int  MOD=1e9+7;

void test_case(){
    int n;cin>>n;
    vector<ll> arr(n),brr(n),ans(n);
    for(ll &x:arr)cin>>x;
    for(ll &x:brr)cin>>x;
    ll amax=-1;
    ll mx=-1;
    for(int i=0;i<n;i++){
        amax=max(amax,arr[i]);
        mx=max(amax*brr[i],mx);
        ans[i]=mx;
    }
    for(ll x:ans)
        cout<<x<<'\n';
    // cout<<'\n';

}

int main(int argc, char** argv){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    int t;
    t=1;
    // cin>>t;
    while(t--){
        test_case();
    }
}