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

const int INF = 10000000;

int main(int argc, char const *argv[])
{
    int n, m, a, b, ans1 = INF, ans2 = INF;
    cin >> n >> m >> a >> b;

    int row1 = a / m + 1;
    int row2 = b / m + 1;
    int col1 = a % m == 0 ? m : a % m;
    int col2 = b % m == 0 ? m : b % m;

    if(row1 == row2)
        ans1 = 1;
    else if(row2 - row1 == 1) {
        ans1 = 2;
        if(col1 == 1 && b == n)
            ans1 = 1;
        else if(col1 == 1 && col2 == m)
            ans1 = 1;
    } else {
        ans1 = 3;
        if(b == n || col2 == m) // 如果是最后一个就可以拉多余范围
            --ans1;
        if(col1 == 1)
            --ans1;
    }

    ans2 = 3;
    if(col1 - 1 == col2)
        --ans2;

    cout << min(ans1, ans2) << endl;

    return 0;
};


#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define IT(c)           __typeof((c).begin())
#define FORIT(i, c)     for(IT(c) i = (c).begin(); i != (c).end(); ++i)
#define FOR(i, a, b)    for(int i = a; i < int(b); ++i)
#define FORE(i, a, b)   for(int i = a; i <= int(b); ++i)
#define FORD(i, a, b)   for(int i = b - 1; i >= int(a); --i)
#define FORDE(i, a, b)  for(int i = b; i >= int(a); --i)
#define REP(i, n)       FOR(i, 0, n)
#define REPE(i, n)      FORE(i, 0, n)
#define REPD(i, n)      FORD(i, 0, n)
#define REPDE(i, n)     FORDE(i, 0, n)
#define SZ(c)           (int((c).size()))

/*
    Approach:

    We are asked if we can turn a 2D vector A into a vector B using a
    vector C by using some combination of operations:

        1. rotate A by 90 degrees
        2. add C to A

    An equivalent way to view this problem, is to start with one of the four
    rotations of A, and then repeatedly trying to add on of the four rotations
    of C.  This simplifies matters because we can simply try to guess a rotation
    of A, subtract it from B, and then see if we can construct the resulting
    vector using C only.

    In other words, we want to see if (B - rot^i(A)) = x*C + y*rot(C) = D
    for i in (0,1,2,3) and x and y any integer.

    We can compute D, but we need to find x and y to see if they are integral.
    Since C and rot(C) are orthogonal, we can decompose D into components
    parellel to C and rot(C) using projection.

    For C and D, we have:

      C_x*D_x + C_y*D_y = |C| * |D| * cos(angle between C and D)  (dot product)

    |D|*cos(angle between C and D) is the length of D projected onto C.  We
    want to check if this length is divisible by |C|.  In other words, we want
    to check if the dot product is divisible by |C|^2, or:

      C_x*D_x + C_y*D_y = 0 (mod C_x*C_x + C_y*D_y)

    (The case for rot(C) and D is analogous.)

    An important special case is that where C is the zero-vector (in that case,
    we can't project anything, but we must still check if B is zero too).
*/

typedef long long LL;

typedef pair<int,int> PII;

PII read_vector() { PII v; cin >> v.first >> v.second; return v; }
PII rot(PII v) { return PII(-v.second, v.first); }
PII operator-(PII a, PII b) { return PII(a.first - b.first, a.second - b.second); }
LL lensq(PII c) { return (LL)c.first*c.first + (LL)c.second*c.second; }

// Can we project D onto C such that the component of D parallel to C
// can be expressed as an integer product of C?
bool can_project(PII D, PII C)
{
    LL dot = (LL)B.first*C.first + (LL)B.second*C.second;
    return dot % lensq(C) == 0;
}

// Can D be expressed using integer coordinates in a coordinate system with
// axes C and rot(C)?
bool can_express(PII D, PII C)
{
    if (C == PII(0, 0)) return D == PII(0, 0);  // special case: C == (0,0)
    return can_project(B, C) && can_project(B, rot(C));
}

bool can(PII A, PII B, PII C)
{
    // Try the four rotations of A:
    REP(_, 4) {
        if (can_express(B - A, C)) return true;
        A = rot(A);
    }
    return false;
}

int main()
{
    PII A = read_vector();
    PII B = read_vector();
    PII C = read_vector();
    cout << (can(A, B, C) ? "YES" : "NO") << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Max[100005]{};
ll Min[100005];
ll arr[100005];
int main(){
   	int n;
   	scanf("%d",&n);
   	for(int i=0;i<n;i++){
   	 	scanf("%lld",&arr[i]);
   	}
   	for(int i=0;i<n;i++){
   		bool f=true;
   	 	for(int j=0;j<n;j++){
   	 	 	if (i!=j){
   	 	 	 	ll t=abs(arr[i]-arr[j]);
   	 	 	 	if (t>Max[i])Max[i]=t;
   	 	 	 	if (f){Min[i]=t;f=false;}
   	 	 	 	if (t<Min[i])Min[i]=t;
   	 	 	}
   	 	}
   	 	printf("%lld %lld\n",Min[i],Max[i]);
   	}
}


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

void solve()
{
    long long n,k;
    cin>>n>>k;
    if(n>=k) cout<<(k-1)/2<<endl;
     else if (n*2>k) cout<<n-k/2<<endl;
     else cout<<0<<endl;
    return 0;
}

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

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

	int t=1;
	//cin>>t;

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


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    string s;
    int x,y,k;
    cin>>s;
    scanf("%d",&x);
    x=x%12;
    if(s=="January") y=1;
    if(s=="February") y=2;
    if(s=="March") y=3;
    if(s=="April") y=4;
    if(s=="May") y=5;
    if(s=="June") y=6;
    if(s=="July") y=7;
    if(s=="August") y=8;
    if(s=="September") y=9;
    if(s=="October") y=10;
    if(s=="November") y=11;
    if(s=="December") y=12;
    k=x+y;
    k=x%12;
    if(k==1)cout<<"January";
    if(k==2)cout<<"February";
    if(k==3)cout<<"March";
    if(k==4)cout<<"April";
    if(k==5)cout<<"May";
    if(k==6)cout<<"June";
    if(k==7)cout<<"July";
    if(k==8)cout<<"August";
    if(k==9)cout<<"September";
    if(k==10)cout<<"October";
    if(k==11)cout<<"November";
    if(k==0)cout<<"December";
    return 0;
}


#include <iostream>
using namespace std;
#include <cmath>
#define ll unsigned long long int
int main() {
	ll a;
	cin>>a;
	ll b=0;
	if(a==1) cout<<a;
	if(a==2) cout<<5;
	else {
		ll c=0;ll j=0;
		for(ll j=1;j<2*(a-2)+1;j+=2) c=c+j;
		cout<<(2*(a-2)+1)*(2*(a-2)+1)+c*4;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    if(n==1)
        cout<<"1"<<endl;
    else if(n==2)
        cout<<"2"<<endl;
    else if(n&1)
        cout<<n*(n-1)*(n-2)<<endl;
    else
        cout<<(n-2)*(n-1)*(n-3)<<endl;
}
//2020-02-21 10:10:23.507


#include <bits/stdc++.h>

using namespace std;

#define lp(i,n) for(int i=0; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define ff first
#define ss second
#define nl "\n"

#define EPS 1e-6
#define OO 10000000000

#define on(i,n) i=i|(1<<n)
#define off(i,n) i=i& (~(1<<n))

typedef  complex<double> point;
#define X real()
#define Y imag()

#define vec(a,b) (b-a)
#define angle(a) (atan2(a.X,a.Y))

#define length(a) (hypot(a.real(),a.imag()))
#define normalize(a) a/length(a)

#define dotp(a,b) (conj(a)*b).real()
#define crossp(a,b) (conj(a)*b).imag()

#define lengthSqr(a) dp(a,a)

#define rotateO(p,ang) (p*exp(point(0,ang)))
#define rotateA(p,ang,about)  (rotateO(vec(about,p),ang)+about)
#define reflectO(v,m)  (conj((v)/(m))*(m))

const double PI= acos(-1.0);
double fixAngle(double A){return A > 1 ? 1 : (A < -1 ? -1 : A);}
double dcmp(double a,double b){return fabs(a-b)<EPS?0 : a>b? 1:-1; }

vector <ll> divisors[5*1000000+15];
void seive(){

    for(ll i=1; i<5*1000000+10; i++){

        for(ll j=i+i; j<5*1000000+10; j+=i){
            (divisors[j].pb(i));

        }

    }

}
ll mod=1000000000+7;

ll dp[1000000*5+5];
ll dp2[1000000*5+5];
ll solve(ll x){

    if(x==1) return 0;
    if(~dp[x]) return dp[x];
ll ans=(x*(x-1))/2;

    for(int i:divisors[x]){
            if(i==1 || i== x) continue;

            if(x%i==0){
                    int t=x/i;

                ans=min(ans,i*(t)*(t-1)/2+ solve(t));
            }

    }

    return dp[x]=ans;

}

ll mypow(int t, int power){

    if(power==1){
        return t%mod;

    }
    if(power==0){

        return 1;
    }
    if(~dp2[power]) return dp2[power];
    if(power%2==0){

        return dp2[power]=(mypow(t,power/2)*mypow(t,power/2))%mod;
    }
    return dp2[power]=(t*mypow(t,power-1))%mod;

}
int main(){

seive();
    memset(dp,-1,sizeof dp);

    memset(dp2,-1,sizeof dp2);
    ll n,t;
   cin>>t;

    ll l,r;
    cin>>l>>r;

    ll ans=0;
    ll cnt=0;
    lp(i,l)solve (i);
    for(int i=l; i<=r; i++){

       // cout<<solve(i)<<endl;

        ans+=(mypow(t,cnt)* (solve(i)%mod))%mod;
       ans%=mod;
       cnt++;

    }

    ans%=mod;
    cout<<ans<<endl;

}


//why always me??????

#include<bits/stdc++.h>

using namespace std;

#define mp make_pair
#define r second
#define l first
#define pb push_back
#define pp pop_back
#define khoob ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin() , x.end()

long long int km,bm,a,b,dash,mash;
vector < long long int >va,vb;
vector < pair < long long int , long long int > >kol;
int bmm(long long int x,long long int y){
    if(x>y)
        swap(x,y);
    while(x!=0){
        int a=y%x;
        y=x;
        x=a;
    }
    return y;
}

void make_kol(){
    for(int i=a;i<=km;i+=a)
        va.pb(i);
    for(int i=b;i<=km;i+=b)
        vb.pb(i);
    while(va.size() and vb.size()){
        long long int sa=va[va.size()-1];long long int sb=vb[vb.size()-1];
        if(sa>sb){
            kol.pb(mp(sa,1));
            va.pp();
        }
        else if(sb>sa){
            kol.pb(mp(sb,2));
            vb.pp();
        }
        else if(sa==sb){
            kol.pb(mp(sa,3));
            va.pp();
            vb.pp();
        }
    }
    while(va.size()){
        kol.pb(mp(va[va.size()-1],1));
        va.pp();
    }
    while(vb.size()){
        kol.pb(mp(vb[vb.size()-1],2));
        vb.pp();
    }
}
int main(){
    khoob
    cin>>a>>b;
    bm=bmm(a,b);
    km=(a*b)/bm;
    make_kol();
    long long int gh=0;
    while(kol.size()){
        pair < long long int , long long int >p=kol[kol.size()-1];
        if(p.r==1)
            dash+=p.l-gh,gh=p.l;
        if(p.r==2)
            mash+=p.l-gh,gh=p.l;
        if(p.r==3){
            if(a>b)
                dash+=p.l-gh,gh=p.l;
            else
                mash+=p.l-gh,gh=p.l;
        }
        kol.pp();
    }
    if(dash > mash)
        cout<<"Dasha";
    else if(mash > dash)
        cout<<"Masha";
    else
        cout<<"Equal";

}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    bool flag=false;
    char a[300];
    char b[300];
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++ ) cin>>b[i];
    sort(a,a+n);
    sort(b,b+n);
    for(int i=0;i<n;i++)
    {
        if(a[i]=<b[i])
            break;
        else if(i==n-1&&a[i]>b[i])
        {
            flag=true;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]>=b[i])
            break;
        else if(i==n-1&&b[i]>a[i])
        {
            flag=true;
        }
    }
if(flag) cout<<"YES";
else cout<<"NO";
}


