#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<random>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=998244353;
int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        a=(1+a)*a/2%mod;
        b=(1+b)*b/2%mod;
        c=(1+c)*c/2%mod;
        ll res=a*b%mod*c%mod;
        cout<<res<<'\n';
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
int nod (int n) {
    int result = ((n <= 1) ? 1 : log10(n) + 1);
    return  result;
}
int npr(int n  , int r){
    int result;
    if (n- r == 0) result  = 2;
    else result = ((n * (n+ 1)) / 2) / ((n - r) * (n - r + 1) / 2);
    return result;
}
int32_t main() {

    int a[3];
    for(int i =0 ;  i < 3 ; i++) cin >> a[i];
    sort(a , a + 3 ,greater<int>());
    cout << a[0] + a[1] <<"\n";

}


#include <bits/stdc++.h>
#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

constexpr ll mod = 1000000007;

ll mpow(ll x, ll n) {
    ll ans = 1; x %= mod;
    while (n != 0) {
        if (n & 1) ans = ans * x % mod;
        x = x * x % mod;
        n = n >> 1;
    }
    return ans;
}

int main() {
    int h, w;
    cin >> h >> w;
    ll k = 0;
    vector<vector<int>> grid(h, vector<int>(w, 0));
    rep(y, h) {
        string s;
        cin >> s;
        rep(x, w) {
            grid[y][x] = s[x] == '.';
            if (grid[y][x]) k++;
        }
    }
    vector<vector<P>> xs(h, vector<P>(w));
    rep(y, h) {
        int l = -1, r = -1;
        rep(x, w) {
            if (!grid[y][x]) {
                l = -1; r = -1;
                continue;
            }
            if (l == -1) {
                l = x;
            }
            if (r == -1) {
                r = x;
            }
            while (r < w && grid[y][r]) {
                r++;
            }
            xs[y][x] = { l, r };
        }
    }
    vector<vector<P>> ys(h, vector<P>(w));
    rep(x, w) {
        int t = -1, b = -1;
        rep(y, h) {
            if (!grid[y][x]) {
                t = -1; b = -1;
                continue;
            }
            if (t == -1) {
                t = y;
            }
            if (b == -1) {
                b = y;
            }
            while (b < h && grid[b][x]) {
                b++;
            }
            ys[y][x] = { t, b };
        }
    }
    //rep(y, h) {
    //    rep(x, w) {
    //        cout << x << "," << y << "," << xs[y][x].first << "," << xs[y][x].second << endl;
    //        cout << "," << ys[y][x].first << "," << ys[y][x].second << endl;
    //    }
    //}
    ll sum = 0;
    rep(y, h) {
        rep(x, w) {
            if (!grid[y][x]) {
                continue;
            }
            ll cy = ys[y][x].second - ys[y][x].first;
            ll cx = xs[y][x].second - xs[y][x].first;
            ll c = cy + cx - 1;
            ll p = k - c;
            ll a = (mpow(2, c) - 1 + mod) % mod;
            a *= mpow(2, p);
            a %= mod;
            sum += a;
            sum %= mod;
        }
    }
    cout << sum << endl;
    return 0;
}

#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << (#x) << " = " << x << endl;
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll mod = 1e9 + 7;

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return (temp*temp) % mod;
    else
        return (((x*temp)%mod)*temp)%mod;
}

/* nCr % mod
ll fact[6*N];
ll inv[6*N],invfac[6*N];
ll mod = 998244353;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}*/

vector<ll> primes;
vector<bool> prime;

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

ll modInverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int Nmax = 2e5 + 6;
const int N = 2005;

string str[N];

int n,m;

ll tot = 0;

ll dp[N][N][4];

ll mem[N][N];

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin >> n >> m;
    for(int i=1;i<=n;i++)
    {
        cin >> str[i];
        str[i] = '%' + str[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(str[i][j] == '.')
            {
                for(int k=0;k<2;k++)
                    dp[i][j][k] = 1;
            }
            else
                continue;
            dp[i][j][0] += dp[i-1][j][0];
            dp[i][j][1] += dp[i][j-1][1];
            mem[i][j] += 1 + dp[i][j-1][1] + dp[i-1][j][0];
        }
    }
    for(int i=n;i>=1;i--)
    {
        for(int j=m;j>=1;j--)
        {
            if(str[i][j] == '.')
            {
                dp[i][j][2] = 1;
                dp[i][j][3] = 1;
            }
            else
                continue;
            dp[i][j][2] += dp[i+1][j][2];
            dp[i][j][3] += dp[i][j+1][3];
            mem[i][j] += dp[i][j+1][3] + dp[i+1][j][2];
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(mem[i][j])
                tot++;
        }
    }
    ll ans = 0;
    ll pow[N*N];
    pow[0] = 1;
    for(int i=1;i<N*N;i++)
    {
        pow[i] = (pow[i-1]*2)%mod;
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(mem[i][j])
            {
                ll two = pow[mem[i][j]];
                two = (two - 1 + mod)%mod;
                ll p = pow[tot-mem[i][j]];
                ans += (two*p)%mod;
                ans %= mod;
            }
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int main() {
	int h = ri();
	int w = ri();
	int x = ri() - 1;
	int y = ri() - 1;
	std::string s[h];
	for (auto &i : s) std::cin >> i;

	int cnt = -3;
	for (int i = x; i < h && s[i][y] != '#'; i++) cnt++;
	for (int i = x; i >= 0 && s[i][y] != '#'; i--) cnt++;
	for (int j = y; j < w && s[x][j] != '#'; j++) cnt++;
	for (int j = y; j >= 0 && s[x][j] != '#'; j--) cnt++;
	printf("%d\n", cnt);
	return 0;
}

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

#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T> using Graph = vector<vector<T>>;
template<typename T> using Spacial = vector<vector<vector<T>>>;
template<typename T> using greater_priority_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr int MOD = 1e9+7;
constexpr int MOD2 = 998244353;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
char interval[2] = {' ', '\n'};

template<typename T> struct is_plural : false_type{};
template<typename T1, typename T2> struct is_plural<pair<T1, T2>> : true_type{};
template<typename T> struct is_plural<vector<T>> : true_type{};
template<typename T> struct is_plural<complex<T>> : true_type{};
template<> struct is_plural<string> : true_type{};

template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second; }
template<typename T> istream &operator>>(istream &is, vector<T> &vec) { for(auto itr = vec.begin(); itr != vec.end(); ++itr) is >> *itr; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { if(vec.empty()) return os; bool pl = is_plural<T>(); os << vec.front(); for(auto itr = ++vec.begin(); itr != vec.end(); ++itr) os << interval[pl] << *itr; return os; }
template<typename T> istream &operator>>(istream &is, complex<T> &x) { T a, b; is >> a >> b; x = complex<T>(a, b); return is; }
template<typename T> ostream &operator<<(ostream &os, const complex<T> &x) { return os << x.real() << ' ' << x.imag(); }

bool CoutYN(bool a, string y = "Yes", string n = "No") { cout << (a ? y : n) << '\n'; return a; }

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

/* -------- <templates end> -------- */

template<typename T>
vector<pair<T, int>> prime_factor(T num) {
  vector<pair<T, int>> ret;
  for(T i=2; i*i<=num; ++i) {
    int cnt = 0;
    while(num%i == 0) {
      num /= i;
      ++cnt;
    }
    if(cnt != 0) ret.emplace_back(i, cnt);
  }
  if(num != 1) ret.emplace_back(num, 1);
  return ret;
}

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

  vector<int> ans; ans.reserve(n);

  for(int i=1; i<=n; ++i) {
    auto pf = prime_factor(i);
    int x = 0;
    for(auto &[p, c] : pf) {
      chmax(x, ans[i / p - 1]);
    }
    ans.emplace_back(x + 1);
  }

  cout << ans << endl;
}

/* -------- <programs end> -------- */

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


#include<iostream>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
#define PI 3.1415926535898
const int mm=1e7+10;
double arr[mm];
int main()
{
	int n;
	cin>>n;
	int maxx=-1;
	int minn=1e9;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		maxx=max(a,maxx);
	}
	for(int i=i;i<=n;i++)
	{
		int b;
		cin>>b;
		minn=min(b,minn);
	}
	if(minn<maxx)
	cout<<0<<endl;
	else
	cout<<minn-maxx+1<<endl;
 }

#include<iostream>
using namespace std;
#include<bits/stdc++.h>
typedef long long int ll;
int main(){
  ll n;cin>>n;
  ll arr[n];
  ll cnt=n*(n-1)/2;map<ll,ll>mp;
  for(int i=0;i<n;i++){
    cin>>arr[i];
    mp[arr[i]]++;
  }
  for(auto it=mp.begin();it!=mp.end();it++){
    ll c=it->second*(it->second-1)/2;
    cnt-=c;
  }
  cout<<cnt<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
const ll INF = 1LL<<60;

int main(){
  ll diri[4]={0,1,0,-1};
  ll dirj[4]={1,0,-1,0};

  ll H,W;
  cin>>H>>W;
  char a[H][W];
  pair<ll,ll> goal;
  queue<pair<ll,ll>> que;
  vector<vector<ll>> dist(H,vector<ll>(W,-1));
  vector<vector<pair<ll,ll>>> warp(26,vector<pair<ll,ll>>(0,make_pair(0,0)));
rep(i,H){
  rep(j,W){
    cin>>a[i][j];
    if(a[i][j]=='S'){que.push(make_pair(i,j));dist[i][j]=0;}
    if(a[i][j]=='G'){goal=make_pair(i,j);}
    if(0<=a[i][j]-'a'&&a[i][j]-'a'<26){warp[a[i][j]-'a'].push_back(make_pair(i,j));}
  }
}

 // ll ans=0;
  vector<ll> distwarp(26,-1);
  while(!que.empty()){
    if(dist[goal.first][goal.second]>0)break;
    ll ni=que.front().first;
    ll nj=que.front().second;
    que.pop();
    rep(i,4){
      if(diri[i]+ni<0||diri[i]+ni>=H||dirj[i]+nj<0||dirj[i]+nj>=W)continue;
	  if(a[diri[i]+ni][dirj[i]+nj]=='#')continue;
      if(dist[diri[i]+ni][dirj[i]+nj]<0){
        dist[diri[i]+ni][dirj[i]+nj]=dist[ni][nj]+1;
        que.push(make_pair(diri[i]+ni,dirj[i]+nj));
      }
    }

    if(0<=a[ni][nj]-'a'&&a[ni][nj]-'a'<26){
      if(distwarp[a[ni][nj]-'a']==0)continue;
      distwarp[a[ni][nj]-'a']=0;
      rep(i,(ll)warp[a[ni][nj]-'a'].size()){
        ll warpi=warp[a[ni][nj]-'a'][i].first;
        ll warpj=warp[a[ni][nj]-'a'][i].second;
        if(dist[warpi][warpj]<0){
        dist[warpi][warpj]=dist[ni][nj]+1;
        que.push(make_pair(warpi,warpj));
        }
      }
    }
  }

  ll ans=dist[goal.first][goal.second];
  cout<<ans<<endl;
}

//debug icin gdb kullanmayi dene
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef long long int lint;
typedef unsigned long long int ulint;
lint fastpow(lint tab,lint us){
	if(tab==0) return 0;
	if(tab==1) return 1;
	if(us==0) return 1;
	if(us==1) return tab%mods;
	tab%=mods;
	if(us%2==1) return tab*fastpow(tab,us-1)%mods;
	lint a=fastpow(tab,us/2)%mods;
	return a*a%mods;
}
lint h,w,t=1;
char mat[2020][2020];
bool visited[2020][2020],visited2[35];
vector<pair<lint,lint> > dizi[35];
pair<lint,lint> s,g;
void solve(){
	lint i,j,k;
	char a;
	for(i=0;i<2020;i++) for(j=0;j<2020;j++) mat[i][j]='#';
	cin>>h>>w;
	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++){
			cin>>a;
			mat[i][j]=a;
			if(a=='S') s=mp(i,j);
			else if(a=='G') g=mp(i,j);
			else if(a>='a' and a<='z') dizi[a-'a'].pb(mp(i,j));
		}
	}
	queue<pair<lint,pair<lint,lint> > > sira;
	if(mat[s.st][s.nd+1]!='#') sira.push(mp(1,mp(s.st,s.nd+1)));
	if(mat[s.st][s.nd-1]!='#') sira.push(mp(1,mp(s.st,s.nd-1)));
	if(mat[s.st+1][s.nd]!='#') sira.push(mp(1,mp(s.st+1,s.nd)));
	if(mat[s.st-1][s.nd]!='#') sira.push(mp(1,mp(s.st-1,s.nd)));
	visited[s.st][s.nd]=1;
	while(!sira.empty()){
		pair<lint,pair<lint,lint> > te=sira.front();
		sira.pop();
		lint x=te.nd.st,y=te.nd.nd;
		if(visited[x][y])continue;
		visited[x][y]=1;
		if(mat[x][y]=='G'){cout<<te.st<<endl; return;}
		if(mat[x][y]>='a' and mat[x][y]<='z' and visited2[mat[x][y]-'a']==0){
			for(i=0;i<dizi[mat[x][y]-'a'].size();i++){
				if(dizi[mat[x][y]-'a'][i].st!=x or dizi[mat[x][y]-'a'][i].nd!=y){
					sira.push(mp(te.st+1,mp(dizi[mat[x][y]-'a'][i].st,dizi[mat[x][y]-'a'][i].nd)));
				}
			}
			visited2[mat[x][y]-'a']=1;
		}
		if(!visited[x][y+1] and mat[x][y+1]!='#') sira.push(mp(te.st+1,mp(x,y+1)));
		if(!visited[x][y-1] and mat[x][y-1]!='#') sira.push(mp(te.st+1,mp(x,y-1)));
		if(!visited[x+1][y] and mat[x+1][y]!='#') sira.push(mp(te.st+1,mp(x+1,y)));
		if(!visited[x-1][y] and mat[x-1][y]!='#') sira.push(mp(te.st+1,mp(x-1,y)));
	}
	cout<<-1<<endl;

	return;
}

int main(){
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//	cin>>t;
	while(t--) solve();
	return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD
#define MODSUB(SUB_X,SUB_Y)  ((SUB_X-SUB_Y)+MOD)%MOD
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD
#define LCM(LCM_X,LCM_Y) (LCM_X/__gcd(LCM_X,LCM_Y))*LCM_Y
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int ans,k,n,cost[60][60];
void recur(int cur,int sum,int tot,int used[])
{
    if(tot==(n-1))
    {
        sum+=cost[cur][1];
        if(k==sum)
            ans++;
        return ;
    }
    for(int i=2; i<=n; i++)
    {
        if(!used[i])
        {
            used[i]=1;
            recur(i,sum+cost[cur][i],tot+1,used);
            used[i]=0;
        }
    }
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n>>k;
    for(int i=1; i<=n; i++)
        for(int j=1; j<=n; j++)
            cin>>cost[i][j];
    int used[50]= {0};
    recur(1,0,0,used);
    cout<<ans<<endl;

    return 0;
}

#include<iostream>
#include<vector>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

const int maxN=10;
vector<vector<int>> T(maxN, vector<int> (maxN, -1));
bool used[maxN];
vector<int> v={0};
int N,K;

int dfs(){
    if(v.size()==N){
        v.push_back(0);
        int sum=0;
        rep(i, N){
            sum += T[v[i]][v[i+1]];
        }
        /*
        rep(i,N+1){
            cout << v[i] << ' ';
        }
        cout << endl;

        cout << sum << endl;
        */
        v.pop_back();

        if(sum==K) return 1;
        else return 0;
    }

    int res=0;
    for(int i=1;i<=N-1;i++){
        if(!used[i]){
            v.push_back(i);
            used[i]=true;
            res += dfs();
            used[i]=false;
            v.pop_back();

        }
    }
    return res;
}

int main(){
    cin >> N >> K;
    rep(i,N)rep(j,N) cin >> T[i][j];
    rep(i,N) used[i]=false;

    int res = dfs();

    cout << res << endl;
    return 0;

}


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

typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pii pair<int , int>
#define pb emplace_back
const int MAXX = 1e5 + 5;

int b , c ;

signed main()
{
    _FastIO;
    cin >> b >> c;
    long long ans = 0;
    if(b && c == 1){
        cout << "2" << endl;
        return 0;
    }
    if(!b){
        cout << c << endl;
        return 0;
    }
    if(b > 0){
    int cnt = 0;
    b *= (-1);
    c--;
    cnt = 1;
    while(cnt){
    int x = c / 2;
    int y = b - x;
    ans += 2 * x + 2;
    if(b >= 0 && y <= 0){
        ans--;
    }
    if(c % 2 == 0 && y){
        ans--;
    }
    cnt = 0;
}
    b *= (-1);
    c++;
    while(!cnt){
        int x = c / 2;
    int y = b - x;
    bool f = true;
    if(y <= 0){
        y = 0;
         f = false;
    }
    x = b - y - 1;
    ans += (2 * x + 2);
    if(b >= 0 && y <= 0){
        ans--;
    }
    if(c % 2 == 0 && y && f){
        ans--;
    }
    cnt = 1;
    }
    cout << ans << endl;
    }
    if(b <= 0){

    int cnt = 0;
    b *= (-1);
    c--;
    cnt = 1;
    while(cnt){
    int x = c / 2;
    int y = b - x;

    bool f = true;
    if(y <= 0){
        y = 0;
         f = false;
    }
    x = b - y - 1;
    ans += 2 * x + 2;
    if(b >= 0 && y <= 0){
        ans--;
    }
    if(c % 2 == 0 && y && f ){
        ans--;
    }
    cnt = 0;
}
    b *= (-1);
    c++;
    while(!cnt){
        int x = c / 2;
    int y = b - x;
    ans += (2 * x + 2);
    if(b >= 0 && y <= 0){
        ans--;
    }
    if(c % 2 == 0 && y){
        ans--;
    }
    cnt = 1;
    }
    cout << ans << endl;
    }
    return 0;
}

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

const int N = 200005;

typedef pair<long long, long long> pll;

long long b, c;

int solve() {
  scanf("%lld %lld", &b, &c);

  long long ans = 0;
  pll range1 = {b - c/2, b + max(0LL, c - 2) / 2};
  pll range2 = {-b - (c - 1) / 2, -b + (c - 1) / 2};

  // cerr << range1.first << " " << range1.second << endl;
  // cerr << range2.first << " " << range2.second << endl;

  if (max(range1.first, range2.first) <= min(range1.second, range2.second)) ans = max(range1.second, range2.second) - min(range1.first, range2.first) + 1;
  else ans = range1.second - range1.first + 1 + range2.second - range2.first + 1;

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

  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    solve();
  }
  return 0;
}


#include<bits/stdc++.h>

#define ll long long int

#define rep(x,start,end) for(auto x=start;x!=end;x++)

using namespace std;
ll A,B,C;
void atcoder()
{

  cin>>A>>B>>C;
}
char eq(ll A, ll B)
{
    if (A < B)
    {
        return '<';
    }
    else if (A > B)
    {
        return '>';
    }
    return '=';
}