/*
  no pain, no gain
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define pii pair<int, int>
#define all(s) s.begin(), s.end()
#define prev myrza4321
#define y1 myrza1234
#define OK puts("OK")
#define int long long
using namespace std;

const int N = (int)1e5 + 5;
const int INF = 0x3f3f3f3f;

string st, add, omg;

string dp[N];

string get(int pos) {
  dp[0] = st;
  for (int i = 1; i <= pos; i++) {
    dp[i] = "What are you doing while sending (" + dp[i - 1] + ")? Are you busy? Will you send (" + dp[i - 1] + ")?";
    dp[i - 1].clear();
  }
}

void solve() {
  int n, pos;
  cin >> n >> pos;
  get(n);
  if (dp[n].size() < pos) {
    omg += '.';
  } else {
    char ans = dp[n][pos - 1];
    if (ans == '(' || ans == ')') {
      ans = '"';
    }
    omg += ans;
  }
  dp[n].clear();
}

main() {
  st = "What are you doing at the end of the world? Are you busy? Will you save us?";
  add = "What are you doing while sending ()? Are you busy? Will you send ()?";
  omg = "";

  int Q;
  cin >> Q;
  while (Q--) {
    solve();
  }
  cout << omg;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn=2e5+5;
const ll mod=998244353;
ll n,m,fac[maxn],inv[maxn],s;

ll pow_mod(ll a,ll b)
{
    ll ret =1;
    while(b)
    {
        if(b&1) ret=ret*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
ll Cc(ll x, ll y)
{
    return fac[x]*pow_mod(fac[y]*fac[x-y]%mod,mod-2)%mod;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
	if(n==2) cout<<"0"<<endl;
	else{
		init();
		s=Cc(m,n-1)*(n-2)%mod;
		s=s*pow_mod(2,n-3)%mod
		cout<<s<<endl;
	}

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n , x1 , y11 , x2 , y2 , arr[1005][1005] , m = 1000000;

int bfs()
{
 queue<pair<int,int> >q;
  q.push(make_pair(x1,y11));
  arr[x1][y11]=0;
  while(!q.empty())
  {
    pair<int,int>p=q.front();
    q.pop();
    if((p.first==0&&x2==0)||(p.first==n&&x2==n))
    {
      m= min(m, arr[p.first][p.second]+abs(p.second-y2));
    }else if((p.second==0&&y2==0)||(p.second==n&&y2==n))
    {
      m= min(m, arr[p.first][p.second]+abs(p.first-x2));
    }else
    {
      if (p.first==n||p.first==0) {
      	if (!arr[p.first][0])
        {
          arr[p.first][0]=arr[p.first][p.second]+p.second;
      		q.push (make_pair(p.first,0));
        }
        if (!arr[p.first][n])
        {
          arr[p.first][n]=arr[p.first][p.second]+n-p.second;
          q.push (make_pair(p.first,n));
        }
      }

      if (p.second==n||p.second==0) {
      	if (!arr[0][p.second])
        {
          arr[0][p.second]=arr[p.first][p.second]+p.first;
      		q.push (make_pair(0,p.second));
        }
        if (!arr[n][p.second])
        {
          arr[n][p.second]=arr[p.first][p.second]+n-p.first;
          q.push (make_pair(n,p.second));
        }
      }

    }

  }

}
 int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0);
   cin>>n>>x1>>y11>>x2>>y2;
   if((x1==0&&x2==0)||(x1==n&&x2==n))
   {
     cout<<abs(y11-y2);
   }else if ((y11==0&&y2==0)||(y11==n&&y2==n))
      cout<<abs(x1-x2);
 else{
   bfs();
     cout <<m ;

 }
return 0 ;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define MAXR 1000005
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define allr(c) (c).rbegin(),(c).rend()
#define ios ios_base::sync_with_stdio(false)
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
void solve()
{
ll a,b,c;
cin>>a>>b>>c;
ll x,y,z,ex=0;
cin>>x>>y>>z;
if(a>x)
    ex+=(a-x);
if(b>y)
    ex+=(b-y);
if(c>z)
    ex+=(c-z);
ll re=0;
if(x>a)
    re+=(x-a);
if(y>b)
    re+=(y-b);
if(z>c)
    re+=(z-c);
if(ex/2>=re)
    cout<<"Yes";
else
    cout<<"No";
}
int main()
{
     ios;
     ll t;t=1;
     while(t--)
     {
      solve();
     }
}


#include <iostream>

using namespace std;
int a[1000005];
int main()
{int n,i,k;
 cin>>n;
 i=1;
 k=1;
 while(i<=n)
 {
     a[i]=k;
     a[i+1]=k;
     a[i+2]=k+1;
     i=i+3;
     k=k+2;
 }

 cout<<a[n];
}


#include <cstdio>
#include <algorithm>
#define N 1510
using namespace std;
typedef long long LL;

struct Node {
    LL to, nxt;
}e[N << 1];

struct Point {
    LL x, y, id;
}p[N], pp[N], poi;

LL cnt, n, lst[N], ans[N], size[N];

bool cmp(Point a, Point b) {//按极角排序
    LL ax = a.x - poi.x, ay = a.y - poi.y, bx = b.x - poi.x, by = b.y - poi.y;
    if (ax >= 0 && bx <= 0) return 1;
    if (ax <= 0 && bx >= 0) return 0;
    return (ax * by > bx * ay);
}

inline void add(LL u, LL v) {
    e[++cnt].to = v;
    e[cnt].nxt = lst[u];
    lst[u] = cnt;
}

void predfs(LL x, LL fa) {//预处理出子树大小
    size[x] = 1;
    for (int i = lst[x]; i; i = e[i].nxt) {
        if (e[i].to == fa) continue;
        predfs(e[i].to, x);
        size[x] += size[e[i].to];
    }
}

void dfs(LL l, LL r, LL x, LL fa)//对区间进行分治
    LL mini = l;
    for (int i = l + 1; i <= r; ++i)
        if (p[i].y < p[mini].y || p[i].y == p[mini].y && p[i].x < p[mini].x) mini = i;
    swap(p[l], p[mini]);
    ans[p[l].id] = x;
    poi = p[l];
    sort(p + l + 1, p + r + 1, cmp);
    LL now = l + 1;
    for (LL i = lst[x]; i; i = e[i].nxt) {
        if (e[i].to == fa) continue;
        dfs(now, now + size[e[i].to] - 1, e[i].to, x);
        now += size[e[i].to];
    }
}

int main() {
    scanf("%lld", &n);
    for (LL i = 1; i < n; ++i) {
        LL a, b;
        scanf("%lld%lld", &a, &b);
        add(a, b);
        add(b, a);
    }
    for (LL i = 1; i <= n; ++i) {
        scanf("%lld%lld", &p[i].x, &p[i].y);
        p[i].id = i;
    }
    predfs(1, 1);
    dfs(1, n, 1, 1);
    for (LL i = 1; i < n; ++i) {
        printf("%lld ", ans[i]);
    }
    printf("%lld\n", ans[n]);
    return 0;
}//


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
typedef pair<ll, ll> lll;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);
const int M = 50;
const int N = 1e6 + 7;

ll pw(ll x, ll k){
    if (!k) return 1;
    if (k & 1) return x * pw(x, k - 1) % mod;
    ll t = pw(x, k / 2);
    return t * t % mod;
}

ll get(ll x, ll k, ll n){
    if (!k) return 1 % n;
    if (k & 1) return x * get(x, k - 1, n) % n;
    ll t = get(x, k >> 1, n);
    return t * t % n;
}

int n, k;
int a[N];
int check[N];

void solve() {
    cin >> n >> k;
    if (k == 0){
        cout << pw(k, k - 1);
        return;
    }
    if (k == 1){
        cout << pw(k, k);
        return;
    }
    for(int d = 0; d < n; d++){
        a[d] = (ll) d * k % n;
    }
    ll ans = 1;
    for(int d = 0; d < n; d++)
        if (!check[d]){
            check[d] = 1;
            d = a[d];
            int cnt = 1;
            while (!check[d]){
                d = a[d];
                cnt++;
            }
            if (get(k, cnt, n) == 1){
                ans = (ans * n) % mod;
            }
        }
    cout << ans;

}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif

    solve();
#ifdef _LOCAL_
    //printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
    return 0;
}


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

int main(){
    int a,b,contador=0;
    cin>>a>>b;
    for (int i = 1;i<=(a/2);i++){
        for(int h=1;h<=(a/2);h++){
            if ((i*h) == b){
                contador += 1;
                break;
            }
        }
    }
    cout<<contador;
    return 0;
}


#include<iostream>
using namespace std;
int main()
{
    int m, n;
    bool r = false;
    cin >> n >> m;
    int x = n*m;
    int k = n*m;
    int count = 0;
    while (k%10==0)
    {
        count++;
        k /= 10;
    }
    if ((x % (count*10)) == 0 && (x / (count*10)) % 2 != 0)
        r = false;
    else if (x == 2)
        r = false;
    else if (x % 2 == 0)
        r = true;
    if (r == true)
        cout << "Malvika" << endl;
    else cout << "Akshat" << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <numeric>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define inf 1000000099
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n"

 void solve(vector<vector<int>>& A)
 {

 }

int32_t main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int sum=0;
    std::vector<int> v;
    for (int i = a; i <=b; ++i)
    {
        for(int j=b;j<=c;j++)
          v.push_back(i+j);
      /* code */
    }
    sort(v.begin(),v.end());
    for (int i = c; i <=d ; ++i)
    {
        for(int j=0;j<v.size();j++)
        {
            if(v[j]>i)
            {
              sum+=(v.size()-j);
              break;
            }
        }
      /* code */
    }
    cout<<sum<<endl;

}


#include <bits/stdc++.h>
using namespace std;
#define print_vec(vec)      \
    for (auto jkj : vec)    \
    {                       \
        cout << jkj << " "; \
    }                       \
    {                       \
        cout << endl;       \
    }
#define dbg(num) cout << #num << ": " << num << endl;
#define pb push_back
#define fi first
#define se second
#define MP make_pair

typedef long long ll;