char solve()
{
    if (C % 2)
    {
        return eq(A, B);
    }
    else
    {
        return eq(abs(A), abs(B));
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(0);
    cin.exceptions(ios::badbit|ios::failbit);

    //ll Test_Cases;
   // cin>>Test_Cases;

   // rep(i,0,Test_Cases)
    atcoder();
    char ans=solve();
    cout<<ans<<"\n";

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define frfr  freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
#define endl "\n"
#define loop(i,n) for(int i=0;i<n;i++)
#define ll long long int

void solve(){
	int a , b ,c;
	cin >> a >> b >> c;
	if(c%2 == 0){
		if( abs(a) > abs(b)){
		  cout << ">" << endl;
	    }else if( abs(a) < abs(b)){
		  cout << "<" << endl;
		}else {
			cout << "=" << endl;
		}
		return;
	}
	if( a > b){
		cout << ">" << endl;
	}else if( a < b){
		cout << "<" << endl;
	}else cout << "=" << endl;

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


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

#define IOS         ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll            long long
#define t()           int t;cin>>t;while(t--)
#define lt()          long long int t;cin>>t;while(t--)
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define all(x)              begin(x),end(x)
#define  nik(i,k,n)    for ( long long int i = k; i < (n); ++i)

void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
ll gcd(ll A , ll B)
{
  if(B == 0)return A;
  return gcd(B , A%B);
}
ll fact(ll n){
   ll ans = 1;
   for(ll i=1;i<=n;i++){
      ans*=i%mod;
   }
   return ans%mod;
}

bool checkperfectsquare(int n)
{
    if (ceil((double)sqrt(n)) == floor((double)sqrt(n))) {
        return true;
    }
    return false;
}

bool isPowerOfTwo(ll n)
{
    if (n == 0)
        return 0;
    while (n != 1)
    {
        if (n%2 != 0)
            return 0;
        n = n/2;
    }
    return 1;
}

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

char s[500005];

void solve()
{
  string s;
  cin >> s;
  int filled = 0 , no = 0 , ques= 0;
  for(auto X : s){
      if(X == 'o')filled++;
      else if( X == 'x')no++;
      else ques++;
  }

  if( filled > 4 ){
      cout << 0 << endl;
      return;
  }
  if( filled == 0){
      cout << ques*ques*ques*ques << endl;
      return;
  }
  if(filled == 4){
      cout << 24 << endl;
      return;
  }
  if(filled == 3){
      cout << ques*24 + 3* 12 << endl;
      return;
  }
  if(filled == 2){
      cout << 12*ques*ques + 4*3*2*ques + (4*2 + 6) << endl;
      return;

  }
  if(filled == 1){
      cout << ques*ques*ques*4 + ques*ques*6 + ques*4 + 1 << endl;
      return;

  }

}
int32_t main()
{
   IOS;
   //lt(){
      solve();
   //}
   return 0;
}

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

int main() {

  string S;
  cin >> S;

  int N=10;
  int counter = 0;
  int maru_num = 0;
  int hatena_num = 0;

  for (int i = 0; i < N; i++) {
    if( S[i] == 'o' ){
      maru_num++;
    }
    if( S[i] == '?' ){
      hatena_num++;
    }
  }

  for (int i = 0; i < maru_num + hatena_num; i++) {
    for (int j = 0; j < maru_num + hatena_num; j++) {
      for (int k = 0; k < maru_num + hatena_num; k++) {
        for (int l = 0; l < maru_num + hatena_num; l++) {
          int check = 1;
          for(int m = 0; m < maru_num; m++){
            if( i == m || j == m || k == m || l == m){
              check *= 1;
            }else{
              check *= 0;
            }
          }
          if(check == 1){
            counter++;
          }
        }
      }
    }
  }

  cout << counter << endl;

}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n]={0};

    int check[200]={0};
    long long ans=0;

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

        if(check[a[i]%200]!=0)
        ans+=check[a[i]%200];

        check[a[i]%200]++;

    }

    cout<<ans;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int dp[101][100001];
void solve() {
    cin >> n;
    a.resize(n);
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    for(int i = 0; i <= n; i++)
        dp[i][0] = 1;
    for(int i = 0; i < n; i++) {
        for(int j = 1; j < 100001; j++) {
            dp[i + 1][j] |= dp[i][j];
            if(j - a[i] >= 0)
                dp[i + 1][j] |= dp[i][j - a[i]];
        }
    }
    int ans = 0;
    for(int i = 0 ;i <= (sum) / 2; i++) {
        if(dp[n][i])
            ans = i;
    }
    cout << sum - ans << '\n';
}
int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

int main() {
  int n, m, k;
  int N[100] = {0};
  pair<int, int> K[17], M[101];

  function<int(int)> rec = [&](int i) {
    if (i == k) {
      int cnt = 0;
      for (int j = 0; j < m; ++j) {
        auto[f, s] = M[j];
        if (N[f] && N[s]) cnt++;
      }
      return cnt;
    }

    auto[f, s] = K[i];
    N[f]++;
    int sum1 = rec(i + 1);
    N[f]--;
    N[s]++;
    int sum2 = rec(i + 1);
    N[s]--;
    return max(sum1, sum2);
  };

  cin >> n >> m;
  for (int i = 0; i < m; ++i)
    cin >> M[i].first >> M[i].second;
  cin >> k;
  for (int i = 0; i < k; ++i)
    cin >> K[i].first >> K[i].second;
  cout << rec(0) << endl;
}

#include<bits/stdc++.h>
#define SORT(v) sort(v.rbegin() , v.rend())
#define si(n) scanf( "%d" , &n)
#define sii(n , m) scanf( "%d %d" , &n , &m)
#define sl(n) scanf( "%lld" , &n)
#define sll(n , m) scanf( "%lld %lld" , &n, &m)
#define ss(cad) scanf( "%s" , cad)
#define sz(x) (int)x.size()
#define PB push_back
#define fst first
#define scn second
#define DBG(x) cerr << #x << " = " << (x) << endl
#define N_MAX 1000010
#define M 1000000007
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pi> vp;

pi vec[110];
pi per[110];
bool has[110];

int main(){
	int n, m;
	sii(n, m);
	for(int i = 0; i < m; i++){
		sii(vec[i].fst, vec[i].scn);
	}
	int k;
	si(k);
	for(int i = 0; i < k; i++)
		sii(per[i].fst, per[i].scn);
	int ans = 0;
	for(int mask = 0; mask < (1<<k); mask++){
		memset(has, 0, sizeof(has));
		for(int i = 0; i < k; i++)
			if(mask&(1<<i))
				has[per[i].fst] = 1;
			else
				has[per[i].scn] = 1;
		int tmp = 0;
		for(int i = 0; i < m; i++)
			if(has[vec[i].fst] && has[vec[i].scn])
				tmp++;
		ans = max(ans, tmp);
	}
	printf("%d\n", ans);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, m, k, a, cnt;
bool f[100005];
complex<double> p[100005];
int main(){
	scanf("%d%d%d", &n, &m, &k);
	rep(i,k){
		scanf("%d", &a);
		f[a] = true;
	}
	for(int i=n-1; i>=0; i--){
		if(f[i]){
			cnt++;
			if(cnt >= m) return 0 * puts("-1");
			p[i] = 1;
		}else{
			p[i] = p[i+1+cnt] * (double)(m+1) + (double)cnt;
			for(int j=i+m+1; j <= i+m+1+cnt && j < n; j++) p[i] -= p[j];
			p[i] /= m;
			if(i+1+cnt == n) p[i] += 1i;
			cnt = 0;
		}
	}
	printf("%f\n", p[0].imag() / (1 - p[0].real()));
}


#include <iostream>
using namespace std;

int main() {

  int n, x;
  cin >> n >> x;

  int a = 0;
  int b = -1;

  for(int i = 1; i < n + 1; i++) {

    int v, p;
    cin >> v >> p;

    a += v * p / 100;

    if(a > x) {
      b = i;
      i = n;
    }

    if((n == 1) and (x == 0) and (v == 1) and (p == 1)) {
      b = 1;
    }
  }

  cout << b;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
vector<int > G[25];
vector<int > V;
vector<int > P;
int a[105],vis[105];
long long ans=0;
bool check(int u,int c){
	for(int i=0;i<G[u].size();i++){
		if (a[G[u][i]] == c) return false ;
	}
	return true ;
}
void BFS(int u){
	V.clear();
	queue<int> q;
	q.push(u);
	vis[u]=1;
	while (!q.empty()){
		int v=q.front();q.pop();
		V.push_back(v);
	//	for(int i=0;i<V.size();i++){
	//		cout << V[i] <<" ";
	//	}
	//	cout << endl ;
		for(int i=0;i<G[v].size();i++){
			int s=G[v][i];
			if (vis[s]==1) continue ;
			vis[s]=1;
			q.push(s);
		}
	}
}
void DFS(int d){
	//for(int i=1;i<=3;i++){
	//	cout << a[i] <<" ";
	//}
	//cout << endl;
	if (d>=V.size()) {
		ans ++ ;
		return ;
	}
	int u=V[d];
	for(int i=1;i<=3;i++){
		if (!check(u,i)) continue ;
		//cout << "a[u] = " << a[u] <<endl ;
		a[u]=i;
	//	cout << "u = " << u <<" "<<"i = "<< i <<endl ;
		DFS(d+1);
		a[u]=0;
	}
}
int main() {
	memset(vis,0,sizeof(vis));
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		int u,v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i=1;i<=n;i++){
		if (vis[i]==1) continue ;
		BFS(i);
		//cout << "i = " << i;
		ans=0;
		memset(a,0,sizeof(a));
		DFS(0);P.push_back(ans);
	}
	ans=1;
	for(int i=0;i<P.size();i++){
		ans*=P[i];
		//cout << P[i] <<endl ;
	}
	cout << ans <<endl ;
}


#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define sz(s) (int)(s.size())
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
#else
	//freopen("groups.in", "r", stdin);
#endif
}

const int N = 2009;
vector<int> adj[N];
bitset<N> vis;
void dfs(int node) {
	vis[node] = true;
	for (int ch : adj[node])
		if (!vis[ch])
			dfs(ch);
}
int main() {
	run();
	int n, m;
	cin >> n >> m;
	while (m--) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
	}
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		vis = bitset<N>();
		dfs(i);
		cnt += vis.count();
	}
	cout << cnt << endl;
}

/*** keep hungry and calm CoolGuang!  ***/
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#include<stdio.h>
#include<queue>
#include<algorithm>
#include<string.h>
#include<iostream>
#define debug(x) cout<<#x<<":"<<x<<endl;
#define dl(x) printf("%lld\n",x);
#define di(x) printf("%d\n",x);
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const ll INF= 1e18+7;
const ll maxn = 1e6+700;
const ll mod= 100003;
const double eps = 1e-9;
const double PI = acos(-1);
template<typename T>inline void read(T &a){char c=getchar();T x=0,f=1;while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<1)+(x<<3)+c-'0';c=getchar();}a=f*x;}
ll n,m,p;
struct Matrix{
    int sz;
    ll a[3][3];
    void clr(int x){
        sz = x;
        for(int k=0;k<sz;k++)
            for(int i=0;i<sz;i++)
                a[i][k] = 0;
    }
    Matrix operator*(const Matrix b) const{
        Matrix res;
        res.clr(sz);
        for(int i=0;i<sz;i++){
            for(int j=0;j<sz;j++){
                for(int k=0;k<sz;k++){
                    res.a[i][j] += (b.a[i][k]*a[k][j]);
                }
            }
        }
        return res;
    }
    Matrix operator*=(const Matrix b){
        return *this = *this*b;
    }
    Matrix operator^(ll b){
        Matrix ans;ans.clr(sz);
        for(int i=0;i<ans.sz;i++) ans.a[i][i] = 1;
        while(b){
            if(b&1) ans *= *this;
            b/=2;*this *= *this;
        }return ans;
    }
}q[maxn],num[maxn],a1,a2,a3,a4;
void down(int k){
	q[k<<1] *= q[k];
	q[k<<1|1] *= q[k];
	q[k].clr(3);
	for(int j=0;j<3;j++) q[k].a[j][j] = 1;
}
void build(int k,int l,int r){
	q[k].clr(3);
	for(int j=0;j<3;j++) q[k].a[j][j] = 1;
	if(l == r) return;
	int mid = (l+r)/2;
	build(k<<1,l,mid);
	build(k<<1,mid+1,r);
}

Matrix Query(int k,int l,int r,int pos){
	if(l == r) return q[k];
	down(k);
	int mid = (l+r)/2;
	if(pos <= mid) return Query(k<<1,l,mid,pos);
	return Query(k<<1|1,mid+1,r,pos);
}
vector< pair<int,int> >v[maxn];

struct node{
	int x,y;
}qr[maxn];

pair<ll,ll>res[maxn];

int main(){
	a1.a[0][0] = 0;a1.a[0][1] = 1;a1.a[0][2] = 0;
	a1.a[1][0] = -1;a1.a[1][1] = 0;a1.a[1][2] = 0;
	a1.a[2][0] = 0;a1.a[2][1] = 0;a1.a[2][2] = 1;

	a2.a[0][0] = 0;a2.a[0][1] = -1;a2.a[0][2] = 0;
	a2.a[1][0] = 1;a2.a[1][1] = 0;a2.a[1][2] = 0;
	a2.a[2][0] = 0;a2.a[2][1] = 0;a2.a[2][2] = 1;

	a3.a[0][0] = -1;a3.a[0][1] = 0;a3.a[0][2] = 0;
	a3.a[1][0] = 0;a3.a[1][1] = 1;a3.a[1][2] = 0;
	a3.a[2][0] = 0;a3.a[2][1] = 0;a3.a[2][2] = 1;

	a4.a[0][0] = 1;a4.a[0][1] = 0;a4.a[0][2] = 0;
	a4.a[1][0] = 0;a4.a[1][1] = -1;a4.a[1][2] = 0;
	a4.a[2][0] = 0;a4.a[2][1] = 0;a4.a[2][2] = 1;
	read(n);
	for(int i=1;i<=n;i++){
		num[i].clr(3);
		read(num[i].a[0][0]);
		read(num[i].a[1][0]);
		num[i].a[2][0] = 1;
	}
	read(m);
	for(int i=1;i<=m;i++){
		read(qr[i].x);
		if(qr[i].x>2) read(qr[i].y);
	}
	read(p);
	for(int i=1;i<=p;i++){
		int x,y;read(x);read(y);
		v[x].push_back({y,i});
	}
	build(1,1,n);
	for(int k=0;k<=m;k++){
		if(k){
			if(qr[k].x == 1) q[1] *= a1;
			else if(qr[k].x == 2) q[1] *= a2;
			else if(qr[k].x == 3){
				a3.a[0][2] = 2*qr[k].y;
				q[1] *= a3;
			}else{
				a4.a[1][2] = 2*qr[k].y;
				q[1] *= a4;
			}
		}
		for(auto x:v[k]){
			//debug(x.first);
			Matrix tt = num[x.first]*q[1];
			res[x.second] = {tt.a[0][0],tt.a[1][0]};
		}

	}
	for(int i=1;i<=p;i++)
		printf("%lld %lld\n",res[i].first,res[i].second);
    return 0;

}
/***
10
0 1 0 1 0 1 0 1 0 1
4
1 3
1 4
2 3n
2 7
***/


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define rng(v) v.begin(),v.end()
#define rngr(v) v.rbegin(),v.rend()
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using P3 = tuple<int, int, int>;
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vs vector<string>
using vp = vector<P>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using CP = complex<double>;
double dot( const CP &z, const CP &w ){ return (z.real()*w.real() + z.imag()*w.imag()); }
double cross( const CP &z, const CP &w ){ return (z.real()*w.imag() - z.imag()*w.real()); }
int main()
{
    int n;
    string s;
    int q;
    cin >> n >> s >> q;
    bool rev = false;
    auto id = [&](int i){
        if(i < n) return i+n;
        else return i-n;
    };
    while(q--){
        int t, a, b;
        cin >> t >> a >> b;
        --a;--b;
        if(t==1){
            if(!rev) swap(s[a], s[b]);
            else {
                swap(s[id(a)], s[id(b)]);
            }
        }else{
            // string x = s.substr(0, n);
            // string y = s.substr(n);
            // s = y+x;
            rev = !rev;
        }
    }
    if(rev) {
        string x = s.substr(0, n);
        string y = s.substr(n);
        s = y+x;
    }
    cout << s << endl;
    return 0;
}

// URL
#include <iostream>
#include <string>
using namespace std;

#define loop(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define pb push_back
#define sz size
#define rsz resize
typedef long long LL;
const char NL = '\n';
const char SP = ' ';
const char HB[] = "HOBA";
const LL llinf = 9e18;
const int iinf = 2e9;

int main() {
  ios_base::sync_with_stdio(false);
  int n, q;
  cin >> n;
  string s;
  cin >> s >> q;
  string p1(s.begin(), s.begin() + n), p2(s.begin() + n, s.end());
  bool left_in_p1 = true;
  loop (j, 0, q) {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 2) {
      left_in_p1 = !left_in_p1;
    }
    else {
      a--;
      b--;
      if (a < n && b < n) {
        if (left_in_p1) {
          swap(p1[a], p1[b]);
        }
        else {
          swap(p2[a], p2[b]);
        }
      }
      else if (a < n && b >= n) {
        if (left_in_p1) {
          swap(p1[a], p2[b % n]);
        }
        else {
          swap(p2[a], p1[b % n]);
        }
      }
      else if (a >= n && b >= n) {
        a %= n;
        b %= n;
        if (left_in_p1) {
          swap(p2[a], p2[b]);
        }
        else {
          swap(p1[a], p1[b]);
        }
      }
    }
  }
  if (left_in_p1) {
    cout << p1 << p2 << NL;
  }
  else {
    cout << p2 << p1 << NL;
  }
  return 0;
}
/*
SAMPLE
*/


#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"

long long gcd(long long a, long long b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}
long long lcm(long long x, long long y) {
	return x * y / gcd(x, y);
}
unordered_map<int, int>mp;
//約数列挙
void calc(const int &N) {
	for (int i = 1; i <= sqrt(N); i++) {
		if (0 == N % i) {
			mp[i] = gcd(mp[i], N);
			if (N != i * i) {
				mp[N / i] = gcd(mp[N / i], N);
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int minA = 1e9;
	rep(i, N) {
		minA = min(minA, A[i]);
	}
	rep(i, N) {
		calc(A[i]);
	}
	int ans = 0;
	for (auto p : mp) {
		if ((p.first <= minA) && (p.first == p.second)) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
#define N 200005
using namespace std;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return x*f;
}
int n,a[N],maxn=0x3f3f3f3f;
map<int,int>f;
map<int,int>::iterator it;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),maxn=min(maxn,a[i]);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j*j<=a[i]&&j<maxn;j++)
		{
			if(a[i]%j==0)
			{
				if(f[j]==0)f[j]=a[i];
				else f[j]=__gcd(f[j],a[i]);
				if(a[i]/j<maxn)
				{
					int x=a[i]/j;
					if(f[x]==0)f[x]=a[i];
					else f[x]=__gcd(f[x],a[i]);
				}
			}
		}
	}
	int ans=0;
	for(it=f.begin();it!=f.end();it++)
	{
		ans+=(it->first==it->second);
	}
	printf("%d\n",ans+1);
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <fstream>
#include <numeric>
#include <tuple>
#include <ctime>
#include <random>
#include <array>
#include <cassert>

using namespace std;

#define fori(t) for(int i = 0; i < t; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define forai(a) for(auto& i : a)
#define foraj(a) for(auto& j : a)
#define forak(a) for(auto& k : a)
#define forp(s, n, d) for(int p = s; p < n; p += d)
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define pb(a) push_back(a);
#define pob(a) pop_back(a);
#define sorti(a) sort((a).begin(), (a).end());
#define sortm(a, n) sort(a, a + n);
#define reversi(a) reverse((a).begin(), (a).end());
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
#define yes cout << "Yes\n";
#define no cout << "No\n";
#define ans(a) cout << a << '\n';
#define endl '\n'
#define res(a, n) (a).resize(n);
#define read(a, n) (a).resize(n); fori(n) cin >> a[i];
#define print(a) for (auto hart : a) cout << hart << ' ';
#define clear(a) (a).clear();
//#define int long long
//#define double long double

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<long long, long long> llll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<int, pair<int, int>>> viii;
typedef pair<int, pair<int, int>> iii;
typedef vector<pair<long long, long long>> vllll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef pair<char, char> cc;
typedef pair<pair<char, char>, char> ccc;
typedef vector<char> vc;
typedef pair<int, char> ic;
typedef pair<ii, char> iic;
typedef vector<bool> vb;
typedef set<int> si;
typedef vector<vector<ii>> vvii;
typedef vector<vector<iii>> vviii;
typedef vector<vector<llll>> vvllll;

const int INF = 2147483647;
const ll LONGINF = 9223372036854775807;
const ll MOD = 1e9 + 7;

void solve()
{
    ll r, x, y;
    cin >> r >> x >> y;
    ll d = x * x + y * y;
    if (sqrtl(d) == round(sqrtl(d)))
    {
        if (d % r == 0)
        {
            ans(int(sqrtl(d)) / r)
            return;
        }
    }
    ll counter = 0;
    while (d > r * r * (2 + counter) * (2 + counter))
    {
        ++counter;
    }
    ans(counter + 2)
}

signed main()
{
    fast
    bool mult = false;
    if (mult)
    {
        int t;
        cin >> t;
        while (t--) solve();
    }
    else solve();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t R, X, Y;
  cin >> R >> X >> Y;
  int64_t D = X*X + Y*Y;
  int64_t ok = 1e7;
  int64_t ng = 0;
  while(ok - ng > 1){
    int64_t mid = (ok+ng)/2;
    int64_t K = mid*R;
    if(K > D/K || (K == D/K && D%K == 0)){
      ok = mid;
    }
    else{
      ng = mid;
    }
  }
  if(ok == 1 && D != R*R){
    ok = 2;
  }
  cout << ok << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pl = pair<ll, ll>;
using Vs = vector<string>;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;//10の18乗
#define yn {puts("Yes");}else{puts("No");}
#define dame { puts("-1"); return 0;}

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    if(a*a+b*b<c*c) yn;
}

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

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

const int IM = 2e9;
int dat[400004];

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

	int N;
	cin >> N;
	dat[0] = -IM;
	ll kotae = -IM * ll(N);
	for (int i = N + 1; i > 1; i--) {
		cin >> dat[i];
		kotae += dat[i];
	}

	for (int i = 2; i < N + 2; i++) {

		int p = i - 1;
		int v = dat[i] - IM;
		while (v < dat[p >> 1]) dat[p] = dat[p >> 1], p >>= 1;
		dat[p] = v;

		int a;
		cin >> a;
		kotae += a;
		p = i;
		v = a - IM;
		while (v < dat[p >> 1]) dat[p] = dat[p >> 1], p >>= 1;
		dat[p] = v;

		kotae -= dat[1];
		v = dat[i];
		dat[i] = IM;
		p = 2 + (dat[2] > dat[3]);
		while (v > dat[p]) {
			dat[p >> 1] = dat[p];
			p <<= 1;
			p += dat[p] > dat[p + 1];
		}
		dat[p >> 1] = v;
	}

	co(kotae);

	Would you please return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};