bool in(ll key, vector<ll> &arr)
{
    for (auto a : arr)
        if (a == key)
            return true;
    return false;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, a, b, temp;
    cin >> n;
    int arr[] = {1,5,10,20,100};
    if(n%100==0)
    {
        cout << n/100 << '\n';return 0;
    }
    vector<ll> v(n+1,INT64_MAX);v[0]=0;
    for(ll i=1;i<=n;i++)
    {
        for(int j=0;j<5;j++)
        {
            if(arr[j]<=i)
            {
                v[i] = min(v[i-arr[j]]+1,v[i]);
            }
        }
    }

    cout  << v[n] << '\n';

    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
using namespace std;
pair<int, int> P[100005];
set<int> X[100005], Y[100005];
int CC;
const int mod = 1e9 + 7;
bool V[100005];
int sz[100005];
vector<int> E[100005];
int pwr[100005] = {1};
void dfs(int i) {
	V[i] = 1, ++sz[CC];
	X[CC].insert(P[i].first);
	Y[CC].insert(P[i].second);
	for(auto x : E[i])
		if(!V[x])
			dfs(x);
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	for(int i = 1; i < 100005; ++i)
		pwr[i] = pwr[i-1] * 2 % mod;
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> P[i].first >> P[i].second;
		for(int j = 0; j < i; ++j)
			if(P[i].first == P[j].first or P[i].second == P[j].second)
				E[i].push_back(j), E[j].push_back(i);
	}
	for(int i = 0; i < n; ++i)
		if(!V[i])
			dfs(i), ++CC;
	long long ans = 1;
	for(int i = 0; i < CC; ++i)
		ans = (ans * (pwr[X[i].size() + Y[i].size()] - (X[i].size() + Y[i].size() == sz[i] + 1))) % mod;
	cout << (ans + mod) % mod << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
using namespace std;

int main() {
	int n, m, z;
	scanf("%d%d%d", &n, &m, &z);
	if (max(n, m) % min(n, m)) printf("%d", z / (n * m));
	else printf("%d", z / max(n, m));
	return 0;
}


#include <iostream>
using namespace std;
#define ll unsigned long long int
int main()
{
    ll n;cin >> n;
    ll res = 1;

    for(int i = 0;i < n;i++)
    {
        res = ((res % 100) * (5 % 100))% 100;
    }
    cout << res << endl;
}


#include <iostream>

using namespace std;

int main()
{
	int n, m, k;
	while (true)
	{
		cin >> n >> m >> k;
		if (n <= m && n <= k)
		{
			cout << "Yes" << endl;
		}
		else if (n > m || n > k)
			cout << "No" << endl;
	}
}


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

int main(){
     ios_base::sync_with_stdio(false);
     cin.tie(NULL); cout.tie(NULL);
     int N, K; cin >> N >> K;
     int l = K-1, r = N-K;
     if(l == 0 || r == 0){
          cout << 3 + 3*max(l, r);
          return 0;
     }
     cout << 6 + 3*min(l, r) + 2*max(l, r);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define F(i,n) for(int i=0;i<n;i++)
#define G(i,m,n) for(int i=m;i<=n;i++)
#define H(i,n,m) for(int i=n;i>=m;i--)
#define cases ll t;cin>>t;while(t--)
int main()
{
    cases
    {
     ll a ,b,c,ans=0;
     cin >> a >> b >>c;
     vector<ll> arr,brr;
     G(i,b,a-1)
     {
         arr.push_back(i);
     }
     H(i,c,0)
     {
         brr.push_back(i);
     }
     F(i,arr.size())
     {
         F(j,brr.size())
         {
          if(arr[i]+brr[j]==a-1) ans++;
         }
     }
     cout <<ans<<endl;
    }
return 0;

}


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

#define LL long long
#define mod 1000000009

int C[N][N];
int f[N];

void init() {
    for(int i = 0; i < N; ++i) {
        C[i][0] = C[i][i] = 1;
        for(int j = 1; j < i; ++j) {
            C[i][j] = C[i-1][j-1] + C[i-1][j];
            if(C[i][j] >= mod) C[i][j] -= mod;
        }
    }
    f[0] = 1;
    for(int i = 1; i < N; ++i) f[i] = 1LL * f[i-1] * i % mod;
}

int n, w, b;

int main() {
    init();
    cin >> n >> w >> b;
    int ans = 0;
    for(int i = 1; i <= w - 1; ++i) {
        ans += 1LL * C[w+b-3][n-3] * C[w][i] % mod * f[i] % mod * f[b] % mod * f[w-i] % mod;
        if(ans >= mod) ans -= mod;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define pii pair<int,int>
int fx[]={1,-1,0,0};
int fy[]={0,0,1,-1};
int cell[210][210];
int d[210][210];
bool vis[210][210];
int aa;
int bb;

int  bfs(int sx,int sy)
{
	memset(vis,0,sizeof vis);
	vis[sx][sy]=1;
	queue<pii>q;
	q.push(pii(sx,sy));
	while(!q.empty())
	{
		pii top=q.front(); q.pop();
		for(int k=0;k<4;k++)
		{
			int tx=top.first+fx[k];
			int ty=top.second+fy[k];
			if(tx>=0 and ty>=0 and vis[tx][ty]==0)
				vis[tx][ty]=1;
				d[tx][ty]=d[top.first][top.second]+1;
				if(tx==aa && ty==bb) return d[aa][ty];
				q.push(pii(tx,ty));
			}
		}
}
int main()
{
    int a , b ;
    cin>>a>>b;
    a+=100;
    b+=100;
        cin>>aa>>bb;
    aa+=100;
    bb+=100;
    if(aa!=a && bb!=b ){
            cout<<2*(bfs(a,b)+2);
    }
    else
{
        cout<<max(8,6+(bfs(a,b)*2)) ;
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define For(i,n) for(i= 1;i<n;i++)
using namespace std;
ll dp[100000000];
ll sumofdigits(int n){
	ll ans=0;
	while(n>0){
		ans+= n%10;
		n=n/10;
	}
	return ans;
}
int main(int argc, char const *argv[])
{
	ll i,k;
	ll n,l,j=1;
	n = 100000000;
	For(i,n){
		l = sumofdigits(i);
		if(l==10){
			dp[j] = i;
			j++;
		}
	}
	cin>>k;
	cout<<dp[k];
	return 0;
}


#define HEADER_H
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i,n)	for(auto i=decltype(n)(0); i<(n); ++i)
#define all(v)		begin(v), end(v)
using namespace std;		using ull= unsigned long long;
using ll = long long;		using ld = long double;
using vi = vector<ll>;		using vvi= vector<vi>;
using vb = vector<bool>;	using ii = pair<ll,ll>;
constexpr bool LOG = false;
void Log() { if(LOG) cerr << "\n"; }
template<class T, class... S> void Log(T t, S... s){
	if(LOG) cerr << t << "\t", Log(s...);
} /* ============== END OF HEADER ============== */

ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b;				 }
ll mod(ll a, ll b) { return ((a % b) + b) % b;				   }

// Finds x, y s.t. ax + by = d = gcd(a, b).
void extended_euclid(ll a, ll b, ll &x, ll &y, ll &d) {
	ll xx = y = 0;
	ll yy = x = 1;
	while (b) {
		ll q = a / b;
		ll t = b; b = a % b; a = t;
		t = xx; xx = x - q * xx; x = t;
		t = yy; yy = y - q * yy; y = t;
	}
	d = a;
}

// solves ab = 1 (mod n), -1 on failure
ll mod_inverse(ll a, ll n) {
	ll x, y, d;
	extended_euclid(a, n, x, y, d);
	return (d > 1 ? -1 : mod(x, n));
}

// (a*b)%m
ll mulmod(ll a, ll b, ll m){
	ll x = 0, y=a%m;
	while(b>0){
		if(b&1)
			x = (x+y)%m;
		y = (2*y)%m;
		b/=2;
	}
	return x % m;
}

ll pow(ll b, ll e) {		// b^e in logarithmic time
	ll p = e<2 ? 1 : pow(b*b,e/2);
	return e&1 ? p*b : p;
}

// Finds b^e % m in O(lg n) time, ensure that b < m to avoid overflow!
ll powmod(ll b, ll e, ll m) {
	ll p = e<2 ? 1 : powmod((b*b)%m,e/2,m);
	return e&1 ? p*b%m : p;
}

// Solve ax + by = c, returns false on failure.
bool linear_diophantine(ll a, ll b, ll c, ll &x, ll &y) {
	ll d = gcd(a, b);
	if (c % d) {
		return false;
	} else {
		x = c / d * mod_inverse(a / d, b / d);
		y = (c - a * x) / b;
		return true;
	}
}

// Solves x = a1 mod m1, x = a2 mod m2, x is unique modulo lcm(m1, m2).
// Returns {0, -1} on failure, {x, lcm(m1, m2)} otherwise.
pair<ll, ll> crt(ll a1, ll m1, ll a2, ll m2) {
	ll s, t, d;
	extended_euclid(m1, m2, s, t, d);
	if (a1 % d != a2 % d) return {0, -1};
	return {mod(s * a2 * m1 + t * a1 * m2, m1 * m2) / d, m1 / d * m2};
}

// Solves x = ai mod mi. x is unique modulo lcm mi.
// Returns {0, -1} on failure, {x, lcm mi} otherwise.
pair<ll, ll> crt(vector<ll> &a, vector<ll> &m) {
	pair<ll, ll> res = {a[0], m[0]};
	for (ull i = 1; i < a.size(); ++i) {
		res = crt(res.first, res.second, mod(a[i], m[i]), m[i]);
		if (res.second == -1) break;
	}
	return res;
}

ll SIZE;
vector<bool> bs;
vector<ll> primes;

void sieve(ll size = 1e6+10) { // call at start in main!
	SIZE = size; bs.assign(SIZE+1,1);
	bs[0] = bs[1] = 0;
	for (ll i = 2; i <= SIZE; i++) if (bs[i]) {
		for (ll j = i * i; j <= SIZE; j += i) bs[j] = 0;
		primes.push_back(i);
	}
}

bool is_prime(ll n) { // for N <= SIZE^2
	if (n <= SIZE) return bs[n];
	for(const auto &prime : primes)
	   	if (n % prime == 0) return false;
	return true;
}

struct Factor{ll prime; ll exp;}; using Fs = vector<Factor>;
Fs factor(ll n) {
	Fs factors;
	for(const auto &prime : primes){
		if(n==1 || prime*prime > n) break;
		ll exp=0;
		while(n % prime == 0)
		   	n/=prime, exp++;
		if(exp>0)
			factors.push_back({prime,exp});
	}
	if (n != 1) factors.push_back({n,1});
	return factors;
}

constexpr ll M = 1e9+7;

struct S{
	ll div, children, divsum, x;
};
vector<S> divisors(const Fs &fs){
	vector<S> ds{{1,1,1,0}}; // pair<divisor, divisors>
	ds.reserve(accumulate(fs.begin(),fs.end(),1, [](ll a,auto f){return a*(f.exp+1);}));
	for(auto f : fs)
		for(auto d : ds){
			ll sumpow = 1;
			ll pow = 1;
			for(ll i = 0; i < f.exp; ++i){
				pow *= f.prime;
				sumpow += pow;
				ds.push_back({d.div*pow, d.children*(i+2), d.divsum * sumpow,0});
			}
		}
	return ds;
}

vi fac;

ll binom(ll a, ll b){
	ll ans;
	if(b <0 || b>a) ans=0;
	else ans = fac[a] * mod_inverse(fac[b] * fac[a-b] % M, M) %M;
	Log("binom",a,b,ans);
	return ans;
}

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

	sieve();

	fac.resize(1000001);
	fac[0] = 1;
	REP(i,1000000)
		fac[i+1] = (i+1)*fac[i] % M;

	ll n,k,q; cin >> n >> k >> q;
	vi div(1000001,0);

	ll ans = 0;
	REP(i,n+q){
		ll c; cin >> c;
		Log("read ",c);
		auto fs = factor(c);
		auto divs = divisors(fs);
		Log("divisors, divsum,children");
		for(auto x : divs){
			Log(x.div, x.divsum, x.children);
		}

		for(auto it=divs.rbegin(); it!=divs.rend(); ++it){
			ll val = it->div;
			ll children = it->children;
			ll divsum = it->divsum;
			Log("val",val, "children",children,"div",div[val]);
			ll a = binom(div[val],k-1);
			ll b = a - it->x;
			// add for current
			ans += val*b%M;
			Log(a, b, "add", val*b);
			//ans -= (divsum-val)*a%M;
			for(ll i = 0; divs[i].div != val; ++i)
				if(val % divs[i].div == 0)
					divs[i].x += b;

			++div[val];
		}

		Log("ANS:");
		if(i>=n)
			cout << ans << "\n";

	}

	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; ++i)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; --i)
#define REP(i,a) for(int i=0,_a=(a); i < _a; ++i)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR(A,n)  { cout << #A << " = "; FOR(_,1,n) cout << A[_] << ' '; cout << endl; }
#define PR0(A,n) { cout << #A << " = "; REP(_,n) cout << A[_] << ' '; cout << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define SZ(x) ((int) (x).size())
#define div div____
using namespace std;

const int MN = 2000111;
int n, k, q;
int a[MN], sieve[MN];

void init() {
    FOR(i,2,1000) if (!sieve[i]) {
        for(int j = i*i; j < MN; j += i)
            sieve[j] = i;
    }
}

int dp[111], dk[111];
vector<int> div;
void attempt(int i, int nd, int prod) {
    if (i > nd) {
        div.push_back(prod);
        return ;
    }
    int cur = 1;
    FOR(power,0,dk[i]) {
        attempt(i+1, nd, prod * cur);
        cur *= dp[i];
    }
}
vector<int> divisors(int x) {
    int nd = 0;
    while (x > 1) {
        int p = (sieve[x] ? sieve[x] : x);
        ++nd;
        dp[nd] = p;
        dk[nd] = 0;
        while (x % p == 0) {
            x /= p;
            ++dk[nd];
        }
    }
    div.clear();
    attempt(1, nd, 1);
    return div;
}

const int MOD = 1e9 + 7;
int res[MN];
vector<int> ls[MN];

void resetAll() {
    memset(res, 0, sizeof res);
    REP(i,MN) ls[i].clear();
}

int add[MN], gt[MN], inv_gt[MN];

int power(int x, int k) {
    if (k == 0) return 1;
    if (k == 1) return x % MOD;

    int mid = power(x, k >> 1);
    mid = mid * mid % MOD;

    if (k & 1) return mid * x % MOD;
    return mid;
}
int inverse(int x) {
    return power(x, MOD - 2);
}

int C(int n, int k) {
    return gt[n] * inv_gt[k] % MOD * inv_gt[n-k] % MOD;
}

#undef int
int main() {
#define int long long
    ios :: sync_with_stdio(0); cin.tie(0);
    init();

    gt[0] = 1; FOR(i,1,MN-1) gt[i] = gt[i-1] * i % MOD;
    REP(i,MN) inv_gt[i] = inverse(gt[i]);

    while (scanf("%lld%lld%lld", &n, &k, &q) == 3) {
        FOR(i,1,n+q) scanf("%lld", &a[i]);
        resetAll();

        FOR(i,1,n+q) {
            auto d = divisors(a[i]);
            for(int x : d) {
                ls[x].push_back(i);
            }
        }
        FOR(g,1,1000*1000) {
            add[g] = g;
            auto d = divisors(g);
            for(int x : d) if (x < g) {
                add[g] = add[g] - add[x];
            }

            FOR(i,k-1,SZ(ls[g])-1) {
                int u = ls[g][i];
                res[u] = (res[u] + C(i, k-1) * add[g]) % MOD;
            }
        }
        FOR(i,1,n+q) {
            res[i] = (res[i-1] + res[i]) % MOD;
        }
        FOR(i,n+1,n+q) printf("%lld\n", res[i]);
    }
}


/* Author : bitshar */
// #pragma GCC optimize ("-O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll MOD = 1e9+7;

#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=e; i>=s; i--)
#define ln "\n"
#define sp " "
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define NEGINF -1e18
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define dbg(x) cout << #x << " = " << x << ln
#define all(x) x.begin(), x.end()

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

//#define DEBUG_MODE

ll solve(vector<ll> v) {

    if(v.size()==2) return v[1]-v[0];
    vector<ll> v1,v2;
    forn(i,v.size()) {
        if(i>=2) v1.pb(v[i]);
        if(i!=1 and i!=2) v2.pb(v[i]);
    }
    return min(solve(v1)+v[1]-v[0], solve(v2)+v[2]-v[1]);
}

void solve() {

    ll n;
    cin >> n;
    ll w[2*n],ans=INF;
    forn(i,2*n) cin >> w[i];
    sort(w,w+2*n);
    forn(i,2*n) {
        forsn(j,i+1,2*n) {
            vector<ll> v;
            forn(k,2*n) {
                if(k!=i and k!=j) v.pb(w[k]);
            }
            ans = min(ans,solve(v));
        }
    }
    cout << ans << "\n";
}

int main() {

    #ifdef DEBUG_MODE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    fio;
    int t=1;
    //cin >> t;
    while(t--) {

        solve();
    }
}


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

ll dp[262144+5][18];
int gdp,n,nw[262144+5];
int coun[20],s[20],tot;

int get(int mask)
{
   int f=mask&gdp;
   if(f)return 0;
   return 1;
}
int nw_dp_func(int mask)
{
    if(nw[mask]!=-1)return nw[mask];
    for(int i=tot-1;i>=0;i--)
    {
        if(mask&(1<<i))return nw[mask]=i;

    }
    assert(1/0);

}
ll dp_func(int mask,int len)
{
    if(len==-1){
        return get(mask);
    }
    if(dp[mask][len]!=-1)return dp[mask][len];
    ll ret=0;
    for(int i=0;i<n;i++){
        int v=mask&s[i];
        if(v==0)continue;
        int f=nw_dp_func(v);
        ret+=dp_func(mask^(1<<f),len-1);
    }
    return ret;

}
char str[20];
int rev[20];
int main()
{
     int i,j,k,l,m;
     scanf("%s",str);
     tot=strlen(str);
     if(tot==19){
        cout<<"1"<<endl;
        return 0;

     }
     for(int i=0;str[i];i++){
          coun[str[i]-48]++;
     }
     int f=tot-1;
     for(int i=0;i<10;i++){
          if(coun[i]==0)continue;
          gdp=gdp|(1<<f);
          l=coun[i];
          while(l){
            s[n]=s[n]|(1<<f);
            f--;
            l--;
          }
          rev[n]=i;
          n++;
     }
     memset(dp,-1,sizeof dp);
     memset(nw,-1,sizeof nw);
     ll ret=0;
     int as=(1<<tot)-1;
     for(int i=0;i<tot;i++)
     {
         for(int j=0;j<n;j++)
         {
             if(rev[j]==0)continue;
             int f=nw_dp_func(s[j]);
             ll k=dp_func(as^(1<<f),i-1);
             ret+=k;
            // cout<<k<<" "<<tot<<" "<<i<<" "<<j<<" "<<s[j]<<" "<<f<<endl;
         }

     }
     cout<<ret<<endl;

}


#include <iostream>
using namespace std;
int n, x, s;
int main()
{
    cin>> n>> x;
    for (int i=1; i<=n; i++)
    {
        if (x%i==0)
            s++;
    }
    cout<< s;
    return 0;
}


#include<iostream>
#include<stdio.h>
#include<algorithm>
#include <numeric>
#include<math.h>
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include "boost/algorithm/string.hpp"
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define mod1 mod
#define mod2 1000000007
#define ll long long int
#define llu unsigned long long int
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 1000000000000000005
#define MINN -1000000000000000000
#define INTMAX 1000001000
#define pii pair<ll,ll>
#define pdd pair<double,double>
#define pic pair<int,char>
#define N 1<<20
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 3.1415926535
#define lgn 20
#define coutd(x) cout << fixed << setprecision(x)
#define DECIMAL(n)  std::cout << std::fixed << std::setprecision(n);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define fil(v,x) fill(all(v),x)
#define filcon(v,x) iota(all(v),x)
#define newl '\n'

// #define INTMAX 200000000

// using namespace boost;
// #define si short int

using namespace std;
using namespace __gnu_pbds;
typedef priority_queue<ll, vector<ll > > max_pq;
typedef priority_queue<ll, vector<ll> , greater<ll>  > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
template<typename T>
T toIntegralType(const string &str) {
    static_assert(is_integral<T>::value, "Integral type required.");
    T ret;
    stringstream ss(str);
    ss >> ret;
    if ( to_string(ret) != str)
        throw invalid_argument("Can't convert " + str);
    return ret;
}
// using namespace __gnu_pbds;
// typedef priority_queue<pair<ll,char> , vector<pair<ll , char> > > max_pq;
// typedef priority_queue<pii , vector<pii > ,greater<pii > > min_pq;
typedef tree<pii , null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> OST;
// typedef priority_queue<pair < ll , pair < pii , ll > >  , vector<pair < ll , pair < pii , ll > >  > ,greater<pair < ll , pair < pii , ll > >  > > min_pq;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif
#define nn 2000005
int main()
{
   fio;
   // #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
   string s;
   cin>>s;
   vector <ll> v[10];
      //sort(s.begin(),s.end(),greater <int>());
      for(ll i=1;i<=45500;i++)
      {
          ll z=i*i;
          string zz=tostring(z);
          v[zz.length()].pb(z);
      }
      for(ll i=s.length();i>=1;i--)
        {
            for(ll j=0;j<v[i].size();j++)
          {
            string mc = tostring(v[i][j]);
            int hopaya=0;
            int x=0;
            int counter=0;
          //  cout<<"comparing "<<mc<<" , "<<s;
              for(int i=0;i<mc.length();i++)
              {
                int j;
                for(j=x;j<s.length();j++)
                {
                    if(mc[i]==s[j])
                    {
                      counter++;
                      break;
                    }
                }
                x=j+1;
              }
              //cout<<" counter= "<<counter<<newl;
              if(counter==mc.length())
              {
                cout<<(s.length()-mc.length())<<newl;
              //  cout<<s<<" "<<v[i][j];
                return 0;
              }

          }
        }
        cout<<-1;

}


#include <iostream>
#include <math.h>
#include <iomanip>
#include <vector>
using namespace std;

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

    vector < vector <long long> > f(n+1, vector <long long>(n+1, 0));

    for(long long maximal=1;maximal<=n;maximal++)
    {
        f[1][maximal] = maximal;
    }

    for(long long length=1;length<=n;length++)
    {
        f[length][1] = 1;
    }

    for(long long length=2;length<=n;length++)
    {
        for(long long maximal=2;maximal<=n;maximal++)
        {
            f[length][maximal] = (f[length-1][maximal] + f[length][maximal-1])%1000000007;
        }
    }

    cout<<(f[n][n]*2-n)%1000000007;

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <ctype.h>
const int bufSize = 1e6;
inline char nc()
{
    #ifdef DEBUG
    return getchar();
    #endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
template<typename T>
inline T read(T &r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
const int maxn = 1e6 + 100;
int k, q;
long long f[7], ww[7][10], w[maxn];
long long dp[maxn];
int bit[maxn];
int pow[7] = {0, 1, 10, 100, 1000, 10000, 100000};
inline void work(int weight, long long value) { for (int i = 999999; i >= weight; --i) dp[i] = std::max(dp[i], dp[i - weight] + value); }
int main()
{
    read(k);
    for (int i = 1; i <= 6; ++i) read(f[i]), ww[i][3] = f[i], ww[i][6] = 2 * f[i], ww[i][9] = 3 * f[i];
    pow[0] = 1;
    for (int i = 1; i <= 999999; ++i)
    {
        bit[i] = bit[i / 10] + 1;
        dp[i] = dp[i % pow[bit[i]]] + ww[bit[i]][(i / pow[bit[i]])];
    }
    for (int i = 1; i <= 6; ++i)
    {
        int num = std::min(3 * (k - 1), 333333 / pow[i]);
        for (int j = 1; j <= num; num -= j, j <<= 1) work(3 * pow[i] * j, f[i] * j);
        if (num) work(3 * pow[i] * num, f[i] * num);
    }
    read(q);
    for (int i = 1,x; i <= q; ++i) read(x),printf("%lld\n",dp[x]);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int h,m,t,s,s1,ans;
    while(scanf("%d:%d",&h,&m))
    {
        scanf("%d",&t);
        s=m+t;
        ans=s%60;
        s1=s/60;
        h=h+s1;
        if(h>=24)
        {
            h=h-24;
        }
        //printf("%02d:%02d\n",h,ans);
        if(h<10)
        {
            printf("0%d:",h);
        }
        if(h>=10)
        {
             printf("%d:",h);
        }
        if(ans<10)
        {
            printf("0%d",ans);
        }
        if(ans>=10)
        {
             printf("%d",ans);
        }
        cout<<endl;
    }
    return(0);
}


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

int main()
{
    int r[101], b[101], n;

    cin >> n;

    for(int i = 1; i <= n; ++i)
        cin >> r[i];

    for(int i = 1; i <= n; ++i)
        cin >> b[i];

    int rs = 0, bs = 0;

    for(int i = 1; i <= n; ++i)
    {
        if(r[i] == 0 && b[i] != 0)
            ++bs;

        if(r[i] != 0 && b[i] == 0)
            ++rs;
    }

    if(bs == rs)
        cout << -1;
    else if (rs > bs)
    {
        cout << 1;
    }
    else{
        cout << (bs + 1)/rs + (bs + 1) % rs;
    }
}

/*
    int number_of_tests;
    cin >> number_of_tests;

    for(int test_number = 1; test_number <= number_of_tests; ++test_number)
    {

    }
*/


#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define mod 1000000007
#define All(v) v.begin(),v.end()

using namespace std;

int main()
{
    string s;
    cin >> s;
    int sum = 0;
    bool ok = 1;
    while(ok)
    {
        ok = 0;

        for(int i=0;i<s.length()-1;i++)
        {
            if(s[i] == 'V' && s[i+1] == 'K')
            {
                ok = 1;
                s.erase(i,2);
                sum++;
                break;
            }
        }
    }

    bool yes= 0;
    for(int i=1; i<s.length(); i++)
        if(s[i] ==  s[i-1])
            yes  = 1;
    if(yes)
        cout << sum+1;
    else
        cout << sum;

    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<vector>
using namespace std;
inline int r3(int s1,int s2){
    return min(s1,s2);
}
inline int r2(int x1,int y1,int s,int c){
    if(x1<=c&&c<=y1){
        if(s>=c){
            int r=min(s,y1)-max(1,x1)+1;
            r=max(r,r3(c-x1,c-1));
            r=max(r,r3(y1-c,s-c));
            r=max(r,r3(c-x1,s-c));
            r=max(r,r3(y1-c,c-1));
            return r;
        }else{
            int r=r3(s,c-x1);
            r=max(r,r3(s,y1-c));
            return r;
        }
    }
    if(s>=c)s=c-1;
    if(x1>c){
        x1-=c;y1-=c;
    }
    return r2(x1,y1,s,c/2);
}
inline int run(int x1,int y1,int x2,int y2,int c){
    if(x1<=c&&c<=y1){
        if(x2<=c&&c<=y2){
            int r=min(y2,y1)-max(x2,x1)+1;
            int a1=max(y1-c,c-x1),a2=max(y2-c,c-x2);
            r=max(r,r3(a1,a2));
            return r;
        }else{
            if(x2>c){
                x2-=c;y2-=c;
            }
            int a1=max(y1-c,c-x1);
            return r2(x2,y2,a1,c/2);
        }
    }else if(x2<=c&&c<=y2){
        if(x1>c){
            x1-=c;y1-=c;
        }
        int a2=max(y2-c,c-x2);
        return r2(x1,y1,a2,c/2);
    }
    if(x1>c){
        x1-=c;y1-=c;
    }
    if(x2>c){
        x2-=c;y2-=c;
    }
    return run(x1,y1,x2,y2,c/2);
}
int main(){
    int l1,r1,l2,r2;
    scanf("%d%d%d%d",&l1,&r1,&l2,&r2);
    printf("%d\n",run(l1,r1,l2,r2,524288));

}


#include <iostream>
#include <chrono>
#include <random>
#include <vector>
#include <set>

#define ll long long
#define ft first
#define sd second

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef FREOPEN
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    ll n , k;
    cin >> n >> k;
    vector <ll> c(n),ans(k+1),sum(k+1);

    for (ll i = 0; i < n; ++i) {
        cin >> c[i];
    }
    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());
    set <pair<ll,ll>> s;
    for (ll i = 0; i <= k; ++i)
        s.insert({0,i});
    for (auto &i: c) {
        ll ind = s.begin()->sd;
        s.erase(s.begin());
        ans[ind] += sum[ind];
        sum[ind] += i;
        s.insert({-sum[ind],ind});
    }
    ll out = 0;
    for (ll i = 0; i <= k; ++i) {
        out += ans[i];
    }
    cout << out;
    return 0;
}


#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<math.h>
#include<string>
#include<bitset>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define O edge[i].to
#define NX edge[i].next
using namespace std;
long long tmp,n,k,len,L,kth,Res,Len; map<long long,long long> vis;
inline long long Read(){long long t=0,f=1; char c=getchar();
	for (;c>57||c<48;c=getchar()) if (c=='-') f=-1;
	for (;c>47&&c<58;c=getchar()) t=10ll*t+1ll*c-48ll; return t*f;
}
long long cal(long long now,long long len){
//	printf("%I64d %I64d\n",now,len);
	if (vis[now]) return vis[now];
	if (now==len) return 1; if (now==Len) return 0;
	return vis[now]=cal(now/2,len)+cal(now-now/2-1,len);
}
long long solve(long long l,long long r){
//	printf("solve:%I64d %I64d %I64d %I64d\n",l,r,kth,L);
	long long mid=l+r>>1;
	if (r-l+1ll==L) return l+(L+1)/2ll-1ll;
	vis.clear(); long long tmp=cal(mid-l,len);
//	printf("num::::%I64d %I64d\n",mid-l,tmp);
	if (tmp<kth){kth-=tmp; return solve(mid+1,r);}
	if (tmp>=kth) return solve(l,mid-1);
}
int main(){
	n=Read(),k=Read();
	if (k==1){printf("1\n"); return 0;}
	if (k==2){printf("%I64d\n",n); return 0;}
	if (n==k){printf("%I64d\n",n-1) return 0;}
	for (tmp=1,len=n-2,k-=2;;len=(len-1)/2){
		if (k<=tmp){//printf("%I64d\n",k);
			vis.clear(),Len=len+1; long long t=cal(n-2,len);
		//	printf("%I64d %I64d %I64d\n",n-2,len,t);
			if (k<=t) kth=k,L=len,Len=len+1,Res+=solve(2,n-1);
			else kth=k-t,L=len+1,Len=len,Res+=solve(2,n-1);
			printf("%I64d\n",Res); return 0;
		}
		k-=tmp,tmp*=2;
	}
}


//输入进制k(2<=k<=10),输出k进制下的乘法表。
//乘法表规格为(k-1)* (k-1)
#include<bits/stdc++.h>
using namespace std;
int n;
inline void cha(int a)
{
	if(a==0)return;
	cha(a/n);
	cout<<a%n;
}
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		for(int j=1;i<n;j++)
		{
			int a=i*j;
			cha(a);
			if(j<n-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}


#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#define pb push_back
#define rep(i,j,k) for(int i=(j);i<=(int)k;i++)
#define per(i,j,k) for(int i=(j);i>=(int)k;i--)
#define lowbit(x) ((x)&(-(x)))
#define fi first
#define se second
#define pii pair<int,int>
using namespace std;
typedef long long LL;
typedef double db;
map<pii,bool>fuck;
int n,m;
char s[5];
int x,y;
LL ans;
int dx,dy;
int main()
{   scanf("%d%d",&n,&m);
    scanf("%d%d",&x,&y);
    scanf("%s",s+1);
    if(s[1]=='U')dx=-1;  else dx=1;
    if(s[2]=='L')dy=-1;  else dy=1;
    int fis=0;
    int test=1000000;
    while(test--)
    {   pii now=pii(x,y);
        if(!fuck[now])
        {   fuck[now]=1;
            fis++;
        }
        if(fis==n+m-2)
        {   printf("%I64d",ans+1);
            return 0;
        }
        int xl,yl,l;
        int ex,ey;
        if(dx==-1)xl=x-1; else xl=n-x;
        if(dy==-1)yl=y-1; else yl=m-y;
        if(xl<yl)
        {   ex=-dx;ey=dy;l=xl; }
        else
        {
	 	  if(xl>yl) { ey=-dy; ex=dx;  l=yl;}
          else      { ex=-dx; ey=-dy; l=yl;}
        }
		x+=dx*l;y+=dy*l;
        ans+=1ll*l;
        dx=ex;dy=ey;
    }
    printf("-1\n");
    return 0;


#include <iostream>
#include <algorithm>

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

int main() {
    short a,b,c,d; std::cin>>a>>b>>c>>d;

    /* числитель = высота экрана * ширину картинки
     * знаменатель = ширина экрана * высоту картинки
     * отношение показывает ЗАНЯТОЕ пространство картинки на мониторе */
    int numerator=b*c, denominator=a*d;

    /* если отношение задано неправильно (дробь неправильная), то
     * означает, что картинка первую заняла вертикаль (a/b > c/d)
     * и поэтому поменяем местами числитель со знаменателем */
    if (numerator > denominator) std::swap(numerator, denominator);

    // сокращаем дробь, найдя НОД при помощи алгоритма Евклида
    int divisor = gcd(numerator, denominator);
    if (divisor != 1) {
        numerator/=divisor; denominator/=divisor;
    }

    /* в числителе выводим разность знаменателя и числителя, чем будет
     * являться именно СВОБОДНОЕ пространство монитора, что требует
     * задача */
    std::cout<<denominator - numerator<<"/"<<denominator;
    return 0;
}


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

int main() {
	int n; cin >> n;
	int even = n / 2;
	int odd = n - even;

	vector<int> a(n);
	for (int& x : a) {
		cin >> x;
		if (x == 0) { continue; }
		if (x % 2 == 0) {
			--even;
		} else {
			--odd;
		}
	}
	int orig_complexity = 0;
	for (int i = 0; i < n-1; ++i) {
		if (a[i] == 0 || a[i+1] == 0) { continue; }
		if (a[i] % 2 != a[i+1] % 2) { orig_complexity += 1; }
	}
	// если концы одноимённые, то альтернативы - 0 или 2
	// если разноимённые, то всегда 1
	// если открытое начало или конец, то считать одноимёнными

	// выгоднее идти в порядке меньшие -> большие

	// vector<pair<int, int>> similar_p;
	// vector<pair<int, int>> dissim_p;
	int dissim_p_cnt = 0;
	vector<pair<int, int>> similar_s;
	{
		int i = 0;
		while (i < n) {
			if (a[i] == 0) {
				int left_idx = i-1;
				while (i < n-1 && a[++i] == 0) {}
				int right_idx = i;

				// left_idx = max(left_idx, 0);
				// right_idx = min(right_idx, n-1);
				// if (left_idx == 0) { left_idx = right_idx; }
				// if (right_idx == n-1) { right_idx = left_idx; }

				// (a[right_idx]%2 == a[left_idx]%2 ? similar_p : dissim_p).push_back({left_idx, right_idx});
				if (right_idx == n || left_idx == -1 || a[right_idx]%2 == a[left_idx]%2) {
					int seglen = right_idx - left_idx - 1;
					int parity = (left_idx != -1 ? a[left_idx]%2 : (right_idx != n ? a[right_idx]%2 : 1));
					similar_s.push_back({seglen, parity});
				} else {
					dissim_p_cnt += 1;
				}
			} else {
				++i;
			}
		}
	}

	// std::sort(similar_p.begin(), similar_p.end(), [](const auto& a, const auto& b) {
	// 	return a.second - a.first < b.second - b.first;
	// });

	std::sort(similar_s.begin(), similar_s.end());
	int similar_failed = 0;
	for (const auto& [len, parity] : similar_s) {
		int& capacity = (parity == 0 ? even : odd);
		if (capacity >= len) {
			capacity -= len;
		} else {
			similar_failed += 1;
		}
	}

	// dump for debug
	fprintf(stderr, "similar_s: ");
	for (const auto& x : similar_s) {
		fprintf(stderr, "(len=%i of %i), ", x.first, x.second);
	}
	fprintf(stderr, "\n");
	fprintf(stderr, "similar_failed = %i\n", similar_failed);
	fprintf(stderr, "%i\n", dissim_p_cnt);

	int total_complexity = orig_complexity + dissim_p_cnt * 1 + similar_failed * 2;
	std::cout << total_complexity;
}


#include <bits/stdc++.h>
using namespace std;
int dig(int n)
{
    int sum = 0;
    while(n)
    {
        sum++;
        n/=10;
    }
    return sum;
}
int main()
{
    int T;
    cin>>T;
    int ar[6];
    int p;
    for(int i=0;i<6;i++)
    {
        cin>>p;
        ar[i] = p;
    }
    int q;
    cin>>q;
    int n;
    cin>>n;
    int dp[T];
    int sum=0;
    sum+=9;
    if(T>9)
    dp[0] = 9;
    for(int i=1;i<T;i++)
    {
        if(sum+((10*i)+9)<=T)
        {
        dp[i] = (10*i)+9;
        sum+=dp[i];
        }
        else if(sum+((10*i)+6)<=T)
        {
        dp[i] = (10*i)+6;
        sum+=dp[i];
        }
        else if(sum+((10*i)+3)<=T)
        {
        dp[i] = (10*i)+3;
        sum+=dp[i];
        }
        else if(sum>T)
        {
            int dif = sum-T;
            for(int j=1;j>=0;j--)
            if(diff<=dp[j])
            {
                dp[j]-=diff;
                sum-=diff;
                break;
            }
        }
    }
    int fortune = 0;
    for(int i=0;i<T;i++)
    {
        int d = dig(dp[i]);
        if((dp[i]%10)%3==0)
        {
            fortune+=((dp[i]%10)/3)*(dig(dp[i])-1);
        }
    }
    cout<<fortune<<endl;
    return 0;
}


#include <cmath>
#include <iomanip>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <deque>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
//#include <iostream>
#include <fstream>
ifstream cin("input.txt");
ofstream cout("output.txt");
string cts(int s){
	string str;
	if (s == 0)	str = '0';
	while (s){
		str.push_back(s % 10);
		s /= 10;
	}
	return str;
}
int num(int n){
	int l, now;
	l = n % 10; n /= 10;
	while (n){
		now = n % 10;
		n /= 10;
		if (now == l)
			return 0;
		l = now;
	}
	return 1;
}
int main()
{
	int x1, y1; cin >> x1 >> y1;
	int x2, y2; cin >> x2 >> y2;
	cout << max(abs(x2 - x1), abs(y2 - y1));
	return 0;
}
//void build(int v, int tl, int tr){
//	if (tl == tr){
//		t[v] = a[tl]*a[tl];
//	}
//	else{
//		int tm = (tl + tr) / 2;
//		build(v * 2, tl, tm);
//		build(v * 2 + 1, tm + 1, tr);
//		t[v] = t[v * 2] + t[v * 2 + 1];
//	}
//}
//int maxi(int v, int tl, int tr, int l, int r){
//	if (l > r){
//		return INT_MIN;
//	}
//	if (l == tl&&r == tr){
//		return t[v];
//	}
//	int tm = (tl + tr) / 2;
//	return max(maxi(v * 2, tl, tm, l, min(r, tm)),
//		maxi(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
//}
//int sum(int v, int tl, int tr, int l, int r){
//	if (l > r){
//		return 0;
//	}
//	if (l == tl&&r == tr){
//		return t[v];
//	}
//	int tm = (tl + tr) / 2;
//	return sum(v * 2, tl, tm, l, min(r, tm))
//		+sum(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
//}
//int n; cin >> n;
//vector<pair<int, int> > s(n);
//vector<pair<int, int> > ti(n);
//for (int i = 0; i < n; i++){
//	cin >> s[i].first >> s[i].second;
//	cin >> ti[i].first >> ti[i].second;
//}
//vector<pair<int, int> >a(n);
//for (int i = 0; i < n; i++){
//	a[i].first = ((s[n - 1].first - s[i].first)*ti[i].second) + ti[i].first;
//	a[i].second = i + 1;
//}
//sort(a.begin(), a.end());
//for (int i = 0; i < n; i++){
//	cout << a[i].second << " ";
//}
//int n, m; cin >> n >> m;
//vector<bool> t(m);
//vector<vector<bool> >a(n, t);
//int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
//a[--x1][--y1] = true; a[--x2][--y2] = true;
//for (int i = 0; i < n; i++){
//	for (int j = 0; j < m; j++){
//		if (a[i][j] == false){
//			if (j + 2 != m){
//				a[i][j] = true; a[i][j + 1] = true;
//			}
//			else{
//				if (i + 2 != n&&a[i + 1][j] == false){
//					a[i + 1][j] = true; a[i][j] = true;
//				}
//				else{
//					cout << "NO";
//					return 0;
//				}
//			}
//			cout << "NO";
//			return 0;
//		}
//	}
//}
//cout << "YES";
/*cin >> n >> m;
t.resize(m);
a.resize(n, t);
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
cin >> a[i][j];
}
}
int ans = 0;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (a[i][j] >= '0'&&a[i][j] <= '9'){
ans += check(i, j);
}
}
}
cout << ans;*/
/*int n; cin >> n;
a.resize(n);
int d = 0; int ans;
for (int i = 0; i < n; i++){ cin >> a[i]; }
if (n == 1){ cout << 1; return 0; }
for (int i = 0; i < n; i++){
int td = waves(i);
if (td > d){
if (i - td < 0){
ans = 1;
d = td;
}
else if (i + td - 1 > n) {
ans = n;
d = td;
}
else {
d = td; ans = i + 1;
}
}
if (td > 2){
i += td - 2;
}
}
cout << ans;	*/
//int n; int m;
//vector<char>t;
//vector<vector<char> > a;
//int check(int y, int x){
//	int kf = 0;
//	int i = y - 1;
//	while (i < n - 1 &&  i <= y + 1){
//		if (i >= 0 && x + 1 < m){
//			if (a[i][x + 1] == 'F'){ kf++; i++; }
//			else i++;
//		}
//		i++;
//	}
//	i = y - 1;
//	while (i >= y - 1){
//		if (i >= 0 && x - 1 > 0){
//			if (a[i][x - 1] == 'F'){ kf++; i--; }
//			else i--;
//		}
//		i--;
//	}
//	if (y - 1 > 0 && a[y - 1][x] == 'F')kf++;
//	if (y + 1 < n - 1 && a[y + 1][x] == 'F')kf++;
//	if (kf > a[x][y] - '0')return kf;
//	else return 0;
//}
/*double l, d, t, v1, v2; cin >> l >> d >> t >> v1 >> v2;
vector<pair<double, double> > p(d + 1);
for (int i = 0; i < d; i++){
p[i].first = (double)i / v1;
p[i].second = (double)(d - i) / v2 + t;
}
p[d].second = 0; p[d].first = d / v1;
double ans = d / (v2 + v1) + t + l / v2;
for (int i = 0; i <= d; i++){
if (p[i].first >= p[i].second){
ans = min(ans, p[i].first + l / v1);
}
}
cout <<ans;
int n;
cin >> n;
set < int > a;
for (int g = 1; g <= n; g++){
for (int k1 = 1; k1 < g; k1++){
int k2 = sqrt(g*g - k1*k1);
double dk2 = sqrt(g*g - k1*k1);
if (dk2 != k2)continue;
else{
a.insert(g);
}
}
}
cout << a.size();*/
//int waves(int p){
//	int d=0;
//	while (a[p - d] != 1 && a[p + d] != 1){
//		if (p - d == 0){
//			d++;
//			while (a[p + d] != 1 && p + d != a.size() - 1)d++;
//			break;
//		}
//		else if (p + d == a.size() - 1){
//			d++;
//			while (a[p - d] != 1 && p - d != 0)d++;
//			break;
//		}
//		else d++;
//	}
//	return d;
//}
//
/*
string s1, s2; cin >> s1 >> s2;
reverse(s1.begin(), s1.end());
reverse(s2.begin(), s2.end());
vector<int> a(252), b(252);
int n = s1.size(), m = s2.size();
for (int i = 0; i < n; i++){
a[i] = s1[i] - '0';
}
for (int i = 0; i < m; i++){
b[i] = s2[i] - '0';
}
vector<int> ans(255);
for (int i = 0; i < 252; i++){
int s = a[i] + b[i] + ans[i];
ans[i] = s % 10;
ans[i + 1] = s / 10;
}
reverse(ans.begin(), ans.end());
int i = 0;
while (ans[i] == 0)i++;
for (; i < ans.size(); i++)
cout << ans[i];
*/
/*int a, b, c, d;
cin >> a >> b >> c >> d;
set<pair<int,int> > ans;
for (int i = a; i <= b; i++){
for (int j = 1; j <= i; j++){
if (i%j != 0){
continue;
}
else{
if ((i / j) * 2 + j * 2 >= c && (i / j) * 2 + j * 2 <= d){
ans.insert(make_pair(i / j, j));
}
}
}
}
cout << ans.size();*//*string s1, s2; cin >> s1 >> s2;
	vector<int>a(122);
	for (int i = 0; i < s1.size(); i++)a[(int)s1[i]]++;
	for (int i = 0; i < s2.size(); i++)a[(int)s2[i]]++;
	for (int i = 121; i > 96; i--){
		if (a[i] != 0){
			s1 = s1.substr(s1.find((char)i + 1), s1.end());
		}
	}*/


#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <math.h>
#include <numeric>
#include <cstring>
using namespace std;

#define is ==
#define INF 99999999
#define rep(i,start,m) for(int i=(int)(start);i<(int)(m);i++)
#define showarray(array,m) for(int sa_i=0;sa_i<(int)(m);sa_i++) cout << array[sa_i] << " "; cout << endl;
#define showvector(array) for(int sa_i=0;sa_i<(int)(array.size());sa_i++) cout << array[sa_i] << " "; cout << endl;
#define skipline() string line; getline(cin,line);
stringstream ss;
#define cast(a,b) ss.clear(); ss<<a; ss>>b; ss.clear();
#define rev(s) (string((s).rbegin(), (s).rend()))
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
#define clr(a) memset((a), 0 ,sizeof(a))

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

//pyfind(vector, targ)
template<class T>
int pyfind(const vector<T> &vect, const T &targ){
	for(int i=0;i<vect.size();i++){
		if(vect[i] == targ) return i;
	}
	return -1;
}

void remove(vector<int> &vect, int x){
	vector<int>::iterator itr;
	itr = vect.begin();
	for(int i=0;i<x;i++){
		itr++;
	}
	vect.erase(itr);
}

int a,b,m;

int main () {
	cin >> a >> b >> m;
	if( b>=m ){
		cout <<2<< endl;
		exit(1);
	}
	cout << 1 << endl;
}


#include <bits/stdc++.h>

using namespace std;

long long m, a, b;

long long ans;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	cin >> m >> a >> b;
	vector<long long> x(a, -1);
	for (long long i = 0, X = 0; x[i % a] == -1;)
	{
		x[i % a] = X;
		i += a;
		if (i <= m)
		{
			X = max(X, i);
			while (i >= b)
			{
				long long f = i % a;
				if (x[f] == -1)
					x[f] = X;
				i -= b;
			}
		} else
			break;
	}
	for (long long i = 0; i < a; i++)
	{
		if (x[i] != -1)
		{
			long long n = (m - i) / a + 1;
			long long N = (m - x[i]) / a + 1;
			ans += n-N + N*(m - x[i] + 1) - a*(N - 1) * N / 2;
		}
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>
#include <math.h>
#define forn(i, n) for(int i = 1; i <= n; i++)
using namespace std;

long long const N = 110000, INF = 1e6;
const long double PI = acos(-1.0L);

int a, n, s, k, g, ans = 1000000, m, k1, y, x;
long double l;

int main() {
    //freopen("goat5.in", "r", stdin);
    //freopen("goat5.out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> k;
    forn(i, k) {
        forn(j, k)
            if (i * j >= k && (i + j) * 2 < ans && i * j - k < k)
                ans = (i + j) * 2;
    }
    cout << ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+9;
int n,a[MAX];
int main()
{
	int w,h,k;
	cin>>w>>h>>k;
	int ans=0;
	for (int i=0;i<k;i++)
		ans+=(w+h)*2-4,w-=2,h-=2;
	cout<<ans;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

int a[10];

int main()
{
    int i, n;
    scanf("%d", &n);
    for (i = 0; i < n; ++i) scanf("%d", &a[i]);
    if (n == 1)
    {
        if (a[0] != 0) printf("BitLGM\n");
        else printf("BitAryo\n");
    }
    else if (n == 2)
    {
        sort(a, a + n);
        int k, q;
        if (a[0] == 0 && a[1] == 0) {printf("BitAryo\n"; return 0;}
        k = ((double)(a[0] * 2) / (1 + sqrt(5)) + 1);
//      printf("k:%d\n", k);
        if (a[0] + k == a[1]) printf("BitAryo\n");
        else printf("BitLGM\n");
    }
    else
    {
        int k = a[0] ^ a[1] ^ a[2];
        if (k != 0) printf("BitLGM\n");
        else printf("BitAryo\n");

    }
    return 0;
}


#include<algorithm>
#include<fstream>

using namespace std;

int n;
int s;

ifstream cin("input.txt");
ofstream cout("output.txt");

int main()
{

	cin >> n;

	bool a[3];
	a[1] = a[2] = a[0] = 0;
	a[n - 1] = 1;
	s = n;
	for(int k = 1; k <= 3; k++)
	{
		int d1, d2;
		cin >> d1 >> d2;
		swap(a[d1-1], a[d2-1]);
		if(a[d1-1])
		s = d1;
		if(a[d2-1])
		s = d2;

	}
	cout << s;

}


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

bool isvowel(char c)
{
    if(c=='A' || c=='E' || c=='I' || c=='O'|| c=='U' || c=='Y')
        return true;
    return false;
}

int main()
{
    string s;
    cin>>s;
    vector<int> v;
    for(int i=0; i<s.size(); i++)
    {
        if(isvowel(s[i]))
        {
            v.push_back(i);
        }
    }
    int ans = 0;
    for(int i=1; i<v.size(); i++)
        ans = max(ans , v[i]-v[i-1]);
    int k = v.size() - v[v.size()-1];
     ans = max(ans, k);
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int l1,l2,r1,r2,k,c;
    cin>>l1>>r1>>l2>>r2>>k;
    c=min(r1,r2)-max(l1,l2);
    if(c>0)
    {

    if(k>min(r1,r2) || k<max(l1,l2) )
    cout<<c+1;
    else
        cout<<c;
    }

        else
            cout<<"0";
}


#include<bits/stdc++.h>
using namespace std;
char ss[104];
int main()
{
cin>>ss;
int len=strlen(ss);
int arr[(len/2)+1];
for(int i=0,j=0;j<len;i+=2,j++)
{
arr[j]=ss[i]%48;
}
sort(arr,arr+(len/2)+1);
for(int i=0,j=0;j<len;i+=2,j++)
{
ss[i]=arr[j]+48;
}
cout<<ss;
return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
const int N=105;
struct data
{
    int s,t,d,id;
}a[N];
int ans[N],t[N],num[N],n,m;
inline char tc(void)
{
    static char fl[100000],*A=fl,*B=fl;
    return A==B&&(B=(A=fl)+fread(fl,1,100000,stdin),A==B)?EOF:*A++;
}
inline void read(int &x)
{
    x=0; char ch=tc();
    while (ch<'0'||ch>'9') ch=tc();
    while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=tc();
}
inline bool comp(data a,data b)
{
    return a.t<b.t;
}
int main()
{
    freopen("CODE.in","r",stdin); freopen("CODE.out","w",stdout);
    register int i,j; read(n); read(m);
    for (i=1;i<=m;++i)
    read(a[i].s),read(a[i].t),read(a[i].d),a[i].id=i;
    sort(a+1,a+m+1,comp);
    for (i=1;i<=m;++i)
    num[a[i].t]=i;
    for (i=1;i<=n;++i)
    {
        if (num[i])
        {
            if (t[num[i]]==a[num[i]].d) { ans[i]=m+1; continue; } else { puts("-1"); return 0; }
        }
        for (j=1;j<=m;++j)
        if (t[j]!=a[j].d&&i>=a[j].s) { ans[i]=a[j].id; ++t[j]; break; }
    }
    for (i=1;i<=n;++i)
    printf("%d ",ans[i]);
    return 0;
}


#include<iostream>
using namespace std;
int main() {
	int h, m, min;
	char c;
	cin >> h >> c >> m >> min;
	m += min;
	int x = 1;
	do {
		if (m > 60) { m -= 60; h++; }
		if (h >= 24) { h -= 24; }
		if (h < 24 && m < 60)
			x = 0;
	} while (x);
	if (h < 10) { cout << '0' << h << ':'; }
	else cout << h << ':';
	if (m < 10) { cout << '0' << m; }
	else cout << m;
}


n, k = map(int, input().split())
ans = 1
for x in range(1, 10000000):
    if ((x // k) * (x % k)) == n:
        ans = x
        break
print(ans)


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

#define fi first
#define se second
typedef long long ll;

ll abs_(ll x) {
    return max(x, -x);
}

int main() {
    int a[2];
    cin >> a[0] >> a[1];
    int col = 1;
    int cnt = a[0] + a[1] - 1;
    int last;
    if (a[0] > a[1]) {
        last = 0;
    } else {
        last = 1;
    }
    a[last]--;
    vector<int>ans;
    ans.push_back(last);
    int b = 0;
    for (int i = 1; a[0] || a[1]; i++) {
        if (i % 2 == 1 && a[last ^ 1]) {
            last = last ^ 1;
            b++;
        } else {
            last = last;
        }
        a[last]--;
    }
    cout << cnt - b << " " << b << endl;
    return 0;
}


        #include<bits/stdc++.h>

        using namespace std;
        main()
        {
            int n,x,y;
            cin>>n >>x >>y;
            if(n==2)
                cout<<"NO";
            else if((n/x==2)||(n/(x-1)==2))
            {
                if(y-(n/2)>1)
                    cout<<"YES";
                    else
                    cout<<"NO";
            }

            else
            cout<<"YES";

        }


/*/**/

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 1;
	int p = 0;
	while(p < n and s[p] - '0') {
		ans++;
	}
	cout << min(ans, n) << endl;
	return 0;
}


/* Author : Prateep  */
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define LET(x,a)        __typeof(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i=(int)(a) ; i < (int)(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi=acos(-1.0);
const double eps=1e-11;
const int INFINITE=0x3f3f3f3f;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
template<class T> inline T lowbit(T n){return (n^(n-1))&n;}
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}

typedef long long       ll;
typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int,int>   PI;

//#define LocalHost
bool isUserName(string s)
{
    int l = s.SZ;
    if(l == 0 || l > 16) return false;
    //cout << s << endl;
    REP(i,s.SZ)
    {
        if(!isupper(s[i]) && !islower(s[i]) && !isdigit(s[i]) && s[i]!='_')
            return false;
    }
    return true;
}

bool isHostName(string s)
{
    int l = s.SZ;
    if(l == 0 || l > 32) return false;
    size_t id = s.find_first_of(".");

    while(id != string::npos)
    {
        if(!isUserName(s.substr(0,id)))
            return false;
        s = s.substr(id+1);
        id = s.find_first_of(".");
    }
    return isUserName(s);
}

bool solve(string s)
{
    size_t id = s.find("@");
    if(id == string::npos) return false;

    if(!isUserName(s.substr(0,id))) return false;

    string rest = s.substr(id+1);

    size_t id1 = rest.find_first_of("/");

    string hostname, resources;
    if(id1 == string::npos) {
        hostname = rest;
        resources = "";
    }
    else  {
        hostname = rest.substr(0,id1);
        resources = rest.substr(id1+1);
    }

    //cout << hostname << ' ' << resources << endl;
    return (isHostName(hostname) && isUserName(resources) );

}

int main()
{
#ifdef LocalHost
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    string s; cin >> s;

    bool res = solve(s);
    cout << (res ? "YES" : "NO") << endl;

    return 0;
}


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

bool cmp(int a,int b)
{
	return a>b;
}

int N;
int val[8];
int cPrimes[8];
int bestAns;

void dfs(int i,int cur,bool needExtraRoot)
{
	if(i==N)
	{
		bestAns = min(bestAns,cur+N+needExtraRoot);
		return;
	}
	//root
	if(i == 0)
	{
		dfs(i+1,cur,0);
	}
	//child of root
	if(i==0)
		dfs(i+1,cur+cPrimes[i],1);
	else
	{
		if(needExtraRoot)
			dfs(i+1,cur+cPrimes[i],1);
	}
	//child of other node
	for(int j=0;j<i;j++)
		if(!(val[j]%val[i]))
		{
			val[j] /= val[i];
			dfs(i+1,cur,needExtraRoot);
			val[j] *= val[i];
		}
}

int main()
{
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> val[i];
	}
	sort(val,val+N,cmp);
	for(int i=0;i<N;i++)
	{
		cPrimes[i] = 0;
		int temp = val[i];
		for(int j=2;j<=10e6;j++)
		{
			if((j*j) > temp)
				break;
			while(!(val[i]%j))
			{
				val[i] /= j;
				cPrimes[i]++;
			}
		}
		if(val[i] > 1)
			cPrimes[i]++;
		val[i] = temp;
	}
	bestAns = (1<<30);

	dfs(0,0,0);
	cout << bestAns << endl;
	return 0;
}


#ifdef ONLINE_JUDGE
#pragma comment(linker, "/STACK:16777216")
#endif

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <sstream>
#include <cstring>
#include <numeric>
#include <ctime>

#define re return
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define y0 y32479
#define y1 y95874
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define prev prev239
#define next next239
#define hash hash239
#define rank rank239

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef double D;
typedef long double LD;

template<class T> T abs(T x) {return x > 0 ? x : -x;}

int n;
int m;
int k;

int used[10][10];
int res[10];
int mask;
int zlo[10];
int was[12];
int t;

int check2() {
	int st = 0;
	t++;
	rrep(i, n - 1) {
		for (int j = st; j < n; j++)
		if (zlo[i] & (1 << j))
			if (was[j] != t) {
				if (!used[j][res[i]])
					re 0;
				was[j] = t;
				while (was[st] == t)
					st++;
				break;
			}
	}

	re 1;
}

int col[1024];

int paste(int p) {
	if (p == n - 1) {
		if (col[mask] == n - k)
			re check2();
		else
			re 0;
	}

	int ans = 0;
	rep(i, n) {
		int smask = mask;
		res[p] = i;
		mask |= (1 << i);
		if (p)
			zlo[p] = zlo[p - 1] & (~(1 << i));
		ans += paste(p + 1);
		mask = smask;
	}

	re ans;
}

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

	rep(i, 1024)
	col[i] = __builtin_popcount(i);

	cin >> n >> m >> k;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		used[a][b] = used[b][a] = 1;
	}
	res[0] = n - 1;
	zlo[0] = (1 << n) - 1;
	cout << paste(1) << endl;

	re 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<pair<ll, pair<ll, ll> > > answer;

void add(ll x, ll y, ll z) {
    answer.push_back(make_pair(x, make_pair(y, z)));
}

void solve(ll n, ll a, ll b, ll c) {
    if ((c + a - b) % 2 != 0) return;
    ll x = (c + a - b) / 2;
    if (x < 1) return;
    ll y = (c + b - a) / 2;
    if (y < 1) return;
    ll z = (a + b - c) / 2;
    if (z < 1) return;

    if (x > y) swap(x, y);
    if (y > z) swap(y, z);
    if (x > y) swap(x, y);
    if ((x + y + z) * (x + y + z) * (x + y + z) - x * x * x - y * y * y - z * z * z == n * 3) {
        add(x, y, z);
    }
}

int calculate(pair<ll, pair<ll, ll> > a) {
    if (a.first == a.second.second) return 1;
    if (a.first == a.second.first || a.second.first == a.second.second) return 3;
    return 6;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll n;
    cin >> n;
    if (n % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    n /= 3;
    vector<ll> divisors;
    for (ll a = 1; a * a <= n; ++a) {
        if (n % a == 0) {
            divisors.push_back(a);
        }
    }
    for (int indA = 0; indA < divisors.size(); ++indA) {
        ll a = divisors[indA];
        if (n % a != 0) {
            continue;
        }
        ll d = n / a;
        for (int indB = indA; indB < divisors.size() && a * divisors[indB] * divisors[indB] <= n; ++indB) {
            ll b = divisors[indB];
            if (d % b != 0) continue;
            ll c = d / b;
            solve(n, a, b, c);
        }
    }
    ll ans = 0;
    sort(answer.begin(), answer.end());
    ans += calculate(answer[0]);
    for (int i = 1; i < answer.size(); ++i) {
        if (answer[i] == answer[i - 1]) continue; else ans += calculate(answer[i]);
    }
    cout << ans << endl;
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <unordered_set>
#include <map>
#include <cstring>
#include <iostream>
#include <stack>
#include <queue>
#include <numeric>
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repR(i, j, k) for(int i = j; i < k; i++)
#define lli long long int
#define ulli unsigned long long int
#define mp make_pair
#define MOD 1000000007
using namespace std;
int MAX = 1000000;
void printArray(int N, int arr[]) {
	rep(n, N)
		printf("%d ", arr[n]);
	printf("\n");
}
void printVector(vector<int> &v) {
	rep(n, v.size())
		printf("%d ", v[n]);
	printf("\n");
}
int maxInArray(int i, int j, int A[]) {
	int maxVal = -1e9;
	for(int k = i; k <= j; k++) {
		maxVal = max(maxVal, A[k]);
	}
	return maxVal;
}

int minInArray(int i, int j, int A[]) {
	int minVal = -1e9;
	for(int k = i; k <= j; k++) {
		minVal = min(minVal, A[k]);
	}
	return minVal;
}
lli gcd(lli a, lli b) {
	if(a == 0 || b == 0)
		return a^b;
	return gcd(b%a, a);
}

void zAlgorithm(int len, char s[], int *Z) {
	rep(n, len)
		Z[n] = 0;
	Z[0] = len;
	int l = 0, r = 0;
	for(int k = 1; k < len; k++) {
		if(!(k >= r)) {
			int p = k - l;
			if(Z[p] + k < r) {
				Z[k] = Z[p];
			} else {
				l = k;
				while(r < len && s[r] == s[r - k]) {
					r++;
				}
				Z[k] = r - k;
			}
		} else {
			int i = k, j = 0;
			while(i < len && s[i] == s[j]) {
				i++;
				j++;
			}
			l = k;
			r = i;
			Z[k] = j;

		}

	}
}
int findSmallestDivisor(int len, int *pre) {
	int k = 1;
	while(k <= len) {
		// printf("k: %d len: %d\n", k, len);
		bool isMultiple = true;
		for(int i = 0; i < len; i += k) {
			if(pre[i] < k) {
				// printf("i: %d k: %d pre[i]: %d\n", i, k, pre[i]);
				isMultiple = false;
				break;
			}
		}
		if(isMultiple)
			return k;
		k++;
	}
	return 0;
}
void seiveErathosthenes(int limit, vector<int> &primes) {
	// printf("limit: %d\n", limit);
	if(limit < 2)
		return;
	bool isPrime[limit + 1];
	repR(i, 2, limit + 1)
		isPrime[i] = true;
	repR(i, 2, limit + 1) {
		if(isPrime[i]) {
			// printf("i: %d\n", i);
			primes.push_back(i);
			for(int j = i*2; j <= limit; j += i) {
				// printf("i: %d j: %d\n", i, j);
				isPrime[j] = false;
			}
		}
	}
}

lli numSubTree(int uu, vector<int> adjList[], int A[], int N) {
	stack<int> ss, s;
	ss.push(uu);
	while(ss.size()) {
		int u = ss.top();
		s.push(u);
		ss.pop();
		for(int i = 0; i < adjList[u].size(); i++) {
			int v = adjList[u][i];
			ss.push(v);
		}
	}
	lli dp[N + 1];
	rep(n, N + 1)
		dp[n] = 0;
	while(s.size()) {
		int u = s.top();
		s.pop();
		lli total = 1, prod = 1;
		bool isLeafNode = true;
		for(int i = 0; i < adjList[u].size(); i++) {
			isLeafNode = false;
			int v = adjList[u][i];
			if(A[uu] == A[v] && v >= uu) {
				// printf("Hehe\n");
				continue;
			}
			prod = (prod*(dp[v] + 1))%MOD;
		}

		// printf("u: %d prod: %lld isLeafNode: %d\n", u, prod, isLeafNode );
		dp[u] = prod;
	}
	return dp[uu];
}

vector<int> * getAdjListWithMin(int i, int D, int N, vector<int> adjList[], int A[]) {
	vector<int> *modifiedAdjList = new vector<int>[N];
	stack<int> s;
	lli minVal = A[i], maxVal = A[i] + D;
	bool visited[N];
	rep(n, N) {
		visited[n] = false;
	}
	s.push(i);
	while(s.size()) {
		int u = s.top();
		s.pop();
		visited[u] = true;
		for(int j = 0; j < adjList[u].size(); j++) {
			int v = adjList[u][j];
			if(!visited[v] && A[v] >= minVal && A[v] <= maxVal) {
				modifiedAdjList[u].push_back(v);
				// printf("%d->%d\n", u, v);
				s.push(v);
			}
		}
	}
	return modifiedAdjList;
}

void buildSparseTable(lli ((*fn)(lli , lli)), int N, lli A[], vector<lli> sparseTable[]) {
	rep(i, N) {
		// sparseTable[i].push_back(0);
		sparseTable[i].push_back(A[i]);
	}
	int j = 1;
	while((1<<j) <= N) {
		for(int i = 0; (i + (1<<j)) <= N; i++) {
			// printf("i1: %d i2: %d j: %d\n", i, i + (1<<(j - 1)), j - 1);
			sparseTable[i].push_back(fn(sparseTable[i][(j - 1)], sparseTable[i + (1<<(j - 1))][(j - 1)]));
		}
		j++;
	}
	// for(int i = 0; i < N; i++) {
	// 	int j = 0;
	// 	while(i + (1<<j) <= N) {
	// 		printf("i: %d j: %d %lld\n", i, j, sparseTable[i][j]);
	// 		j++;
	// 	}
	// }
}

int sparseTableQuery(lli identity, lli ((*fn)(lli , lli)), int L, int R, int N, vector<lli> sparseTable[]) {
	int i = L;
	lli total = identity;
	while(i <= R) {
		int j = 0;
		while((i + (1<<(j + 1)) - 1) <= R) {
			j++;
		}
		total = fn(total, (sparseTable[i][j]));
		i = i + (1 << j);
	}
	return total;
}

void reflectOfX(double x, double y, double z, double vx, double vy, double vz, double Px, double *px, double *py, double *pz) {
	*py = ((Px - x)*vy)/vx + y;
	*pz = ((Px - x)*vz)/vx + z;
	*px = Px;
}

void reflectOfY(double x, double y, double z, double vx, double vy, double vz, double Py, double *px, double *py, double *pz) {
	*px = ((Py - y)*vx)/vy + x;
	*pz = ((Py - y)*vz)/vy + z;
	*py = Py;
}

void reflectOfZ(double x, double y, double z, double vx, double vy, double vz, double Pz, double *px, double *py, double *pz) {
	*px = ((Pz - z)*vx)/vz + x;
	*py = ((Pz - z)*vy)/vz + y;
	*pz = Pz;
}
bool isValid(double *x, double *y, double *z, double a, double b) {
	return (*x >= 0 && *x <= a && *z >= 0 && *z <= b && *y >= 0);
}
int main(int argc, char const *argv[]) {
	double a = 0, b = 0, m = 0;
	scanf("%lf %lf %lf", &a, &b, &m);
	double vx = 0.0, vy = 0.0, vz = 0.0;
	scanf("%lf %lf %lf", &vx, &vy, &vz);
	double *px = new double(), *py = new double(), *pz = new double();
	*px = ((double)a)/2.0, *py = (double)m, *pz = 0.0;
	bool atX = true;
	while(true) {
		double *tx = new double(), *ty = new double(), *tz = new double();
		// printf("%lf %lf %lf - %lf %lf %lf\n", *px, *py, *pz, vx, vy, vz);
		*tx = *px, *ty = *py, *tz = *pz;
		reflectOfY(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);
		if(isValid(tx, ty, tz, a, b)) {
			px = tx, py = ty, pz = tz;
			break;
		}
		if(atX) {
			*tx = *px, *ty = *py, *tz = *pz;
			if(vz > 0) {
				reflectOfZ(*tx, *ty, *tz, vx, vy, vz, b, tx, ty, tz);
				if(isValid(tx, ty, tz, a, b)) {
					px = tx, py = ty, pz = tz;
					vz = -vz;
					atX = false;
					continue;
				}
			} else if(vz < 0) {
				reflectOfZ(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);
				if(isValid(tx, ty, tz, a, b)) {
					px = tx, py = ty, pz = tz;
					vz = -vz;
					atX = false;
					continue;
				}
			}
			*tx = *px, *ty = *py, *tz = *pz;
			reflectOfX(*tx, *ty, *tz, vx, vy, vz, *tx == 0.0?a:0.0, tx, ty, tz);
			px = tx, py = ty, pz = tz;
			vx = -vx;
		} else {
			*tx = *px, *ty = *py, *tz = *pz;
			if(vx > 0) {
				reflectOfX(*tx, *ty, *tz, vx, vy, vz, a, tx, ty, tz);
				if(isValid(tx, ty, tz, a, b)) {
					px = tx, py = ty, pz = tz;
					atX = true;
					vx = -vx;
					continue;
				}
			} else if(vx < 0) {
				reflectOfX(*tx, *ty, *tz, vx, vy, vz, 0.0, tx, ty, tz);
				if(isValid(tx, ty, tz, a, b)) {
					px = tx, py = ty, pz = tz;
					atX = true;
					vx = -vx;
					continue;
				}
			}
			*tx = *px, *ty = *py, *tz = *pz;
			reflectOfZ(*tx, *ty, *tz, vx, vy, vz, *tz == 0.0?b:0.0, tx, ty, tz);
			px = tx, py = ty, pz = tz;
			vz = -vz;
		}
	}
	printf("%lf %lf\n", *px, *pz);

 	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn = 1e4+10;
double dp[maxn][maxn];//��һά��ʾ������������ڶ�ά��ʾ���������
int main()
{
	int w,b;
	cin>>w>>b;
	memset(dp,0.0,sizeof(dp));
	for(int i=1;i<=w;i++) dp[i][0]=1.0;
	for(int i=0;i<=b;i++) dp[0][i]=0.0;
	for(int i=1;i<=w;i++)
	{
		for(int j=1;j<=b;j++)
		{
			dp[i][j]+=((double)i/(i+j));
			if(j>=3)
			{
				dp[i][j]+=((double)j/(i+j))*((double)(j-1)/(i+j-1))*((double)(j-2)/(i+j-2))*dp[i][j-3];
			}
			if(j>=2)
			{
				dp[i][j]+=((double)j/(i+j))*((double)(j-1)/(i+j-1))*((double)i/(i+j-2))*dp[i-1][j-2];
			}
		}
	}
	printf("%.9lf",dp[w][b]);
	return 0;
}


#include<iostream>
using namespace std;
int n,a[5];
void qsort(int l,int r)
{
    int mid=a[(l+r)/2];
    int i=l,j=r;
    do{
        while(a[i]<mid) i++;
        while(a[j]>mid) j--;
        if(i<=j)
        {
            swap(a[i],a[j]);
            i++;
            j--;
        }
    }while(i<=j);
    if(l<j) qsort(l,j);
    if(i<r) qsort(i,r);
}
//以上为快速排序，不解释了
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i) cin>>a[i];
    qsort(1,n);
    cout<<a[(1+n)/2];//整型自带向下取整
}


#include <iostream>
using namespace std;
int main() {
int n,k,c=3;
cin>>n>>k;
int rk=k;
int gk=k;
int bk=k;
for (int i=1;1<=n;i++){
  rk-=2;
  gk-=5;
  bk-=8;
  if(rk<2){

    c++;
     rk+=5;
  }
  if (gk<5){

    c++;
    gk+=5;
  }
  if (bk<8){

    c++;
    bk+=5;
  }

}
cout<<c;

return 0;
}


#include <bits/stdc++.h>
#define pi 3,141592653589793238462643
using namespace std;
int btd(int n){
	 int decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return  decimalNumber;
	}
string dtb(int n){
	string x="";

	while(n){
		if(n%2==1)
		x.push_back('1');
		else if(n%2==0)
		x.push_back('0');
		n/=2;
	}
	reverse(x.begin(),x.end());
	return x;
}
string tos(int n){
	string x;
	while(n){
	x+=(n%10);
	n/=10;
	}
return x;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    long long a,b;
    cin >> a >> b;
    int q =btd(a) ^ btd(b);
    string j = tos(a);
	string p = dtb(q), ans;
	int sz = j.size() - p.size();
	while(ans.length()<sz){
		ans+='0';
	}
	ans+=p;
	cout<<ans;
}
//Alik's


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<utility>
#include<cassert>

using namespace std;

const int MAXN = 450 + 30;
const int INF = 1e9 + 7;

int n;
bool mark[MAXN];
vector<int>	adj[MAXN], sadj[MAXN];
vector<int>	st;
vector<int>	comp[3];
int col[MAXN];

void dfs(int v){
	if (mark[v])
		return;
	for (int u:adj[v])
		dfs(u);
	st.push_back(v);
}

bool cmp(int a, int b){
	return	col[a] < col[b];
}

int uu, vv;
bool flag;
int ret = 0, cn = 0;

int get(int s){
	ret = cn = 0;
	memset(mark, 0, sizeof(mark));
	for (; cn < n; s = (s + 1) % 3, ret++){
		for (int i = 0; i < comp[s].size(); i++){
			uu = comp[s][i];
			if (mark[uu])	continue;
			flag = 1;
			for (int j = 0; j < sadj[uu].size(); j++){
				vv = sadj[uu][j];
				if (!mark[vv]){
					flag = 0;
					break;
				}
			}
			if (flag){
				mark[uu] = 1;
				cn++;
			}
		}
	}
	ret--;
	return	ret + n;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++){
		int temp;	cin >> temp;	temp--;
		comp[temp].push_back(i);
	}
	for (int i = 0; i < n; i++){
		int t;	cin >> t;
		for (int j = 0; j < t; j++){
			int v;	cin >> v;	v--;
			adj[v].push_back(i);
			sadj[i].push_back(v);
		}
	}

	for (int i = 0; i < n; i++)
		if (!mark[i])
			dfs(i);
	reverse(st.begin(), st.end());
	for (int i = 0; i < st.size(); i++)
		col[st[i]] = i;
	st.clear();

	for (int i = 0; i < 3; i++)
		sort(comp[i].begin(), comp[i].end(), cmp);

	int ans = min(get(0), get(1));
	ans = min(ans, get(2));
	cout << ans << endl;
	return 0;
}


#include<stdio.h>

int main ()
{

    int n, k, m, i, t ;

    while (scanf("%d %d %d", &n, &k, &m)){

    i = k/n;
    t = m/n;

    if(i >= 1 && t >= 1)

       printf("Yes");

    else

       printf("No");

    }

    return 0;

}


#include<bits/stdc++.h>
using namespace std ;
#define Fors(n) for(int i=1;i<=n;i++)
#define For(n) for(i=0;i<n;i++)
#define ll long long
#define vint(s) vector<int> s
#define pb(x)  push_back(x)
#define mpair(x,y) make_pair(x,y)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll x=0,y=0,s=0,n=0,i=0;

int main(){
    IOS;
    ll a,b,c;
    cin >>a >> b >>c;
    x = min(a/3, min (b/2,c/2));
    a -= (3*x);
    b -= (2*x);
    c -= (2*x);
    //cout << x << " LL "<< endl;
    vector<ll> v;
    //cout << a+b+c << endl;
    ll z = a+b+c;
    for (i = 0;i < (z); i++){
    	//cout << (i%7) << " :: ";
    	if (i%7== 0 || i%7 == 3  || i%7==6){
    		if (a > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			a--;
    		}
    		else{
    			ll c1 = 0;
    			v.pb(c1);
    		}
    	}
    	else if (i%7== 1 || i%7 ==5){
    		if (b > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			b--;
    		}
    		else{
    			ll c1= 0;
    			v.pb(c1);
    		}
    	}
    	else if (i%7== 2 || i%7 == 4 ){
    		if (c > 0){
    			ll c1 = 1;
    			v.pb(c1);
    			c--;
    		}
    		else{
    			ll c1= 0;
    			v.pb(c1);
    		}
    	}
    	//cout << v[i] << " :: ";
    }
    for (i = 0;i<v.size();i++){
    	//cout << v[i] << " : ";
    	if (v[i] == 1){
    		s += v[i];
    	}
    	else{
    		y = max(s,y);
    		s = 0;
    	}
    }
    y = max(s,y);
    ll ans = (7*x) + y;
    cout << ans << endl;
    return 0;
}


#include<iostream>

using namespace std;

int main (){
    int n;
    cin>>n;
    char nam[8];
    for (int i=0; i<n; i++)
        cin>>nam[i];
    int pos;
    for (int i=0; i<n; i++)
        if (nam[i] != '.'){
            pos = i;
            break;
        }

    if (n == 8)
        cout<<"vaporeon\n";
    else if ( n == 6)
        cout<<"espeon\n";
    else{
        char evs [6][8] = { "flareon", "glaceon", "leafeon", "umbreon", "jolteon", "sylveon" };
        switch (pos){
            case 0:
            case 3:
                for (int i=0; i<6; i++)
                    if (nam[pos] == evs [i][pos]){
                        cout<<evs[i]<<endl;
                        break;
                    }
                break;
            case 1:
                if (nam[pos] == 'l'){
                    for (int i=0; i<2; i++)
                        if (nam[3] == evs [i][3]){
                            cout<<evs[i]<<endl;
                            break;
                        }
                }
                else
                    for (int i=2; i<6; i++)
                        if (nam[pos] == evs [i][pos]){
                            cout<<evs[i]<<endl;
                            break;
                        }
                break;
            case 2:
                if (nam[pos] == 'a'){
                    for (int i=0; i<3; i++)
                        if (nam[pos+1] == evs [i][pos+1]){
                            cout<<evs[i]<<endl;
                            break;
                        }
                }
                else if (nam[pos] == 'l'){
                    for (int i=4; i<6; i++)
                        if (nam[pos+1] == evs [i][pos+1]){
                            cout<<evs[i]<<endl;
                            break;
                        }
                else
                    cout<<"umbreon"<<endl;
                break;
        }
    }
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cmath>
#include <algorithm>
#include<set>
#include<queue>
#include <typeinfo>
#include <deque>
#include <stack>
#include <iomanip>
#include <cstdio>
#include<string.h>

using namespace std;
#define ll long long
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
//int maxel(vector<ll> v,ll x){int l=-11111111; for(int i=0;i<=x;i++){if(v[i]>l){l=v[i];}}return l;}
//int minel(vector<ll> v,ll x){int l=11111111; for(int i=0;i<=x;i++){if(v[i]<l){l=v[i];}}return l;}

int main()
{
	ll k,a,b;cin>>k>>a>>b; ll sum=0;
	while (a>=k||b>=k)
	{
		if(a>=k&&(a>b+2)){a=a-k;sum++;}
		if(b>=k&&(b>a+2)){b=b-k;sum++;}
	}
	if(sum==0){cout<<-1;}
	else {cout<<sum;}

    return 0;
}


#include<bits/stdc++.h>
using namespace std ;
int main(){
    string s1 , s2 , s3 = "" , s4 = "" , s5 ;
    int pos ;
    int pluss = 0 , minuss = 0 , plusss = 0 , minusss = 0 ;
    cin >> s1 >> s2 ;
    s5 = s2 ;
    set<string> s ;
    double probility , res = 0.0  ;
    for(int i = 0 ; i < s1.size() ; ++i){
        if(s1[i] == '+'){
            ++pluss ;
        }else if(s1[i] == '-'){
            ++minuss ;
        }
    }
    for(int i = 0 ; i < s2.size() ; ++i){
        if(s2[i] == '?'){
            s4 += s2[i] ;
        }
    }
    pos = s2.find(s4) ;
    for(int i = 0 ; i < (1 << s1.size()) ; ++i){
        for(int j = 0 ; j < s1.size() ; ++j){
            if(i & (1 << j)){
                s3 += s1[j] ;
            }
        }
        if(s3.size() == s4.size()){
            s2.replace(pos , s4.size() , s3) ;
            s.insert(s2) ;
            s2 = s5 ;
        }
        s3 = "" ;
    }
    for(set<string>::iterator it = s.begin() ; it != s.end() ; ++it){
        s5 = *it ;
        for(int i = 0 ; i < s5.length() ; ++i){
            if(s5[i] == '+'){
                ++plusss ;
            }else{
                ++minusss ;
            }
        }
        if((pluss - minuss) == (plusss - minusss)){
            ++res;
        }
        plusss = 0 ;
        minusss = 0 ;
    }
    cout << fixed << setprecision(11) << res/s.size();
}