void solve(int tc){
	string a;
	cin >> a;
	string b = "";
	b += a[1];
	b += a[2];
	b += a[0];
	cout << b;
}

int main(void){
	/*
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	*/
	int tc = 1;
	/*
		cin >> tc;
	*/
	for(int test_number=1;test_number<=tc;test_number++){
		solve(test_number);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void){

    string S;
    cin >> S;

    swap(S[0], S[2]);
    swap(S[0], S[1]);

    cout << S << endl;

}


#include <bits/stdc++.h>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
#define MOD 1000000007
#define PI acos(-1)
#define INF = 1001001001;
using namespace std;
using Graph = vector<vector<long long>>;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    vector<int> abc(3);
    rep(i, 3) cin >> abc[i];
    sort(all(abc));
    cout << abc[2] + abc[1] << endl;
    return 0;
}

//#define LOCAL
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define sz(a) (int)a.size()
#define INF 0x3f3f3f3f
#define DNF 0x7f7f7f7f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define PiL pair <ll , ll>
#define PLL pair <ll , ll>
#define pii pair <int , int>
#define mk(a, b) make_pair(a,b)
#define pb push_back
#define LF putchar('\n')
#define SP putchar(' ')
#define p_queue priority_queue
#define CLOSE ios::sync_with_stdio(0); cin.tie(0)

template<typename T>
void read(T &x) {x = 0;char ch = getchar();ll f = 1;while(!isdigit(ch)){if(ch == '-')f *= -1;ch = getchar();}while(isdigit(ch)){x = x * 10 + ch - 48; ch = getchar();}x *= f;}
template<typename T, typename... Args>
void read(T &first, Args& ... args) {read(first);read(args...);}
template<typename T>
void write(T arg) {T x = arg;if(x < 0) {putchar('-'); x =- x;}if(x > 9) {write(x / 10);}putchar(x % 10 + '0');}
template<typename T, typename ... Ts>
void write(T arg, Ts ... args) {write(arg);if(sizeof...(args) != 0) {putchar(' ');write(args ...);}}

using namespace std;

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

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

const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n, m, T;
ll a[N], sum[N], maxn[N], sum2[N];
int main()
{
    CLOSE;
    cin >> n;
    for (int i = 1 ;  i <= n ; i ++) cin >> a[i];
    for (int i = 1 ; i <= n ; i ++)
        sum[i] = sum[i-1] + a[i];
    for (int i = 1 ; i <= n ; i ++)
        sum[i] += sum[i-1];
    for (int i = 1 ; i <= n ; i ++) {
        maxn[i] = max(maxn[i - 1], a[i]);
    }
    for (int i = 1 ; i <= n ; i ++)
        cout << (1ll * i * maxn[i] + sum[i]) << endl;

}


#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main(){
    long n,temp,temp1,ans;cin>>n;
    long digit=to_string(n).size();
    if(digit%2==1){
        temp=pow(10,digit/2)-1;
        ans=temp;
    }else{
        temp=n/pow(10,digit/2);
        temp1=n%(long)pow(10,digit/2);
        if(temp>temp1)ans=temp-1;
        else ans=temp;
    }

    cout<<ans<<endl;
}

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

#define ll              long long
#define pb              push_back
#define all(v)          v.begin(),v.end()
#define sz(a)           (ll)a.size()
#define F               first
#define S               second
#define INF             2000000000000000000
#define popcount(x)     __builtin_popcountll(x)
#define pll             pair<ll,ll>
#define pii             pair<int,int>
#define ld              long double

const int M = 1000000007;
const int MM = 998244353;
const long double PI = acos(-1);

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{
    return os<<'('<<p.F<< ","<<p.S<<')';
}

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}

int _runtimeTerror_()
{
    string n;
    cin>>n;
    if(sz(n) <= 1)
    {
        cout<<"0\n";return 0;
    }
    if(sz(n)%2 != 0)
    {
        int u = (sz(n))/2;
        cout<<power(10,u)-1<<"\n";
        return 0;
    }
    ll x = 0;
    string t;
    for(int i=0;i<sz(n)/2;++i)
    {
        x += (n[i]-'0')*power(10,sz(n)/2-i-1);
        t += n[i];
    }
    t += t;
    if(t > n)
        --x;
    cout<<x<<"\n";
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void solve() {
  int n;
  cin >> n;
  vector<int> p(n), pos(n);
  for(int i = 0; i < n; i++) {
    cin >> p[i]; p[i]--;
    pos[p[i]] = i;
  }
  int cur = 0;
  vector<int> ans;
  int op[5] = {2, 1, 2, 1, 2};
  for(int i = 0; i < n; i++) {
    if(pos[i] != i) {
      int cpos = pos[i];
      if(cpos % 2 == cur % 2) {
        if(cpos - 2 == i - 1) {
          for(int j = 0; j < 5; j++) {
            ans.pb(cpos - op[j]); cur++;
            swap(p[cpos - op[j]], p[cpos - op[j] + 1]);
            swap(pos[p[cpos - op[j]]], pos[p[cpos - op[j] + 1]]);
          }
          continue;
        }
        ans.pb(cpos - 2); cur++;
        swap(p[cpos - 2], p[cpos - 1]);
        swap(pos[p[cpos - 2]], pos[p[cpos - 1]]);
        ans.pb(cpos - 1); cur++;
        swap(p[cpos - 1], p[cpos]);
        swap(pos[p[cpos - 1]], pos[p[cpos]]);
        for(int j = cpos - 2; j >= i; j--) {
          swap(p[j], p[j + 1]);
          swap(pos[p[j]], pos[p[j + 1]]);
          ans.pb(j); cur++;
        }
      } else {
        for(int j = cpos - 1; j >= i; j--) {
          ans.pb(j); cur++;
          swap(p[j], p[j + 1]);
          swap(pos[p[j]], pos[p[j + 1]]);
        }
      }
    }
  }
  // for(auto& x : p) cout << x + 1 << ' ';
  // cout << '\n';
  cout << ans.size() << '\n';
  // for(int i = 0; i < ans.size(); i++) {
  //   if(i % 2 != ans[i] % 2) cout << "BAD\n";
  // }
  for(auto& x : ans) cout << x + 1 << ' ';
  cout << '\n';
}
int main() {

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

  int t = 0;

  cin >> t;

  while(t--) solve();

  return 0;
}
/*

*/

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
//#include <atcoder/all>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

void solve(){
  int N; cin >> N;
  vector<int> A(N);
  rep(i,N){
    cin >> A[i];
  }
  vector<int> G=A;
  sort(all(G));
  int cnt = 0;
  vector<int> ans;
  while(G!=A){
    if(cnt%2==0){
      int ch = 0;
      for(int i=0;i+1<N;i+=2){
        if(A[i]>A[i+1]){
          ch = i;
          //break;
        }
      }
      ans.pb(ch);
      swap(A[ch], A[ch+1]);
    }
    else{
      int ch = 1;
      for(int i=1;i+1<N;i+=2){
        if(A[i]>A[i+1]){
          ch=i;
          //break;
        }
      }
      ans.pb(ch);
      swap(A[ch],A[ch+1]);
    }
    cnt++;
  }
  cout << cnt << endl;
  rep(i,sz(ans)){
    if(i) cout << " ";
    cout << ans[i]+1;
  }
  cout << endl;
}

int main(){
  int T; cin >> T;
  while(T--){
    solve();

  }
  return 0;
}


#include <bits/stdc++.h>

using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

class rep {
    struct Iter {
        usize itr;
        constexpr Iter(const usize pos) noexcept: itr(pos) { }
        constexpr void operator ++ () noexcept { ++itr; }
        constexpr bool operator != (const Iter& other) const noexcept { return itr != other.itr; }
        constexpr usize operator * () const noexcept { return itr; }
    };
    const Iter first, last;
public:
    explicit constexpr rep(const usize first, const usize last) noexcept: first(first), last(std::max(first, last)) { }
    constexpr Iter begin() const noexcept { return first; }
    constexpr Iter end() const noexcept { return last; }
};

template <class T>
using Vec = std::vector<T>;

void A_main() {
    // S_i, S_j の異なる bit が奇数個
    // mod 2 において
    // popcount(S_i xor S_j)
    //  = popcount(S_i) + popcount(S_j) - 2 * popcount(S_i and S_j)
    //  = popcount(S_i) + popcount(S_j)
    usize N, M;
    std::cin >> N >> M;
    u64 even = 0, odd = 0;
    for (auto i: rep(0, N)) {
        usize sum = 0;
        for (auto j: rep(0, M)) {
            char c;
            std::cin >> c;
            sum += c - '0';
        }
        (sum % 2 == 0 ? even : odd) += 1;
    }
    std::cout << even * odd << '\n';
    return;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    A_main();
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
int mod=1000000007;

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

	if(h%m==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;

	return 0;
}

/* common mistakes:

	long long
	pass constants as &

*/


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(998244353);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int multipf(vector<string>& s){
    cout << s[0];
    rep1(i, s.size() - 1)cout << " " << s[i];
    cout << endl;
    return 0;
}

int multipf(vector<ll>& n){
    cout << n[0];
    rep1(i, n.size() - 1)cout << " " << n[i];
    cout << endl;
    return 0;
}

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

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

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        ans %= mod;
        a = a * a;
        a %= mod;
        b >>= 1;
    }
    return ans % mod;
}

//modの値の確認をすること
int main(){
    bool f = false;
    string s;
    cin >> s;
    vector<ll> c(10,0);
    rep0(i, s.size())c[s[i] - '0']++;
    int n = 8;
    while (n < 1000) {
        string t = to_string(n);
        vector<ll> m(10,0);
        rep0(i, t.size())m[t[i] - '0']++;
        bool k = true;
        rep0(i, 10)if(m[i] > c[i])k = false;
        if(k && ((s.size() < 2 && n < 10) || ( 2 <= s.size() && s.size() < 3 &&  10 < n && n < 100) || (s.size() >= 3 && n > 100)))f = true;
        n += 8;
    }
    f? yes:no;
    return 0;
}


#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define ALL(a) (a).begin(), (a).end()

#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))
#define P 1000000007
long powP (long a, long b) {
  if (b == 1) return a;
  else if (b == 0) return 1;
  else if (b < 0) return powP(a, P - 1 + b);
  else {
    long b2 = powP(a, b/2);
    b2*=b2;
    b2%=P;
    return (b2 * powP(a, b%2)) % P;
  }
}

template <typename T>
using vec = vector<T>;

template <typename T>
using vvec = vector<vector<T>>;

#define INF INT_MAX

#define x first
#define y second

long sa (long b, int n) {
  long c = b % (long)pow(2, n);
  b /= (long)pow(2, n);
  while (c != 0) {
    while (c%2==0) c/=2;
    if (c%4==3) {
      c++;
      b++;
    } else {
      c--;
      b++;
    }
  }
  return b;
}

int main() {
  long x, y;
  cin>>x>>y;
  long ans = LONG_MAX;
  for (int n = 0; pow(2, n)*x<LONG_MAX; n++) {
    long b = abs(y-x*(long)pow(2, n));
    ans = min(ans, sa(b, n)+n);
  }
  cout<<ans;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define bit(n,k) ((n>>k)&1)
using namespace std;
typedef long long ll;

ll x,y;
unordered_map<ll,ll> mp;
ll Dfs(ll n){
    if(n <= x) return x - n;
    if(n % 2 == 0) return mp[n] = min(n - x, Dfs(n / 2) + 1);
    if(mp.count(n)) return mp[n];
    return mp[n] = min(Dfs(n + 1), Dfs(n - 1)) + 1;
}

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

    cin >> x >> y;
    cout << Dfs(y) << '\n';
}


#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int,int>;
/*
  for(int i=0;i<n;i++){
  }
*/

int main(){
  int n;
  cin>>n;
  cout<<n-1<<endl;
}

#include <bits/stdc++.h>
typedef long long ll;
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

using namespace std;

// void solve()
// {
// }

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    // int t;
    // cin >> t;
    // while (t--)
    //     solve();
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n / 2; i++)
    {
        ans += (i != n - i ? 2 : 1);
    }
    cout << ans << endl;
    return 0;
}


// Problem: B - 200th ABC-200
// Contest: AtCoder - KYOCERA Programming Contest 2021（AtCoder Beginner Contest 200）
// URL: https://atcoder.jp/contests/abc200/tasks/abc200_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define ff first
#define ss second
#define VI vector <int>
#define VVI vector <VI>
#define pii pair<int, int>
#define ppi pair<pii, int>
#define mii map<int, int>
#define mci map<char, int>
#define miv map<int, VI>
#define mis map<int, set<int>>
#define setbits(n) __builtin_popcount(n)
#define all(v) (v).begin(), (v).end()
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define endl "\n"
#define show2(a, b) cout<<a<<' '<<b<<endl
#define show3(a, b, c) cout<<a<<' '<<b<<' '<<c<<endl
#define show(arr) for (auto i:arr) cout<<i<<' ';

const long long N=1e5+5;
const long long mod=1000000007; //998244353

void cases(){
    int n, k;
    cin>>n>>k;
    for (int i=0; i<k; i++){
    	if (n%200){
    		n=(n*1000+200);
    	}
    	else n/=200;
    }
    cout<<n;
}

int32_t main(){
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t=1;
    // cin>>t;
    for (int i=0; i<t; i++){
    	//cout<<"Case #"<<i+1<<": ";
		cases();
    }
    return 0;
}

// Problem: B - 200th ABC-200
// Contest: AtCoder - KYOCERA Programming Contest 2021（AtCoder Beginner Contest 200）
// URL: https://atcoder.jp/contests/abc200/tasks/abc200_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
const int p=998244353;
int qp(int x,int y)
{
	int res=1;
	for(int t=x; y; y>>=1,t=t*t%p) if(y&1) res=res*t%p;
	return res;
}
signed main()
{
	int n=read();
	int k=read();
	for(int i=1; i<=k; ++i)
	{
		if(n%200!=0)
		{
			n*=1000,n+=200;
		}
		else n/=200;
	}
	printf("%lld\n",n);
	return 0;
}


#include <bits/stdc++.h>
// #define int long long
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ti tuple<int, int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) (((a)+(b)-1)/(b))
#define all(x) x.begin(), x.end()
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define dbg(msg, var) cerr << msg << " " << var << endl;

using namespace std;

const int MAX = 3e5+10;
const ll MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-8;
const ld PI = acos(-1);

// End Template //

int h, w, A, B;

ll solve(int x, int y, int a, vector<vector<bool>> &mat){
    ll ans = 0;
    if(a==0) return 1;
    if(x<h-1)
        ans += solve(x+1, y, a, mat);
    else if(y<w-1)
        ans += solve(0, y+1, a, mat);
    else
        return 0;

    if(x<h-1 and !mat[x][y] and !mat[x+1][y]){
        mat[x][y]=mat[x+1][y]=true;
        ans += solve(x+1, y, a-1, mat);
        mat[x][y]=mat[x+1][y]=false;
    }

    if(y<w-1 and !mat[x][y] and !mat[x][y+1]){
        mat[x][y]=mat[x][y+1]=true;
        if(x<h-1)
            ans += solve(x+1, y, a-1, mat);
        else
            ans += solve(0, y+1, a-1, mat);
        mat[x][y]=mat[x][y+1]=false;
    }
    return ans;
}

int32_t main()
{sws;

    cin >> h >> w >> A >> B;

    vector<vector<bool>> mat(h, vector<bool>(w, false));

    cout << solve(0, 0, A, mat) << endl;

    return 0;
}

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

signed main(){
  int k; cin>>k;
  string s,t; cin>>s>>t;
  vector<int> vec(9,k);

  for(int i=0;i<4;i++){
    vec.at(s.at(i)-'0'-1)--;
    vec.at(t.at(i)-'0'-1)--;
  } //vec内が残り枚数を示すことに。なお合計枚数は9k-8枚

  double ans=0;
  cout << fixed<<setprecision(20);

  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      double p=0;
      if(i==j){
        p+=vec.at(i-1)*(vec.at(i-1)-1)/(9*k-8.0)/(9*k-9.0);
      }else{
        p=vec.at(i-1)*vec.at(j-1)/(9*k-8.0)/(9*k-9.0);
      }

      vector<int> vecs(9,0),vect(9,0);
        for(int k=0;k<4;k++){
          vecs.at(s.at(k)-'0'-1)++;
          vect.at(t.at(k)-'0'-1)++;
        }
      vecs.at(i-1)++;
      vect.at(j-1)++; //vecs,vectにそれぞれsとtの1～9の個数

      int ns=0,nt=0; //sとtのijの際の得点
      for(int k=1;k<=9;k++){
        ns += k*pow(10,vecs.at(k-1));
        nt += k*pow(10,vect.at(k-1));
      }
      if(ns>nt){
        ans +=p;
      }
    }
  }
  cout <<ans<<endl;
}


#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stdio.h>
//eolibraries
#define lnf 3999999999999999999
#define inf 999999999
#define PI 3.14159265359
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define mkp(a,b) make_pair(a,b)
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define rsz(a,n) a.resize(n)
#define pii pair <int,int>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define drep(i,n) for(int i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(int i = x ; i < n ; i++)
#define vi vector <int>
#define v(s) vector<s>
#define rsz(a,n) a.resize(n)
#define rszv(a,n,v) a.resize(n,v)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//eodefine

const int max_n = 100 , max_m=500000;

using namespace std;
int n,m;
v(pii) a[max_n];

void rdd(){
	cin>>n>>m;

	rep(i,m) {
		int x,y,z;
		cin>>x>>y>>z;
		y--;
		a[x].pb({y,z});
	}

}
bool ok(int msk, v(pii) t) {
	for(auto p : t) {
		int cnt=0;
		rep(i,n) {
			if(msk&(1<<i)) {
				if(i<=p.fi)cnt++;
			}
		}
		if(cnt>p.se)return 0;
	}
	return 1;
}

ll dp[max_n][max_m];

int main(){
fcin;
	rdd();

	dp[0][0]=1;
	// cout<<(1<<n) <<"|n"
	ll fll=(1<<n);
	// cout<<fll<<"\n";
	rep(i,n+1){
		rep(msk,(1<<n)) {
			int k=__builtin_popcount(msk);
			if(dp[i][msk] == 0 or ok(msk,a[i]) == 0 or k!=i)continue;

			rep(x,n) {
				if(msk&(1<<x)) continue;
				dp[i+1][msk|(1<<x)] += dp[i][msk];
				// cout<<dp[i][msk]<<"\n";
			}
		}

	}

	ll ans=0;

	rep(msk,(1<<n)) {
		ans+=dp[n][msk];
	}

	cout<<ans<<"\n";
/*

*/

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
using P = pair<int64_t,int64_t>;
const int MAX = (1<<19);
int64_t dp[MAX];
int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<P>> vec(N,vector<P>(0));
  for(int i=0; i<M; i++){
    int X, Y, Z;
    cin >> X >> Y >> Z;
    X--;
    vec[X].push_back(P(Y,Z));
  }
  dp[0] = 1;
  for(int i=0; i<(1<<N); i++){
    int c = 0;
    vector<int> sum(N);
    for(int j=0; j<N; j++){
      if(i & (1<<j)){
        c++;
        sum[j]++;
      }
      if(j != 0){
        sum[j] += sum[j-1];
      }
    }
    //何を追加するか？
    for(int j=0; j<N; j++){
      if(i & (1<<j)){
        continue;
      }
      bool flag = true;
      for(int k=0; k<vec[c].size(); k++){
        auto[y,z] = vec[c][k];
        if(j < y){
          z--;
        }
        if(sum[y-1] > z){
          flag = false;
          break;
        }
      }
      if(flag){
        dp[i|(1<<j)] += dp[i];
      }
    }
  }
  cout << dp[(1<<N)-1] << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const ld eps = 1e-9;
const char newl = '\n';

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

  ll n;
  string s, t;
  cin >> n >> s >> t;

  ll ss=0, tt=0, ans=0;
  ql q;
  rep(i, n) {
    if(t[i]=='1') q.push(i);

    if(s[i]=='1') {
      if(q.size()) {
        ans += i - q.front();
        q.pop();
      }else {
        ss = 1 - ss;
        q.push(i);
      }
    }
  }

  cout << (q.empty() ? ans : -1) << newl;
  return 0;
}

#include <iostream>
#include <cstdio>
#define maxn 500005
using namespace std;
int n, pos[maxn], cnt;
char s[maxn], t[maxn];
int main()
{
	scanf("%d%s%s", &n, s + 1, t + 1);
	for (int i = 1; i <= n; i++)
	{
		if(t[i] == '1') pos[++cnt] = i;
	}
	int now = 1, st = 0;
	long long ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if(s[i] == '0') continue;
		if(st)
		{
			ans += i - st;
			st = 0;
		}
		else
		{
			if(i >= pos[now] && now <= cnt)
			{
				ans += i - pos[now];
				now++;
			}
			else st = i;
		}
	}
	if(now <= cnt || st) printf("-1");
	else printf("%lld", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b

using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,k;
    cin>>n>>k;
    while(k){
        if ( n % 200 == 0 ){
            n /= 200;
            k--;
        }
        else{
            if ( k >= 2 ){
                n *= 5;
                n++;
                k -= 2;
            }
            else{
                n *= 5;
                n++;
                n *= 200;
                k--;
            }
        }
    }

    cout<<n<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;
    for ( int i = 1 ; i <= t ; i++ ){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(), x.end()
#define FIO     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define endl "\n"
#define pb push_back
#define mp make_pair
#define re(i,n)        for(int i=0;i<(n);i++)
#define re1(i, k, n) for (int i = k; k < n ? i <= n : i >= n; k < n ? i += 1 : i -= 1)
#define FORD(i,a,b)     for(int i=(a);i>=(b);i--)
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
#define mod 1000000007
//===================================DEBUG TEMPLATE=================================================
void __print(int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x)
{
	cerr << '{';
	__print(x.first);
	cerr << ',';
	__print(x.second);
	cerr << '}';
}
template <typename T>
void __print(const T &x)
{
	int f = 0;
	cerr << '{';
	for (auto &i : x)
		cerr << (f++ ? "," : ""), __print(i);
	cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v)
{
	__print(t);
	if (sizeof...(v))
		cerr << ", ";
	_print(v...);
}
//====================================DEBUG TEMPLATE==============================================

int k, n, m;
vi a, l, r;

bool check(int x) {
	int ls = 0, rs = 0;
	re(i, k) {
		l[i] = max(0ll, (m * a[i] - x + n - 1) / n);
		ls += l[i];
	}
	re(i, k) {
		r[i] = (m * a[i] + x) / n;
		rs += r[i];
	}
	return ((ls <= m) && (m <= rs));
}

vector<int> mak(int x) {
	vi b(k);
	int bs = 0;
	re(i, k) {
		b[i] = max(0ll, (m * a[i] - x + n - 1) / n);
		bs += b[i];
	}
	re(i, k) {
		r[i] = (m * a[i] + x) / n;
	}
	re(i, k) {
		int x = min(m - bs, r[i] - b[i]);
		b[i] += x;
		bs += x;
	}
	return b;
}

void solve() {
	cin >> k >> n >> m;
	a.resize(k);
	l.resize(k);
	r.resize(k);
	re(i, k) {
		cin >> a[i];
	}
	int l = 0, r = n * m;
	while (l + 1 < r) {
		int x = (l + r) / 2;
		if (check(x))
			r = x;
		else
			l = x;
	}
	vi ans = mak(r);
	re(i, k) {
		cout << ans[i] << " ";
	}
}

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

	int t = 1;
	while (t--) {
		solve();
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()

 bool check(ll K) {
   string S=to_string(K);
   for(auto x:S) {
     if(x=='7') {
       return false;
     }
   }
   return true;
 }

ll  hachi(ll k) {
  ll t=1;
  ll s=0;
while(k>=8) {
  s+=(k%8)*t;
  k/=8;
  t*=10;
}
s+=t*k;
return s;
}

int main() {
 ll N;
 cin>>N;
ll ans=0;
 for(ll i=1;i<=N;i++) {
   ll p=hachi(i);
   if(check(i)&&check(p)) {
     ans++;
   }
 }

 cout<<ans<<endl;
}

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

bool check(int i){

     for(int j = i; j > 0; j /= 10){
          if(j % 10 == 7){
              // cout << j << endl;
               return true;
          }
     }

     for(int k = i; k > 0; k /= 8){
          if(k % 8 == 7){
              // cout << k << endl;
               return true;
          }
     }

     return false;
}

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

    for(int i = 1; i <= N; i++){
         if(check(i) == true){
              ans += 1;
         }
    }

    cout << N - ans << endl;

     return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef map<int, int> dictii;
typedef map<string, int> dictsi;
typedef map<string, string> dictss;
typedef pair<string, string> pss;
typedef set<int> si;
typedef set<string> ss;
typedef set<char> sc;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define FOR(a,b,c) for(int a=b;a<c;a++)
#define sut(a,b) (b*(b+1)/2 - a*(a+1)/2)
#define len(a) a.size()
#define FORD(a) for(const auto &[key, value] : a)
#define reverse(a) reverse(a.begin(), a.end())
#define nodup(v) v.erase(unique(v.begin(), v.end()), v.end())
#define string(d) to_string(d)
#define MAX_SIZE 1000005

const int mod = 1000000007;
const int max_n = 200005;
//Notes:
//

void solve(){
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(NULL);
string s;
int count=0;
cin >> s;
FOR(i,0,len(s)-3)
{
	if(s[i]=='Z' && s[i+1]=='O' && s[i+2]=='N' && s[i+3]=='e')
	{
		count++;
	}
}
cout << count;

    return 0;
}

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

int main()
{
    string s;
    string search = "ZONe";
    cin >> s;

    int count = 0;

    for (int i = 0; i < 9; i++)
    {
        //cout << s.substr(i, 4) << endl;

        if (s.substr(i, 4) == search)
            count++;
    }

    cout << count << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
const int nax=4e5+10,mod=1e9+7;
char s[nax];
int f[nax],c[nax],n;
int get(int m,int k)
{
    if(c[m]>c[k]+c[m-k])
    return 0;
    return f[m]*f[k]*f[m-k]%3;
}
int32_t main()
{
    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        cin>>n;
        scanf("%s",s+1);
        memset(f,0,sizeof(f));
        memset(c,0,sizeof(c));
        f[0]=1;
        c[0]=0;
        for(int i=1;i<=n;i++)
        {
            int x=i;
            while(x%3==0){
                c[i]++;
                x/=3;
            }
            f[i]=f[i-1]*x%3;
            c[i]+=c[i-1];
        }
        int res=0;
        for(int i=1;i<=n;i++)
        {
            int cur;
            if(s[i]=='B')
            cur=0;
            else if(s[i]=='W')
            cur=1;
            else if(s[i]=='R')
            cur=2;
            int pos=get(n-1,i-1);
            res=(res+pos*cur)%3;
        }
        if(n%2==0)
        res=(-res+3)%3;
        if(res==0)
        cout<<'B';
        else if(res==1)
        cout<<'W';
        else if(res==2)
        cout<<'R';
    }
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

const ll MOD = 3;

ll calc_pow(ll x, ll pow) {
    if (pow == 0) return 1;
    ll a = calc_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}

ll calc_div(ll a, ll b) {
    return a * calc_pow(b, MOD - 2) % MOD;
}

vector<ll> fact;

void init_fact(int n) {
    fact = vector<ll>(n);
    fact[0] = 1;
    for (int i = 1; i < n; i++) fact[i] = fact[i - 1] * i % MOD;
}

ll calc_comb(ll n, ll r) {
    if (n < r)return 0;
    return calc_div(fact[n], fact[r] * fact[n - r] % MOD);
}

int main() {
    init_fact(10);

    int n;
    string s;
    cin >> n >> s;

    int ret = 0;
    for (int i = 0; i < n; i++) {
        int times = 1;
        {
            int a = n - 1, b = i;
            while (a > 0) {
                times *= calc_comb(a % 3, b % 3), times %= MOD;
                a /= 3, b /= 3;
            }
        }

        //cout << times << " ";
        if (s[i] == 'W')ret += times * 1;
        if (s[i] == 'R')ret += times * 2;
        ret %= MOD;
    }

    if (ret == 0) cout << "B" << endl;
    else if (ret % 2 == n % 2) cout << "W" << endl;
    else cout << "R" << endl;
    return 0;
}


/*
	JAI JAGANNATH!
*/
//@Author : zanj0

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

#define int 			long long int
#define ff              first
#define ss              second
#define pb              push_back
#define MOD             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define endl       		"\n"
#define timetaken cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n"

void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
const int MAX = 3e6 + 5;
int fac[MAX], finv[MAX];
int inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
int COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int add(int a, int b) {
	return ((a % MOD) + (b % MOD)) % MOD;
}
int mul(int a, int b) {
	return ((a % MOD) * (b % MOD)) % MOD;
}
int fastPow(int base, int p) {
	int ret = 1;
	while (p) {
		if (p & 1) ret = mul(ret, base);
		base = mul(base, base);
		p >>= 1;
	}
	return ret;
}
int sub(int a, int b) {
	return (((a % MOD) - (b % MOD)) + MOD) % MOD;
}
void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	COMinit();
	if (n > m + k) {
		cout << 0 << endl;
	} else if (k >= n) {
		cout << COM(n + m, n) << endl;
	} else {
		cout << sub(COM(n + m, n), COM(n + m, n - k - 1)) << endl;
	}

}
int32_t main()
{
	zanj0();
	solve();
	timetaken;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define deb(k) cerr << #k << ": " << k << "\n";
#define size(a) (int)a.size()
#define fastcin cin.tie(0)->sync_with_stdio(0);
#define st first
#define nd second
#define pb push_back
#define mk make_pair
#define int long long
typedef long double ldbl;
typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef vector<int> vint;
#define MAX 4000100
#define MAXLG 20
const int inf = 0x3f3f3f3f;
const ll mod = 1000000007;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int N = 300100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll fat[MAX+100];
ll ifat[MAX+100];

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

void init(){
	fat[0] = 1;
	for(ll i=1;i<=MAX;i++){
	  fat[i] = (fat[i-1]*i)%mod;
	}
	ifat[MAX] = power(fat[MAX], mod-2, mod);
	for(ll i=MAX-1;i>=0;i--) ifat[i] = (ifat[i+1]*(i+1))%mod;
}

ll choose(int x, int y){
	if(y < 0 || y > x || x < 0) return 0;
	return fat[x]*(ifat[y]*ifat[x-y]%mod)%mod;
}

void solve(){
	init();
	int n, m, k;
	cin>>n>>m>>k;
	if(n > m + k){
		cout<<"0\n";
		return;
	}

	int ans = choose(n+m, n);
	for(int i=k+1;i<=n;i++){
		int j = i - k - 1;
		int l = j;
		int a = k, b = 0;
		int aux = (choose(2*l + a - b, l) - choose(2*l + a - b, l - 1)) * choose(n+m-i-j, n-i) % mod;
		ans -= aux;
		ans %= mod;
	}
	ans = (ans + mod) % mod;
	cout<<ans<<"\n";

	// Have you read the problem again?
	// Maybe you understood the wrong problem
}

int32_t main(){
	fastcin;
	int t_ = 1;
	//cin>>t_;
	while(t_--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using pii = pair<int, int>;
#define rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
#define repr(i, n, s) for (int i = (int)n; (int)s < i; i--)
#define len(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define debug(var) if(DEBUG) do{cout << #var << " : "; print(var);}while(0)
template<typename T> void print(T e){cout << e << '\n';}
template<typename T> void print(const vector<T>& v){string s=""; for(auto& e : v){s+=to_string(e)+' ';} s.pop_back(); cout << s << '\n';}
template<typename T> void print(const vector<vector<T>>& vv){cout << '\n'; for(auto& v : vv){print(v);}}
template<typename T> void print(const set<T>& v){string s=""; for(auto& e : v){s+=to_string(e)+' ';} s.pop_back(); cout << s << '\n';}
template<typename T> void print(const list<T>& v){string s=""; for(auto& e : v){s+=to_string(e)+' ';} s.pop_back(); cout << s << '\n';}
template<typename T> inline bool chmin(T &a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T &a, T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> T mod(T a, T m) {return (a % m + m) % m;}

const int INF32 = INT_MAX / 2;
const long long INF64 = LONG_LONG_MAX / 2;
const long long MOD = 1000000007;
const double PI = acos(-1);
const bool DEBUG = false;

int main() {
    int N;
    cin >> N;
    if (N == 1) {
        print("Yes");
        return 0;
    }
    vector<pair<int, int>> S, T;
    int x1c=0, y1c=0, x2c = 0, y2c = 0;
    rep(i, 0, N) {
        double a, b;
        cin >> a >> b;
        S.push_back(make_pair(a * N, b * N));
        x1c += a;
        y1c += b;
    }
    rep(i, 0, N) {
        double c, d;
        cin >> c >> d;
        T.push_back(make_pair(c * N, d * N));
        x2c += c;
        y2c += d;
    }
    // 重心を原点に移動
    rep(i, 0, N) {
        S[i] = make_pair(S[i].first - x1c, S[i].second - y1c);
        T[i] = make_pair(T[i].first - x2c, T[i].second - y2c);
    }
    // Sの基準vectorを決める。(0, 0以外)
    int ibase;
    rep(i, 0, N) {
        if (abs(S[i].first) + abs(S[i].second) >= 1) {
            ibase = i;
            break;
        }
    }
    // Sの基準との距離、クロス積、内積のtupleを計算。並び替え。
    vector<tuple<int, int, int>> S2;
    rep(i, 0, N) {
        if (i == ibase) continue;
        int x, y, x0, y0, dist, cp, ip;
        tie(x0, y0) = S[ibase];
        tie(x, y) = S[i];
        dist = (int)(pow(x - x0, 2) + pow(y - y0, 2));
        cp = x0 * y - y0 * x;
        ip = x0 * x + y0 * y;
        S2.emplace_back(dist, cp, ip);
    }
    sort(all(S2));
    // Tの各々の基準vectorについて
    bool ans = false;
    rep(i, 0, N) {
        bool ok = true;
        // 　距離、クロス積、内積のtupleを計算
        vector<tuple<int, int, int>> T2;
        rep(j, 0, N) {
            if (j == i) continue;
            int x, y, x0, y0,  dist, cp, ip;
            tie(x0, y0) = T[i];
            tie(x, y) = T[j];
            dist = (int)(pow(x - x0, 2) + pow(y - y0, 2));
            cp = x0 * y - y0 * x;
            ip = x0 * x + y0 * y;
            T2.emplace_back(dist, cp, ip);
        }
        sort(all(T2));
        //　set同士で比較。全部ほぼ一致ならTrue, break
        int eps = 0.1;
        rep(i, 0, N - 1) {
            int dist1, cp1, ip1, dist2, cp2, ip2;
            tie(dist1, cp1, ip1) = S2[i];
            tie(dist2, cp2, ip2) = T2[i];
            if (abs(dist2 - dist1) > eps || abs(cp2 - cp1) > eps || abs(ip2 - ip1) > eps) {
                ok = false;
                break;
            }
        }
        if (ok) {
            ans = true;
            break;
        }
    }

    if (ans) {
        print("Yes");
    }
    else {
        print("No");
    }
}

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

typedef long long ll;

using namespace std;

ll Atoi(string s, ll radix, ll m)
{
	ll ans = 0;
	for (ll i = 0; i < s.size(); i++)
	{
		char t = s[i];
		if (ans > m/radix)
			return 0;
		ans = ans * radix + t - '0';
	}
	return ans  <= m;
}

int main()
{
	string x;
	ll m;
	cin >> x >> m;

	if (x.size() == 1) {
		cout << Atoi(x, 10, m) << endl;
		return 0;
	}

	ll d = *max_element(x.begin(), x.end()) - '0' + 1;
	ll l = d, r = m;
	ll ans = 0;
	for (; l<=r; ) {
		ll mid = (l + r) / 2;
		if (Atoi(x, mid,m)) {
			ans = mid;
			l = mid + 1;

		}
		else {
			r = mid - 1;
		}
	}
	//cout << ans << " " << d << endl;
	if (d > ans) {
		cout << 0 << endl;
	}
	else {
		cout << ans - d + 1 << endl;
	}
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}
template<class T> bool chmax(T& a, const T& b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T> bool chmin(T& a, const T& b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	cout << (N % 2 == 0 ? "White" : "Black") << endl;
	return 0;
}

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>

#define ll long long

using namespace std;

int main()
{
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);

	ll n;
	string ans;
	cin >> n;
	ans = n%2 == 0? "White" : "Black";

	cout << ans;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W, X, Y;
    cin >> H >> W >> X >> Y;
    --X; --Y;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];

    ll cnt = 1;
    for(ll i=Y+1; i<W; ++i) {
        if(S[X][i] == '.') ++cnt;
        else break;
    }
    for(ll i=Y-1; i>=0; --i) {
        if(S[X][i] == '.') ++cnt;
        else break;
    }
    for(ll i=X+1; i<H; ++i) {
        if(S[i][Y] == '.') ++cnt;
        else break;
    }
    for(ll i=X-1; i>=0; --i) {
        if(S[i][Y] == '.') ++cnt;
        else break;
    }
    PR(cnt);

    return 0;
}

/*

*/

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

int main() {
 int H,W,X,Y;
  cin >>H>>W>>X>>Y;
  vector<vector<char>> s(H, vector<char>(W));

  for (int i = 0; i < H; i++) {
    // i番目の状態を読む
    for (int j = 0; j < W; j++) {
        cin >> s.at(i).at(j);
      }
    }

  int count_t = 0;
  int count_y =0;

//縦で考える
  for(int i=0;i<H;i++){

  	if(s.at(i).at(Y-1)=='#'&&X-1>i)
      count_t=0;
    else if(s.at(i).at(Y-1)=='#'&&X-1<=i)
      break;
    else if(s.at(i).at(Y-1)=='.')
      count_t++;
  }

  //横で考える
  for(int j=0;j<W;j++){

  	if(s.at(X-1).at(j)=='#'&&Y-1>j)
      count_y=0;
    else if(s.at(X-1).at(j)=='#'&&Y-1<=j)
      break;
    else if(s.at(X-1).at(j)=='.')
      count_y++;
  }
  cout<<count_t+count_y-1<<endl;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

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

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
set<ll> solve(vl A) {
	int N = sz(A);
	set<ll> res;
	F0R(m, 1 << N) {
		ll cur = 0;
		F0R(i, N) {
			if (m & (1 << i)) {
				cur += A[i];
			}
		}
		res.ins(cur);
	}
	return res;
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int N; cin >> N; ll T; cin >> T;
	ll A[N]; F0R(i, N) cin >> A[i];
	int bp = N / 2;
	vl B, C;
	F0R(i, N / 2) B.pb(A[i]);
	FOR(i, N / 2, N) C.pb(A[i]);
	set<ll> X = solve(B), Y = solve(C);

	ll ans = T;
	trav(a, X) {
		auto it = Y.ub(T - a);
		if (it == Y.begin()) break;
		it--;
		ckmin(ans, T - a - *it);
	}
	cout << T - ans << nl;
	return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

/*
 * @Author: BilyHurington
 * @Date: 2021-06-28 08:39:58
 * @LastEditors: BilyHurington
 * @LastEditTime: 2021-06-28 08:47:18
 */
#include<bits/stdc++.h>
#ifdef LOCAL_TEST
#include<ctime>
#endif
using namespace std;
int n,w[110],f[110][5010],Fac[110];
const int mod=998244353;
void Add(int &x,int y){x+=y;x-=x>=mod?mod:0;}
int main(){
    #ifdef LOCAL_TEST
    clock_t start=clock();
    #endif
    scanf("%d",&n);int sum=0;Fac[0]=1;
    for(int i=1;i<=n;i++) Fac[i]=1ll*Fac[i-1]*i%mod;
    for(int i=1;i<=n;i++) scanf("%d",&w[i]),sum+=w[i];
    if(sum&1){puts("0");return 0;}
    sum/=2;f[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=sum;j>=w[i];j--){
            for(int k=1;k<=n;k++){
                Add(f[k][j],f[k-1][j-w[i]]);
            }
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++) Add(ans,1ll*Fac[i]*Fac[n-i]%mod*f[i][sum]%mod);
    printf("%d",ans);
    #ifdef LOCAL_TEST
    clock_t end=clock();cout<<endl;
    cout<<"The program costs "<<(double)(end-start)/CLOCKS_PER_SEC<<" seconds"<< endl;
    puts("");system("pause");
    #endif
    return 0;
}