/*
ID: zhaowei10
TASK:
LANG: C++14
*/
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#ifdef LOCAL
#include <debug.h>
#else
#define debug(...) 0
#endif

#define eb emplace_back

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vc = vector<char>;
using vb = vector<bool>;
using vll = vector<ll>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(9);

#ifdef LOCAL
  freopen("test.in", "r", stdin);
  freopen("test.out", "w", stdout);
#else
#endif

  int w, h;
  cin >> w >> h;
  ll ans = 0;
  for (int i = 2; i <= w; i += 2) {
    for (int j = 2; j <= h; j += 2) {
      ll cur = (ll)(w - i + 1) * (h - j + 1);
      ans += cur;
    }
  }
  cout << ans;
}


#include <bits/stdc++.h>
using namespace std;
#define ll             long long int
#define ulli           unsigned long long int
#define li             long int
#define ff(i,a,b)      for(int i=a;i<b;i++)
#define fb(i,b,a)      for(int i=b;i>=a;i--)
#define w(t)           while(--t >= 0)
#define l(s)           s.length()
#define ci(n)          cin>>n;
#define fast           ios_base::sync_with_stdio(false);
#define sa(a,n)        sort(a,a+n)
#define sv(v)          sort(v.begin(),v.end())
#define cy             cout<<"YES\n"
#define cn             cout<<"NO\n"
#define nl             cout<<"\n"
#define minus          cout<<"-1\n";
#define vi             vector<int>
#define pb             push_back
#define tc             int t; cin>>t;
#define pp             pair<ll,ll>
#define input(a,n)     for(int i=0;i<n;i++) cin>>a[i];
#define mod            1000000007
#define co(n)          cout<<n;
#define ret            return 0
#define mi             map<int,int>
#define output(a,n)    for(int i=0;i<n;i++) cout<<a[i]<<" ";
#define forn(i, n)     ff(i, 0, n)
#define sz(v)          int((v).size())

int main()
{
    int w, x, y, z, W=1e9, X=1e9, Y=0, Z=0, n, S=0;
    cin>> n;
    w(n)
    {
        cin>>w>>x>>y>>z;
        S += (y-w)*(z-x);
        W = min(w, W);
        X = min(x, X),
        Y = max(y, Y);
        Z = max(z, Z);
    }
    cout<<((S==((Y-W)*(Z-X)) && (Y-W)==(Z-X)) ? "YES" : "NO");
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef map<int,int> mpii;
typedef map<string,int> mpsi;
typedef set<int> si;
typedef set<ll> sll;
#define pb push_back
#define INF 1000000000
#define LINF INF*INF
#define all(x) x.begin(),x.end()
vll fact(20);
map<string,int> vss;
ll getans(vi cnt)
{
    int sum=0;
	for(int i=0;i<=9;i++)
		sum+=cnt[i];
	ll ans=0;
	ans=fact[sum];
	for(auto it:cnt)
		ans/=fact[it];
	int sum2=sum-cnt[0];
	ans*=sum2;
	ans/=sum;
	return ans;
}
ll recur(vi cnt)
{
	ll ans=0;
	ans += getans(cnt);
	stringstream str;
	for(auto it:cnt)
	    str<<it;
	string s = str.str();
	for(int i=0;i<=9;i++)
	{
		if(cnt[i]>1)
		{
			cnt[i]--;
			s[i]--;
			if(!vss[s]){
			    vss[s]=1;
			    ans+=recur(cnt);
			}
			s[i]++;
			cnt[i]++;
		}
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll n;cin>>n;
	string t= to_string(n);
	vi cnt(10);
	for(int i=0;i<t.size();i++)
	{
		cnt[t[i]-'0']++;
	}
	fact[0]=1;
	fact[1]=1;
	for(int i=2;i<=19;i++)
	{
		fact[i]=i*fact[i-1];
	}
	cout<< recur(cnt)<<endl;;
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef pair <int, int> pi;

const int MAXN = 200005;

int n, m, q, rip, moze = 1;
int a[MAXN], b[MAXN], ans[MAXN];
int par[MAXN], col[MAXN];
vector <int> siz[MAXN];
vector <pi> e;

void dsu_init () {
    rip = 0;
    for (int i = 1; i <= n; i++) {
        par[i] = i;
        siz[i].clear();
        siz[i].push_back(1);
    }
}

pi nadi (int x) {
    if (x == par[x]) return {par[x], 0};
    pi res = nadi(par[x]);
    return {res.first, res.second ^ col[x]};
}

void spoji (int a, int b) {
    pi resa = nadi(a), resb = nadi(b);
    a = resa.first, b = resb.first;

    if (a == b) {
        e.push_back({-a, rip});
        rip += resa.second == resb.second;
        return;
    }

    if (siz[a].back() < siz[b].size()) swap(a, b);
    par[b] = a;
    col[b] = resa.second == resb.second;
    siz[a].push_back(siz[a].back() + siz[b].back());
    e.push_back({a, b});
}

void makni () {
    int a = e.back().first, b = e.back().second;
    e.pop_back();
    if (a < 0) {
        rip = b;
        return;
    }
    par[b] = b;
    col[b] = 0;
    siz[a].pop_back();
}

void calc (int lef, int rig, int lo, int hi) {
    if (lef > rig) return;
    int mid = (lef + rig) / 2;

    int poc = e.size();
    for (int i = lef; i < mid; i++) spoji(a[i], b[i]);

    if (rip > 0) {
        ans[mid] = hi;
    } else {
        int prije = e.size();
        for (int i = hi - 1; i >= max(lo, mid); i--) {
            spoji(a[i], b[i]);
            if (rip > 0) {
                ans[mid] = i;
                break;
            }
        }
        while (e.size() > prije) makni();
    }

    spoji(a[mid], b[mid]);
    calc(mid + 1, rig, ans[mid], hi);
    while (e.size() > poc) makni();

    for (int i = hi - 1; i >= ans[mid]; i--) spoji(a[i], b[i]);
    calc(lef, mid - 1, lo, ans[mid]);
    while (e.size() > poc) makni();
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> q;
    dsu_init();
    for (int i = 1; i <= m; i++) {
        cin >> a[i] >> b[i];
        spoji(a[i], b[i]);
    }
    if (rip == 0) {
        moze = 0;
    } else {
        dsu_init();
        calc(1, m, 1, m + 1);
    }
    for (int i = 0; i < q; i++) {
        int lo, hi;
        cin >> lo >> hi;
        if (moze == 0) {
            cout << "NO\n";
        } else {
            if (hi < ans[lo]) cout << "YES\n"; else cout << "NO\n";
        }
    }
    return 0;
}


//written by rraj001:)
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define ldd long double
#define mod 1000000007
#include<cstdio>
//#include<unordered_map>
//#define umap unordered_map
using namespace std;

int main()
{

    std::ios::sync_with_stdio(false);
    ll x1,x2,y1,y2,x3,y3;
    cin>>x1>>y1;
    cin>>x2>>y2;
    cin>>x3>>y3;
    bool f=false;
    if(x1>=x2 && y1>=y2)
    {
        if(x3<=x1-x2 && y3<=y1)f=true;
        if(y3<=x1-x2 && x3<=y1)f=true;
        if(y3<=y1-y2 && x3<=x1)f=true;
        if(x3<=y1-y2 && y3<=x1)f=true;

    }
       if(x1>=x3 && y1>=y3)
    {
        if(x2<=x1-x3 && y2<=y1)f=true;
        if(y2<=x1-x3 && x2<=y1)f=true;
        if(y2<=y1-y3 && x2<=x1)f=true;
        if(x2<=y1-y3 && y2<=x1)f=true;
    }
     if(y1>=x2 && x1>=y2)
    {
        if(x3<=y1-x2 && y3<=x1)f=true;
        if(y3<=y1-x2 && x3<=x1)f=true;
        if(y3<=x1-y2 && x3<=y1)f=true;
        if(x3<=x1-y2 && y3<=y1)f=true;

    }
       if(y1>=x3 && x1>=y3)
    {
        if(x2<=y1-x3 && y2<=x1)f=true;
        if(y2<=y1-x3 && x2<=x1)f=true;
        if(y2<=x1-y3 && x2<=y1)f=true;
        if(x2<=x1-y3 && y2<=y1)f=true;
    }

    if(f)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}


#include <iostream>
using namespace std; int n, x, y; int main()  {
    cin >> n >> x >> y;
    cout << ((x == n / 2|| x == n / 2 + 1) && (y == n / 2 || y == n / 2 + 1) ? "NO" : "YES");
}


#include <bits/stdc++.h>
const int N = 800010;
#define For(i, x, y) for (i = x; i <= y; i++)
using namespace std;
int i, j, k, n, m, nn, flag, Ge, D, len, shu, xi, num, wei, num4, sum, bian, t, X, Y;
struct read
{
    char p[2], s[2];
    int x, y;
    inline char gai(char x)
    {
        return x == 'L' ? 'T' : x == 'R' ? 'B' : x == 'B' ? 'L' : 'R';
    }
    inline void change(char x, int &y)
    {
        if (x == 'L')
            y = n - y + 1;
        if (x == 'R')
            y = n - y + 1;
    }
    inline void fan()
    {
        change(p[0], x);
        change(s[0], y);
        p[0] = gai(p[0]);
        s[0] = gai(s[0]);
    }
} rea[N];
struct ww
{
    int x, y, ty;
} a[N];
int dui[N], F[N], ty[10], biao[N], b[N], anx[N], any[N], f[N];
inline void fail()
{
    printf("No solution\n");
    exit(0);
}
inline void print()
{
    int i;
    if (!flag)
    {
        For(i, 1, n) printf("%d ", anx[i]);
        printf("\n");
        For(i, 1, m) printf("%d ", any[i]);
        printf("\n");
    }
    else
    {
        for (i = m; i; i--)
            printf("%d ", m - any[i] + 1);
        printf("\n");
        For(i, 1, n) printf("%d ", anx[i]);
        printf("\n");
    }
}
inline void gai(char x, int &y)
{
    if (x == 'T')
        y += n;
    if (x == 'R')
        y += nn;
    if (x == 'B')
        y += n + nn;
}
inline void into(char x, char y)
{
    if (x > y)
        swap(x, y);
    if (x == 'B' && y == 'L')
        ty[3]++;
    if (x == 'B' && y == 'R')
        ty[4]++;
    if (x == 'B' && y == 'T')
        ty[5]++;
    if (x == 'L' && y == 'R')
        ty[6]++;
    if (x == 'L' && y == 'T')
        ty[1]++;
    if (x == 'R' && y == 'T')
        ty[2]++;
}
inline void pre()
{
    For(i, 1, nn)
    {
        scanf("%s%s%d%d", rea[i].p, rea[i].s, &rea[i].x, &rea[i].y);
        into(rea[i].p[0], rea[i].s[0]);
    }
    if (ty[5] && ty[6])
        fail();
    if (ty[6])
    {
        For(i, 1, nn) rea[i].fan();
        swap(n, m);
        flag = 1;
    }
    memset(ty, 0, sizeof(ty));
    For(i, 1, nn)
    {
        char p = rea[i].p[0], s = rea[i].s[0];
        int x = rea[i].x, y = rea[i].y;
        gai(p, x);
        gai(s, y);
        dui[x] = y;
        dui[y] = x;
        into(p, s);
    }
    {
        bian = min(min(ty[1], ty[2]), min(ty[3], ty[4]));
        D = m - bian * 2;
        shu = n - bian * 2;
        Ge = __gcd(D, shu);
        if (Ge)
            len = (shu + D) / Ge;
        if (ty[1] > bian)
            xi = -shu;
        else
            xi = shu;
        int O = xi > 0 ? 1 : D;
        wei = O;
        For(i, 1, len)
        {
            int A = O + xi;
            if (A > 0 && A <= D)
            {
                if (O > 0 && A <= D)
                    biao[i] = 5;
                if (O < 1)
                    biao[i] = 3;
                if (O > D)
                    biao[i] = 4;
                O = A;
            }
            else if (A < 1)
            {
                biao[i] = 1;
                O += D;
            }
            else
            {
                biao[i] = 2;
                O -= D;
            }
        }
        for (i = 2, j = 0; i <= len; i++)
        {
            for (; j && biao[j + 1] != biao[i]; j = f[j])
                ;
            if (biao[j + 1] == biao[i])
                j++;
            f[i] = j;
        }
    }
}
inline int shi(int x)
{
    return x > nn ? x - nn : x;
}
inline int rev(int x)
{
    return x <= nn ? x + nn : x - nn;
}
inline void jing(int x, int y)
{
    if (x > y)
        swap(x, y);
    if (x <= n && y <= nn)
        a[++t] = (ww){x, y, 1};
    if (x > n && x <= nn && y > nn && y <= nn + n)
        a[++t] = (ww){x, y, 2};
    if (x <= n && y > nn + n)
        a[++t] = (ww){x, y, 3};
    if (x > nn && x <= nn + n && y > nn + n)
        a[++t] = (ww){x, y, 4};
    if (x > n && x <= nn && y > nn + n)
        a[++t] = (ww){x, y, 5};
}
inline void jia(int x)
{
    if (x <= n)
        X = min(X, x);
    if (x > n && x <= nn)
        Y = min(Y, x);
}
void dfs(int x)
{
    if (F[shi(x)])
        return;
    int A = dui[x], B = rev(A);
    jing(x, A);
    F[shi(x)] = 1;
    jia(x), jia(A);
    dfs(B);
}
void Dfs(int x, int y, int z)
{
    if (z > len)
        return;
    int O = x + xi;
    if (O > 0 && O <= D)
    {
        if (x > 0 && x <= D)
            any[x + bian] = a[y].x - n;
        else if (x < 1)
            anx[1 - x + bian] = a[y].x;
        else
            anx[x - D + bian] = a[y].x - nn;
        x = O;
    }
    else if (O < 1)
    {
        any[x + bian] = a[y].y - n;
        x += D;
    }
    else
    {
        any[x + bian] = a[y].x - n;
        x -= D;
    }
    Dfs(x, y + 1, z + 1);
}
inline void work(int ff)
{
    int s[10] = {}, i, j;
    For(i, 1, t)
    {
        ww A = a[i];
        s[A.ty]++;
        a[i + t] = a[i];
        b[i] = b[i + t] = A.ty;
    }
    if (s[1] && s[2] && s[3] && s[4])
    {
        if (max(max(s[1], s[2]), max(s[3], s[4])) > 1 || s[5])
            fail();
        int wa = 0;
        For(i, 1, t)
        {
            if (a[i].ty == 1)
                wa += (X != a[i].x) + (Y != a[i].y);
            if (a[i].ty == 4)
                wa += (X + nn == a[i].x) + (Y + nn == a[i].y);
        }
        if (wa & 1)
            fail();
        For(i, 1, t)
        {
            if (a[i].ty == 1)
                anx[num4 + 1] = a[i].x, any[num4 + 1] = a[i].y - n;
            if (a[i].ty == 2)
                any[m - num4] = a[i].x - n;
            if (a[i].ty == 3)
                anx[n - num4] = a[i].x;
        }
        num4++;
        if (num4 > bian)
            fail();
        return;
    }
    if (t != len)
        fail();
    j = 0;
    For(i, 1, t * 2)
    {
        for (; j && b[i] != biao[j + 1]; j = f[j])
            ;
        if (biao[j + 1] == b[i])
            j++;
        if (j == len)
            break;
    }
    if (i > t * 2)
    {
        if (ff)
            fail();
        reverse(a + 1, a + t + 1);
        work(1);
        return;
    }
    sum++;
    if (sum > Ge)
        fail();
    i = i - len + 1;
    Dfs(wei, i, 1);
    if (xi > 1)
        wei++;
    else
        wei--;
}
int main()
{
    scanf("%d%d", &n, &m);
    nn = n + m;
    pre();
    For(i, 1, nn) if (!F[i])
    {
        t = 0;
        X = Y = N;
        dfs(i);
        work(0);
    }
    print();
    return 0;
}


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

using namespace std;

typedef int ll;
typedef long double ld;

#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define pll pair<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vpll vector<pll>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ln length()
#define M 1000000007

ll n,w,tpos,tneg;
long long ans;
pll pos[100005],neg[100005];
pair<pll,ll> p[100005];
pll px[100005];
ll loc[100005],nx[100005],pr[100005];

struct element{
    vector<pair<ll,ll> > arr;
    vector<ll> bit;
    ll sz;
}tree[1000005];

ll mycmp2(pair<ll,ll> p1,pair<ll,ll> p2,ll ty){
    ll num1=p1.S;
    ll num2=p2.S;
    if(num1*1LL*p2.F > num2*1LL*p1.F) return -1;
    if(num1*1LL*p2.F == num2*1LL*p1.F) return 0;
    return 1;
}

void _merge(ll node,ll ty){
        ll left = node * 2;
        ll right = node * 2 + 1;
        ll i = 0, j = 0, c = 0;
        ll lSize =  tree[left].sz;
        ll rSize =  tree[right].sz;
        ll newSize = lSize + rSize;
        tree[node].sz = newSize;
        tree[node].arr.resize(newSize);
        tree[node].bit.clear();
        tree[node].bit.resize(newSize+1);

        while(i < lSize && j < rSize){
            if(mycmp2(tree[left].arr[i],tree[right].arr[j],ty) < 0){
                tree[node].arr[c] = tree[left].arr[i];
                i++;
            }else{
                tree[node].arr[c] = tree[right].arr[j];
                j++;
            }
            c++;
        }

        while(i < lSize)
            tree[node].arr[c++] = tree[left].arr[i++];

        while(j < rSize)
            tree[node].arr[c++] = tree[right].arr[j++];

}

void initialize(ll ty,ll node, ll st, ll en){
    if(st == en){
        tree[node].arr.resize(1);
        if(ty == 1){
            tree[node].arr[0] = mp(w+p[st].F.S,p[st].F.F);
        }
        else tree[node].arr[0] = mp(w-p[st].F.S,p[st].F.F);
        tree[node].bit.clear();
        tree[node].bit.resize(1+1);
        tree[node].sz = 1;
    }else{
        ll mid = (st+en)/2;
        initialize(ty,node * 2, st, mid);
        initialize(ty,node * 2 + 1, mid + 1 , en);
        _merge(node,ty);
    }
}
pair<ll,ll> create(ll ty,ll which){
    if(ty == 1) return mp(w+p[which].F.S,p[which].F.F);
    return mp(w-p[which].F.S,p[which].F.F);
}
pair<ll,ll> reve(ll ty,pll p1){
    if(ty == 1) return mp(p1.S,p1.F-w);
    return mp(p1.S,w-p1.F);
}
inline void bit_update(ll node, ll ps){
    if(!ps) return;
    for(ll i=ps;i<=tree[node].arr.size();i+=(i&(-i))) tree[node].bit[i]++;
    return;
}
inline ll bit_query(ll node,ll ps){
    ll ret=0;
    for(ll i=ps;i;i-=(i&(-i))) ret+=tree[node].bit[i];
    return ret;
}
void update(ll ty,ll node, ll st,ll en, ll which) {
    if(st == en){
        bit_update(node,1);
        return;
    }
    ll mid=(st+en)/2;
    if(which <= mid) update(ty,2*node,st,mid,which);
    else update(ty,2*node+1,mid+1,en,which);

    ll lo=0,hi=tree[node].arr.size()-1,req=-1;
    while(lo <= hi){
        mid=(lo+hi)/2;
        ll cmpval=mycmp2(tree[node].arr[mid],create(ty,which),ty);
        if(cmpval == -1) lo=mid+1;
        else if(cmpval == 0){
            req=mid;
            hi=mid-1;
        }
        else hi=mid-1;
    }
    assert(req!=-1);
    bit_update(node,req+1);
}

ll query(ll ty,ll node, ll st, ll en,ll l,ll r,ll which) {
    if(l > en || r < st || l > r)
        return 0;
    if(l <= st && r >= en){
        ll lo=0,hi=tree[node].arr.size()-1,mid,req=-1;
        while(lo <= hi){
            mid=(lo+hi)/2;
            ll cmpval=mycmp2(tree[node].arr[mid],create(ty,which),ty);
            if(cmpval == -1) {
                req=mid;
                lo=mid+1;
            }
            else if(cmpval == 0){
                req=mid;
                lo=mid+1;
            }
            else hi=mid-1;
        }
        /*rep(j,1,req+1){
            if(bit_query(node,j)-bit_query(node,j-1)){
                cout<<reve(ty,tree[node].arr[j-1]).F<<" "<<reve(ty,tree[node].arr[j-1]).S<<" matches "<<p[which].F.F<<" "<<p[which].F.S<<endl;
            }
        }*/
        return bit_query(node,req+1);
    }
    else{
        ll mid = (st+en)/2;
        return query(ty,node*2, st, mid,l,r,which) + query(ty,node * 2 +1, mid + 1, en,l,r,which);
    }
}

bool cmp(pair<pll,ll> p1,pair<pll,ll> p2){
    if(p2.F.F*1LL*p1.F.S != p1.F.F*1LL*p2.F.S) return p2.F.F*1LL*p1.F.S < p1.F.F*1LL*p2.F.S;
    return p1.S < p2.S;
}
ll mycmp(ll i,ll en){
    if(p[en].F.F*1LL*p[i].F.S == p[i].F.F*1LL*p[en].F.S) return 0;
    if(p[en].F.F*1LL*p[i].F.S > p[i].F.F*1LL*p[en].F.S) return 1;
    return -1;
}
void solve(){
    sort(p+1,p+n+1,cmp);
    rep(i,1,n){
        ll en=i;
        while(en <= n && mycmp(i,en) == 0) en++;
        en--;
        /*rep(j,i,en) cout<<p[j].F.F<<" together "<<p[j].F.S<<endl;
        cout<<endl<<endl;*/
        ans+=((en-i+1)*1LL*(en-i))/2;
        i=en;
    }
    rep(i,1,n) loc[p[i].S]=i;
    rep(i,2,n){
        if(mycmp(i-1,i) == 0) pr[i]=pr[i-1];
        else pr[i]=i-1;
    }
    nx[n]=n+1;
    rev(i,n-1,1){
        if(mycmp(i,i+1) == 0) nx[i]=nx[i+1];
        else nx[i]=i+1;
    }

    rep(ty,1,2){
        initialize(ty,1,1,n);
        rev(i,n,1){
            ll st=i;
            while(st>=1 && px[st].F == px[i].F) st--;
            st++;

            rep(j,st,i) {
                if(ty==1) {
                    ans+=query(ty,1,1,n,nx[loc[j]],n,loc[j]);
                }
                else {
                    ans+=query(ty,1,1,n,1,pr[loc[j]],loc[j]);
                }
            }
            rep(j,st,i) {
                update(ty,1,1,n,loc[j]);
            }
            i=st;
        }
    }

    /*rep(i,1,n) rep(j,i+1,n){
        if(px[i].F == px[j].F) continue;
        ll num=abs(px[i].S*px[j].F-px[j].S*px[i].F);
        if(num <= w*(px[j].F-px[i].F)){
            cout<<"HEY matching "<<px[i].F<<" "<<px[i].S<<" "<<px[j].F<<" "<<px[j].S<<endl;
        }
    }*/
}
pair<pll,ll> cross[100005];
bool cmp3(pll p1,pll p2){
    ll num1=p1.S-w,den1=p1.F;
    ll num2=p2.S-w,den2=p2.F;
    if (num1*1LL*den2 != num2*1LL*den1) return  num1*1LL*den2 <= num2*1LL*den1;
    return den1 < den2;
}
ll BIT[100005];
inline void b_update(ll ps){
    if(!ps) return;
    for(ll i=ps;i<=n;i+=(i&(-i))) BIT[i]++;
    return;
}
inline ll b_query(ll ps){
    ll ret=0;
    for(ll i=ps;i;i-=(i&(-i))) ret+=BIT[i];
    return ret;
}
int main()
{
    //freopen("D.in", "r", stdin);
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>n>>w;
    rep(i,1,n){
        ll xi,vi;cin>>xi>>vi;
        if(xi < 0) neg[++tneg]=mp(-xi,vi);
        else pos[++tpos]=mp(xi,-vi);
    }
    sort(pos+1,pos+tpos+1);
    sort(neg+1,neg+tneg+1);

    rep(i,1,tpos) {
        p[i]=mp(pos[i],i);
        px[i]=pos[i];
    }
    n=tpos;
    if(n) solve();

    rep(i,1,tneg) {
        p[i]=mp(neg[i],i);
        px[i]=neg[i];
    }
    n=tneg;
    if(n) solve();

    rep(i,1,tpos) cross[i]=mp(pos[i],i);
    rep(i,1,tneg) cross[i+tpos]=mp(neg[i],i+tpos);
    n=tpos+tneg;
    sort(cross+1,cross+n+1,cmp);

    rep(i,1,n){
        ll en=i;
        while(en <= n && cross[i].F.F*1LL*cross[en].F.S==cross[i].F.S*1LL*cross[en].F.F) en++;
        en--;
        ll ct1=en-i+1,ct2=0;
        rep(j,i,en) if(cross[j].S > tpos) ct1--,ct2++;
        ans+=ct1*1LL*ct2;
        /*rep(j,i,en) rep(j1,j+1,en) {
            if((cross[j].S <= tpos && cross[j1].S > tpos )||(cross[j].S > tpos && cross[j1].S <= tpos)) {
                cout<<" cross eq "<<cross[j].F.F<<" "<<cross[j].F.S<<" "<<cross[j1].F.F<<" "<<cross[j1].F.S<<endl;
            }
        }*/
        i=en;
    }

    sort(pos+1,pos+tpos+1,cmp3);
    rev(i,n,1){
        if(cross[i].S > tpos) {
            ll lo=1,hi=tpos,mid,req=0;
            while(lo <= hi){
                mid=(lo+hi)/2;
                long long cval=(w+cross[i].F.S)*1LL*pos[mid].F - (pos[mid].S-w)*1LL*cross[i].F.F;
                if(cval > 0) {
                    req=mid;lo=mid+1;
                }
                else if(cval == 0){
                    req=mid;
                    lo=mid+1;
                }
                else hi=mid-1;
            }
            /*rep(j,1,req){
                if(b_query(j)-b_query(j-1)){
                    cout<<"neg to pos "<<cross[i].F.F<<" "<<cross[i].F.S<<" "<<pos[j].F<<" "<<pos[j].S<<endl;
                }
            }*/
            ans+=b_query(req);
        }
        else{
            ll lo=1,hi=tpos,mid,req=0;
            while(lo <= hi){
                mid=(lo+hi)/2;
                long long cval=(cross[i].F.S-w)*1LL*pos[mid].F - (pos[mid].S-w)*1LL*cross[i].F.F;
                if(cval > 0) {
                    lo=mid+1;
                }
                else if(cval == 0){
                    req=mid;
                    hi=mid-1;
                }
                else hi=mid-1;
            }
            assert(req>0);
            b_update(req);
        }
    }

    rep(i,1,n) BIT[i]=0;
    rep(i,1,tpos) cross[i]=mp(pos[i],i+tneg);
    rep(i,1,tneg) cross[i+tpos]=mp(neg[i],i);
    n=tpos+tneg;
    sort(cross+1,cross+n+1,cmp);
    sort(neg+1,neg+tneg+1,cmp3);
    rev(i,n,1){
        if(cross[i].S > tneg) {
            ll lo=1,hi=tneg,mid,req=0;
            while(lo <= hi){
                mid=(lo+hi)/2;
                long long cval=(w+cross[i].F.S)*1LL*neg[mid].F - (neg[mid].S-w)*1LL*cross[i].F.F;
                if(cval > 0) {
                    req=mid;lo=mid+1;
                }
                else if(cval == 0){
                    req=mid;
                    lo=mid+1;
                }
                else hi=mid-1;
            }
            ans+=b_query(req);
            /*rep(j,1,req){
                if(b_query(j)-b_query(j-1)){
                    cout<<"pos to neg "<<cross[i].F.F<<" "<<cross[i].F.S<<" "<<neg[j].F<<" "<<neg[j].S<<endl;
                }
            }*/
        }
        else{
            ll lo=1,hi=tneg,mid,req=0;
            while(lo <= hi){
                mid=(lo+hi)/2;
                long long cval=(cross[i].F.S-w)*1LL*neg[mid].F - (neg[mid].S-w)*1LL*cross[i].F.F;
                if(cval > 0) {
                    lo=mid+1;
                }
                else if(cval == 0){
                    req=mid;
                    hi=mid-1;
                }
                else hi=mid-1;
            }
            assert(req>0);
            b_update(req);
        }
    }
    /*rep(i,1,tpos) rep(j,1,tneg) {
        ll num=abs(pos[i].S*neg[j].F-neg[j].S*pos[i].F);
        if(num <= w*(neg[j].F+pos[i].F)){
            cout<<"HEY BRUTE matching "<<pos[i].F<<" "<<pos[i].S<<" "<<neg[j].F<<" "<<neg[j].S<<endl;
        }
    }*/

    cout<<ans<<'\n';
}


#include <bits/stdc++.h>
#define MAXN 1000005
#define MOD 1000000007
//思路：线段树优化dp
using namespace std;
inline 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^'0');
        ch=getchar();
    }
    return x*f;
}
namespace SegmentTree{
    struct node{
        int l,r;
        int val;
        bool tag;
    }tree[MAXN<<2];
    #define lc i<<1
    #define rc i<<1|1
    inline void pushup(const int &i){
        tree[i].val=(tree[lc].val+tree[rc].val)%MOD;
    }
    inline void Change(const int &i,const int &rt){
        tree[i].val=0;
        tree[i].tag=true;
    }
    inline void pushdown(const int &i){
        if (tree[i].tag){
            Change(lc,i),Change(rc,i);
            tree[i].tag=false;
        }
    }
    void Build(const int &l,const int &r,const int &i){
        tree[i].l=l,tree[i].r=r;
        tree[i].tag=0,tree[i].val=0;
        if(l==r){return ;}
        int mid=(l+r)>>1;
        Build(l,mid,lc);
        Build(mid+1,r,rc);
    }
    void Cover(const int &i,const int &L,const int &R){
        if (L<=tree[i].l&&tree[i].r<=R){
            tree[i].tag=true;
            tree[i].val=0;
            return ;
        }
        pushdown(i);
        int mid=(tree[i].l+tree[i].r)>>1;
        if (L<=mid) Cover(lc,L,R);
        if (mid<R) Cover(rc,L,R);
        pushup(i);
    }
    void Update(const int &i,const int &index,const int &val){
        if (tree[i].l==tree[i].r){
            tree[i].val=val;
            return ;
        }
        pushdown(i);
        int mid=(tree[i].l+tree[i].r)>>1;
        if (index<=mid) Update(lc,index,val);
        else Update(rc,index,val);
        pushup(i);
    }
    int Query(const int &i,const int &L,const int &R){
        if (L>R) return 0;
        // printf("%d %d %d\n",i,L,R);
        if (L<=tree[i].l&&tree[i].r<=R){
            return tree[i].val;
        }
        pushdown(i);
        int mid=(tree[i].l+tree[i].r)>>1,ans=0;
        if (L<=mid) ans=(ans+Query(lc,L,R))%MOD;
        if (mid<R) ans=(ans+Query(rc,L,R))%MOD;
        return ans;
    }
}
using namespace SegmentTree;
struct sgmt{
    int x,y1,y2;//是一条竖线 y1下端点 y2上端点
    bool flag;//是左边竖线还是右边竖线
    //0左边 1右边
};
inline bool operator < (const sgmt &A,const sgmt &B){
    if (A.x!=B.x){//先比较x
        return A.x<B.x;
    }
    else {
        if (A.y1==B.y1){
            return A.y2>B.y2;
        }
        else {
            return A.y1>B.y1;
        }
    }
}
#define pii pair<int,int>
#define l first
#define r second
#define mp make_pair
set<pii>now;//现在扫描到的竖线中的线段
sgmt s[MAXN*2];int tot;//全部的竖线
inline void Add(sgmt A){s[++tot]=A;}
int main(){
    int n=read(),m=read(),k=read();
    for (register int i=1;i<=k;++i){
        int x1=read(),y1=read(),x2=read(),y2=read();
        Add(sgmt{x1,y1,y2,0});
        Add(sgmt{x2+1,y1,y2,1});
    }
    Build(1,m,1);
    Update(1,1,1);
    sort(s+1,s+1+tot);
    int p=1;
    for (p=1;s[p].x==1;++p){
        if (!s[p].flag){
            now.insert(mp(s[p].y1,s[p].y2));
        }
    }
    now.insert(mp(0,0));
    for (register int i=2;i<=n;++i){
        for (register int j=p;s[j].x==i;++j){//二分得到low 线段树区间加，维护DP
            int pos=s[j].y2+1;
            if (s[j].flag==0&&pos<=m){
                //s[j].y2+1<=m不加会RE
                int low=(*--now.lower_bound(mp(pos+1,0))).r;
                Update(1,pos,Query(1,low+1,pos));//玄学边界
            }
        }
        //下面都是维护now集合，删去移动区间导致消失的线段，加上新的线段
        //这两个顺序不能换（先下后上的原理）
        for (register int j=p;s[j].x==i;++j){//减去消失的线段
            if (s[j].flag){
                now.erase(mp(s[j].y1,s[j].y2));
            }
        }
        for (register int j=p;s[j].x==i;++j,++p){
            if (!s[j].flag){
                now.insert(mp(s[j].y1,s[j].y2));
                Cover(1,s[j].y1,s[j].y2);//顺便把有障碍物的区间设成0
            }
        }

        //至于F[i][j]=F[i-1][j]不要管，因为区间从左到右移动，直接继承上一个区间的F[i][j]
    }
    cout<<Query(1,(*(--now.end())).l+1,m)%MOD<<endl;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
char arr[1001][1001];
char res[1001][1001];
string sig[3] = {"###", "#.#", "###"};

void write(int x, int y)
{
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            if (arr[x+i][y+j] != sig[i][j] && arr[x+i][y+j] == '.') return;
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            if (res[x+i][y+j] == '.' && sig[i][j] == '#')
                res[x+i][y+j] = '#';
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            cin >> arr[i][j], res[i][j] = '.';
    for (int i = 0; i < n-2; i++)
        for (int j = 0; j < m-2; j++)
            write(i, j);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            if (res[i][j] != arr[i][j])
                return !printf("NO");
    cout << "YES";
}


#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define N 1234
int n, m, s, t, c;
char str[N];
void solve() {
	int i;
	bool flag = true;
	bool way = 0;
	for (i = 0; i < n; i++) {
		if (str[i] != '?' && str[i] == str[i + 1]) {
			flag = false;
			break;
		}
		if (str[i] == '?') {
			if (i - 1 < 0 || str[i - 1] == '?') {
				way = 1;
			}
			else if (i + 1 >= n || str[i + 1] == '?') {
				way = 1;
			}
			else if (str[i - 1] == str[i + 1]) {
				way = 1;
			}
		}
	}
	printf("%s\n", flag && way ? "Yes" : "No");
}
int main() {
	while (scanf("%d %s", &n, &str) != EOF) {
		solve();
	}
	return 0;
}


#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <map>
#include <iomanip>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#define ll long long int
#define usll unsigned long long int
#define endln "\n"
#define MAXX 1000007
#define PI M_PI;
#define MX 10002
#define sps setprecision
#define goodluck_code() main()
#define TSUNAMI  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(a) cout << (#a) << " = " << a << "\n";
#define _Open_Minded_Short_Code_ return 0;
using namespace std;
stack <int> st , st2;
map <ll , ll> mp;
vector <ll> ve;
goodluck_code(){
    TSUNAMI
    ll a , b;
    cin >> a >> b;
    st.push(a);
    int i = 0;
    while(st.top() != b){
        ll x = st.top();
        if(mp[x] == 0){
            mp[x]++;
//            debug(st.top());
            st2.push(x);
            if(x * 10 + 1 <= b ){
                st.push(x * 10 + 1);
            }
            if(x * 2 <= b){
                st.push(x * 2);
            }
        }else{
            st.pop();
            st2.pop();
        }
        if(st.size() == 0){
            break;
        }
    }
    if(st2.size() == 0){
        cout<<"NO"<<endl;
        return 0;
    }
    while(st2.size() != 0){
        ve.push_back(st2.top());
        st2.pop();
    }
    sort(ve.begin() , ve.end());
    cout<<"YES"<<endl;
    cout<<ve.size() + 1<<endl;
    for(int i=0;i<ve.size();i++){
        cout<<ve[i]<<" ";
    }
    cout<<b;
    // idea : a.nhat

   _Open_Minded_Short_Code_
}


//#include <algorithm>
//#include <iostream>
//#include <cstdio>
//#include <cmath>
//6845684646
//#include <cstring>
//#include <cctype>
//#include <queue>
//#include <map>
//#include <string>
//#include <vector>
//#include <set>
//#include <math.h>
//#include <stack>
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <time.h>
//#define ll long long
//#define chushihua(x) memset(x,0,sizeof x)
//using namespace std;
//ll  a[16];
//void random(ll a[], ll n)
//{
//	ll index, tmp, i;
//	srand(time(NULL));
//	for (i = 0; i < n; i++)
//	{
//		index = rand() % (n - i) + i;
//		if (index != i)
//		{
//			tmp = a[i];
//			a[i] = a[index];
//			a[index] = tmp;
//		}
//	}
//}
//ll gcd(ll a, ll b) {
//	return a % b ? gcd(b, a%b) : b;
//}
//int main() {
//	int n;
//	while (cin >> n) {
//		n = n * 2;
//		for (int i = 0; i < n; i++) {
//			scanf("%d", &a[i]);
//		}
//		//for (int i = 0; i < n; i++) {
//		//	printf("%d ", a[i]);
//		//}
//		if (n == 2) {
//			cout << a[0] + a[1] << endl;
//		}
//		else {
//			ll sum = 0;
//			for (ll i = 0; i < 10000; i++) {
//				random(a, n);
//				ll x = a[0] + a[1];
//				ll y = a[2] + a[3];
//				sum = max(sum, gcd(x, y));
//			}
//			cout << sum << endl;
//		}
//	}
//}
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <queue>
#include <map>
#include <string>
#include <vector>
#include <set>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define ll long long
#define chushihua(x) memset(x,0,sizeof x)
using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	int a[100 + 10];
	int e = 0, s = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		if (a[i] == 1) {
			e++;
		}
		else {
			s++;
		}
	}
	//cout << e << " " << s << endl;
	int E = e, S = s;
	int sum = 0;
	for (int i = 1; i <= k; i++) {
		e = E, s = S;
		for (int j = i; j <= n; j+=k) {
			if (a[j] == 1) {
				e--;
			}
			else {
				s--;
			}
		}
		//cout << sum << endl;
		sum = max(sum, abs(e - s));
	}
	cout << sum << endl;
	return 0;
}


// rc.cpp
//

#include <math.h>
#include <string.h>

#include <fstream>
#include <iterator>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <list>
#include <algorithm>
#include <numeric>

using namespace std;

typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned __int64 uint64;

#define PI 3.1415926535897932384626433832795
#define EPS 1E-8

uint kb[100],
	 nkb,
	 v[100],
	 nv;
int main(int argc, char* argv[])
{
	uint s, k;
	cin >> s >> k;

	uint q = 1,
		 c = 0;
	kb[nkb++] = 1;
	while (q <= s)
	{
		kb[nkb++] = q;
		if (nkb > k)
			q += q - kb[nkb - k - 1];
		else
			q *= 2;
	}

	--nkb;
	while (s)
	{
		while (s < kb[nkb])
			--nkb;
		s -= kb[nkb];
		v[nv++] = kb[nkb--];
	}

	if (nv == 1)
		++nv;

	cout << nv << endl;
	cout << v[0];
	for (uint i = 1; i < nv; ++i)
		cout << " " << v[i];
	cout << endl;

	return 0;
}


//#define MYDEBUG
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:134217728")
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>

const long long MOD = 1000000007;
const long long INF = 2000000001;
const double EPS = 1e-5;
const int HASH_POW = 13;
const double PI = acos(-1.0);

using namespace std;

void my_return(int code)
{
	#ifdef MYDEBUG
		cout << "\nTime = " << fixed << setprecision(3) << double(clock()) / CLOCKS_PER_SEC << endl;
	#endif
	exit(code);
}

int main()
{
	//cin.sync_with_stdio(0);
	#ifdef MYDEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	#else
	//freopen("pentagon.in", "rt", stdin);
	//freopen("pentagon.out", "wt", stdout);
	#endif

	int h1, a1, d1, h2, a2, d2, h, a, d;
	scanf("%d %d %d\n%d %d %d\n%d %d %d", &h1, &a1, &d1, &h2, &a2, &d2, &h, &a, &d);
	int ans = 1000000000;
	for (int i = h1; i <= 5000; ++i)
	{
		for (int j = a1; j <= 210; ++j)
		{
			for (int k = d1; k <= 100; ++k)
			{
				int cost = h*(i - h1) + a*(j - a1) + d*(k - d1);
				if (j > d2)
				{
					int t = (h2 + j - d2 - 1)/(j - d2);
					if (i - t*(a2 - k) > 0)
						ans = min(ans, cost);
				}
			}
		}
	}
	printf("%d\n", ans);

	my_return(0);
}


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

int main()
{
   long long int n,a,b,c;
   cin>>n>>a>>b>>c;
   long long int rem=n%4;
   //cout<<rem<<endl;
   n=4-rem;
   if(rem==0){cout<<0; return 0;}
   else if(n==1)
   {   if(a<3*c&&a<b+c)cout<<a;
       else if(3*c<a&&3*c<b+c)cout<<3*c;
       else cout<<c+b;
       return 0;
   }
   else if(n==2)
   {
       if(2*a<b&&2*a<2*c)cout<<2*a;
       else if(2*c<b&&2*c<2*a)cout<<2*c;
       else cout<<b;
       return 0;
   }
   else if(n==3)
   {
       if(c>a+b&&a+b<3*a)cout<<a+b;
      else if(c>3*a&&a+b>3*a)cout<<3*a;
      else cout<<c;
      return 0;

   }

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
const int N=31,S=64;
int k;
const int mod=1e9+7;
struct M{
	int a[N][N];
	inline M operator * (const M &b) const {
		M ans={};
		for (int i=0;i<=k;i++)
			for (int j=0;j<=k;j++)
				for (int t=0;t<=k;t++)
					ans.a[i][j]=(ans.a[i][j]+1LL*a[i][t]*b.a[t][j])%mod;
		return ans;
	}
}f[S][N],pre[N],suf[N];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("cf497e.in","r",stdin);
	freopen("cf497e.out","w",stdout);
#endif
	LL n;int num[S],len=0,i,j,s;M ans={};
	cin>>n>>k;ans.a[0][k]=1;
	while (n) num[len++]=n%k,n/=k;

	for (i=0;i<k;i++)
		for (j=0;j<=k;j++)
			f[0][i].a[j][j]=f[0][i].a[j][i]=1;
	for (i=1;i<len;i++) {
		pre[0]=f[i-1][0];
		for (j=1;j<k;j++) pre[j]=pre[j-1]*f[i-1][j];
		suf[k-1]=f[i-1][k-1];
		for (j=k-1;j--;) suf[j]=f[i-1][j]*suf[j+1];
		f[i][0]=suf[0];
		for (j=1;j<k;j++) f[i][j]=suf[j]*pre[j-1];
	}
	for (i=len,s=0;i--;s+=num[i])
		for (j=0;j<num[i];j++) ans=ans*f[i][(j+s)%k];
	s=0;
	for (i=0;i<=k;i++) (s+=ans.a[0][i])%=mod;
	printf("%d\n",s);
	return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

const int N=6e5+5;
const int offset=3e5;
const int MOD=1e9+7;

int a, b, k, t;
int dp[2][102][N];

int32_t main()
{
    IOS;
    cin>>a>>b>>k>>t;
    for(int player=0;player<=1;player++)
    {
        for(int diff=-offset;diff<=offset;diff++)
        {
            dp[player][t+1][diff+offset]=(diff>0);
            dp[player][t+1][diff+offset]+=dp[player][t+1][diff+offset-1];
            dp[player][t+1][diff+offset]%=MOD;
        }
    }
    for(int turn=t;turn>=1;turn--)
    {
        for(int diff=-offset;diff<=offset;diff++)
        {
            int player=1;
            int &ans=dp[player][turn][diff+offset];
            ans=dp[player^1][turn+1][diff+k+offset] - dp[player^1][turn+1][diff-k-1+offset];
            ans+=MOD;
            ans%=MOD;
            ans+=dp[player][turn][diff-1+offset];
            ans%=MOD;
        }
        for(int diff=-offset;diff<=offset;diff++)
        {
            int player=0;
            int &ans=dp[player][turn][diff+offset];
            ans=dp[player^1][turn][diff+k+offset] - dp[player^1][turn][diff-k-1+offset];
            ans+=MOD;
            ans%=MOD;
            ans+=dp[player][turn][diff-1+offset];
            ans%=MOD;
        }
    }
    int ans=dp[0][1][a-b+offset]-dp[0][1][a-b-1+offset];
    ans+=MOD;
    ans%=MOD;
    cout<<ans;
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    vector<int>v{1200,1400,1600,1900,2100,2300,2400,2600,3000};
    for(int i=0;i<v.size();i++)
    {
        if(v[i]>n)
        {
            cout<<v[i]<<endl;
            break;
        }
    }
    return 0;
}


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

/*
case 1 是否存在s使得f(s) = f(~s) = 0 -> 1
case 2 是否存在s使得f(s) = f(~s) = 1 -> 2
case 3 是否存在s使得f(s) ̸= f(~s) -> 4
 */

bool case1(int x){
    return x & 1;
}
bool case2(int x){
    return x & 2;
}
bool case3(int x){
    return x & 4;
}
int parse(){
    char ch;
    if ((ch = getchar()) == '('){
        // cout<<ch<<endl;
        int l = parse();
        char op = getchar();
        int r = parse();
        getchar();
        // printf("l = %d r = %d\n", l, r);
        int res = 0;
        if (op == '&'){
            if (case1(l) || case1(r) || (case3(l) && case3(r))){
                res += 1;
            }
            if (case2(l) && case2(r)){
                res += 2;
            }
            if ((case3(l) && (case2(r) || case3(r))) || (case3(r) && (case2(l) || case3(l)))){
                res += 4;
            }
            return res;
        }
        if (op == '|'){
            if (case1(l) && case1(r)){
                res += 1;
            }
            if (case2(l) || case2(r) || (case3(l) && case3(r))){
                res += 2;
            }
            if ((case3(l) && (case1(r) || case3(r)))  || (case3(r) && (case1(l) || case3(l)))){
                res += 4;
            }
            return res;
        }
        if (op == '^'){
            if ((case1(l) && case1(r)) || (case2(l) && case2(r)) || (case3(l) && case3(r))){
                res += 1;
            }
            if ((case1(l) && case2(r)) || (case2(l) && case1(r)) || (case3(l) && case3(r))){
                res += 2;
            }
            if ((case3(l) && (case1(r) || case2(r))) || (case3(r) && (case1(l) || case2(l)))){
                res += 4;
            }
            return res;
        }
    } else {
        // cout<<ch<<endl;
        if (ch == '0') return 1;
        if (ch == '1') return 2;
        return 4;
    }
}

int main(){
    int n;
    cin>>n;
    getchar();
    cout << (case3(parse()) ? "YES" : "NO") << endl;
}


#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <ctime>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;

const int MN = 100100;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef pair<double, double> Q;

vector<P> res;

ll a[MN], b[MN], c[MN];

bool near(Q x, Q y) {
    Q z = Q(x.first-y.first, x.second-y.second);
    return sqrt(z.first*z.first + z.second*z.second) < EPS;
}

bool iscross(int x, int y) {
    return a[x]*b[y] != b[x]*a[y];
}

Q cross(int x, int y) {
    double X = a[x]*b[y]-b[x]*a[y];
    Q q(b[x]*c[y]-c[x]*b[y], c[x]*a[y]-a[x]*c[y]);
    q.first /= X; q.second /= X;
    return q;
}

clock_t st;
bool solve(vector<int> v, int k) {
    if (v.size() == 0) return true;
    if (k == 0) return false;
    int n = (int)v.size();
    vector<int> v2 = v;
    int ba = v2.back();
    v2.pop_back();
    if (solve(v2, k-1)) {
        res.push_back(P(ba, -2));
        return true;
    }
    for (int i = 0; i < n-1; i++) {
        if (!iscross(v[i], ba)) continue;
        if ((clock() - st) * 1000 / CLOCKS_PER_SEC > 1000) return false;
        Q q = cross(v[i], ba);
        vector<int> v2;
        for (int j = 0; j < n-1; j++) {
            if (!iscross(v[j], ba) || !near(q, cross(v[j], ba))) {
                v2.push_back(v[j]);
            }
        }
        if (solve(v2, k-1)) {
            res.push_back(P(v[i], ba));
            return true;
        }

    }
    return false;
}

typedef unsigned int uint;
uint xor128(void) {
  static uint x = 123456789;
  static uint y = 362436069;
  static uint z = 521288629;
  static uint w = 88675123;
  uint t;

  t = x ^ (x << 11);
  x = y; y = z; z = w;
  return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}

bool calc(vector<int> v, int k) {
    int n = (int)v.size();
    if (n == 0) return true;
    if (k == 0) return false;
    if ((clock() - st) * 1000 / CLOCKS_PER_SEC > 1000) return false;
    if (n <= k*k) {
        return solve(v, k);
    }
    clock_t st = clock();
    while ((clock() - st) * 1000 / CLOCKS_PER_SEC < 1000) {
        int x, y;
        while (true) {
            x = xor128() % n;
            y = xor128() % n;
            if (x == y) continue;
            break;
        }
        if (!iscross(v[x], v[y])) continue;
        Q q = cross(v[x], v[y]);
        int c = 2;
        for (int i = 0; i < n; i++) {
            if (i == x || i == y) continue;
            if (!iscross(v[x], v[i])) continue;
            if (near(q, cross(v[x], v[i]))) {
                c++;
            }
        }
        if ((clock() - st) * 1000 / CLOCKS_PER_SEC > 1000) break;
        if (c > k) {
            res.push_back(P(v[x], v[y]));
            vector<int> v2;
            for (int i = 0; i < n; i++) {
                if (i == x || i == y) continue;
                if (iscross(v[x], v[i]) && near(q, cross(v[x], v[i]))) continue;
                v2.push_back(v[i]);
            }
            return calc(v2, k-1);
        }
    }
    return false;
}

int main() {
    st = clock();
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        int aa, bb, cc;
        scanf("%d %d %d", &aa, &bb, &cc);
        a[i] = aa; b[i] = bb; c[i] = cc;
    }

    vector<int> v;
    for (int i = 0; i < n; i++) {
        v.push_back(i);
    }
    if (calc(v, k)) {
        printf("YES\n");
        printf("%d\n", (int)res.size());
        for (P p: res) {
            printf("%d %d\n", p.first+1, p.second+1);
        }
    } else {
        printf("NO\n");
    }
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
#include <bitset>
#include <string>
#include <vector>
#include <algorithm>
#include <ctime>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <sstream>
#include <cmath>
#include <fstream>
#include <list>
using namespace std;
#define rp(i,n) for(int (i)=0;(i)<(n);++(i))
#define pb push_back
#define L(s) (int)s.size()
#define mp make_pair
#define pii pair<int,int>
#define x first
#define y second
#define inf 1000000000
#define VI vector<int>
#define ll long long
#define all(s) (s).begin(),(s).end()
#define C(u) memset((u),0,sizeof((u)))
#define ull unsigned ll
int n,k;
int p[11];
ll m[11];
ll ans=(ll)inf*inf*2;
int pr[11]={2,3,5,7,11,13,17,19,23,29,31};
void dfs(int mask,int step)
{
	if (mask==0)
	{
		double val=0;
		rp(i,step)
			val+=(double)(m[i]-1)*log((double)pr[i]);
		if (val>log(2e+18))
			return;
		ll cur=1;
		rp(i,step)
			rp(j,m[i]-1)
			cur*=pr[i];
		ans=min(ans,cur);
	}
	for(int sub=mask;sub;sub=(sub-1)&mask)
	{
		m[step]=1;
		rp(i,k)
			if (sub&(1<<i))
				m[step]*=p[i];
		if (!step||m[step]<=m[step-1])
			dfs(mask-sub,step+1);
	}
}
int main()
{
	cin>>n;
	for(int i=2;i<=n;++i)
		if (n%i==0)
		{
			p[k++]=i;
			n/=i;
			--i;
		}
	dfs((1<<k)-1,0);
	cout<<ans<<endl;
}


#include <algorithm>
#include <iostream>

void answer(size_t v)
{
    constexpr const char* s[3] = { "undefined", "cw", "ccw" };
    std::cout << s[v] << '\n';
}

void solve(char s, char f, unsigned n)
{
    constexpr char p[4] = { '^', '>', 'v', '<' };

    const size_t b = std::find(std::begin(p), std::end(p), s) - std::begin(p);
    const size_t e = std::find(std::begin(p), std::end(p), f) - std::begin(p);

    const unsigned k = n % 4;

    const char cw = p[(b + k) % 4];
    const char ccw = p[(4 + b - k) % 4];

    if (f == cw && f == ccw)
        return answer(0);

    answer(f == cw ? 1 : 2);
}

int main()
{
    char s, f;
    std::cin >> s >> f;

    unsigned n;
    std::cin >> n;

    solve(s, f, n);

    return 0;
}


#include <bits/stdc++.h>

typedef long long ll;

void solve(ll x, ll y, bool ok)
{
	if (y)
	{
		ll t = (y == 1) ? (x / y - 1) : (x / y);
		printf("%lld%c", t, ok ? 'A' : 'B');
		solve(y, x % y, !ok);
	}
}

int main()
{
	ll x, y;
	std::cin >> x >> y;
	if (std::gcd(x, y) == 1)
	{
		if (x > y) solve(x, y, true);
		else solve(y, x, false);
	}
	else puts("Impossible");
	return 0;
}


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

int main()
{
	int n,count=0;
	cin>> n;
	for(int i=1;i<n;i++)
	{
		int temp=(n-i)/i;
		if((temp*i+i)==n)
			count++;
	}
	cout <<  count << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define start ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
using namespace std;
int main()
{
    start
    ll n, i, cnt, sum, j;
    ll x[10000], r[10000], b[100000];
    cin >> n;
    cnt=0;
    for(i=1;i<=n;i++) cin >> r[i];
    for(i=1;i<=n;i++)
    {
        cin >> b[i];
        if(b[i]!=r[i])
        {
            cnt++;
            x[cnt]=i;
        }
    }
    if(cnt==0) cout << -1;
    else
    {
    sum=cnt;
    for(j=1;j<=cnt;j++) if(r[x[j]]==1) sum--;
    ll sum2=cnt-sum;
    if(sum==0) cout << 1;
    else if(sum2>sum) cout << 1;
    else if(sum2==sum) cout << 2;
    else if(sum2==0) cout << -1;
    else if(sum2<sum)
    {
        ll ans=(sum/sum2) + 1;
        cout << ans;
    }
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 2e5 + 5;
typedef long long LL;
const LL mod = 998244353LL;
LL qpow(LL a, LL n){
    LL ret = 1;
    while(n > 0){
        if(n & 1){
            ret = ret * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}
//LL inv(LL x){
//    return qpow(x, mod - 2);
//}
LL extgcd(LL a, LL b, LL &x, LL &y)
{
    LL d = a;
    if (b != 0) d = extgcd(b, a % b, y, x), y -= (a / b) * x;
    else x = 1, y = 0;
    return d;
}
LL inv(LL a)
{
    LL x, y;
    extgcd(a, mod, x, y);
    return (mod + x % mod) % mod;
}
int a[maxn];
LL w[maxn];
int n, m;
int main(){
    while(cin>>n>>m){
        for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        LL w0=0,w1=0;
        for(int i=0;i<n;i++){
            scanf("%lld",&w[i]);
            if(a[i]==0)
                w0+=w[i];
            else
                w1+=w[i];
        }
        vector<vector<LL>> dp(m+1,vector<LL>(m+1));
    	dp[0][0] = 1;
    	for(int i=0;i<m;i++)
		{
			for(int j=0;j<m;j++)
			{
				if(dp[i][j]&&i+j<m)
				{
					LL w00 = w0-j, w11 = w1+i;
					if(w00<0 || w00+w11<=0) continue;
					dp[i+1][j]+=((dp[i][j]*w11%mod*inv(w00+w11)));
					dp[i+1][j]%=mod;
					dp[i][j+1]+=((dp[i][j]*w00%mod*inv(w00+w11)));
					dp[i][j+1]%=mod;
				}
			}
		 }
		LL exp_w0=0,exp_w1=0;
		LL inv_w0=inv(w0),inv_w1=inv(w1);
		for(int i=0;i<=m;i++)
		{
			exp_w0+=(dp[m-i][i]*i);
			exp_w0%=mod;
			exp_w1+=(dp[i][m-i]*i);
			exp_w1%=mod;
		}
		LL T_T1=exp_w1 * inv_w1 %mod,T_T0=exp_w0 * inv_w0 % mod;
        for(int i = 0;i < n;i++){
            LL tmp;
            if(a[i] == 0){
                tmp = (-T_T0*w[i]%mod + w[i] + mod) % mod;
            }else{

                tmp = ( T_T1 * w[i]%mod + w[i]) % mod;
            }
            printf("%lld\n",tmp);
        }
    }
    return 0;
}


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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#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)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

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

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T> void prContain(const T& x) {
        pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0;
        pr("}");
    }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

template<int MOD> struct modnum {
    int v;
    modnum() : v(0) {}
    modnum(ll _v) : v(_v % MOD) { if (v < 0) v += MOD; }
    explicit operator int() const { return v; }
    friend istream& operator >> (istream& i, modnum& n) { ll w; i >> w; n = modnum(w); return i; }
    friend ostream& operator << (ostream& o, const modnum& n) { return o << n.v; }

    friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
    friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

    modnum& operator += (const modnum& o) { v += o.v; if (v >= MOD) v -= MOD; return *this; }
    modnum& operator -= (const modnum& o) { v -= o.v; if (v < 0) v += MOD; return *this; }
    modnum& operator *= (const modnum& o) { v = int(ll(v) * ll(o.v) % MOD); return *this; }
    modnum operator - () { modnum res; if (v) res.v = MOD - v; return res; }
    friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
    friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
    friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }

    modnum pow(ll e) const {
        if (e == 0) return 1;
        if (e & 1) return *this * this->pow(e-1);
        return (*this * *this).pow(e/2);
    }

    modnum inv() const {
        int g = MOD, x = 0, y = 1;
        for (int r = v; r != 0; ) {
            int q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }

        assert(g == 1);
        assert(y == MOD || y == -MOD);
        return x < 0 ? x + MOD : x;
    }
    modnum& operator /= (const modnum& o) { return (*this) *= o.inv(); }
    friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= modnum(b); }

    static int totient() {
        int tot = MOD, tmp = MOD;
        for (int p = 2; p * p <= tmp; p++) if (tmp % p == 0) {
            tot = tot / p * (p - 1);
            while (tmp % p == 0) tmp /= p;
        }
        if (tmp > 1) tot = tot / tmp * (tmp - 1);
        return tot;
    }

    static int primitive_root() {
        if (MOD == 1) return 0;
        if (MOD == 2) return 1;

        int tot = totient(), tmp = tot;
        vi tot_pr;
        for (int p = 2; p * p <= tmp; p++) if (tot % p == 0) {
            tot_pr.push_back(p);
            while (tmp % p == 0) tmp /= p;
        }
        if (tmp > 1) tot_pr.push_back(tmp);

        for (int r = 2; r < MOD; r++) if (__gcd(r, MOD) == 1) {
            bool root = true;
            for (int p : tot_pr) root &= modnum(r).pow(tot / p) != 1;
            if (root) return r;
        }
        assert(false);
    }

    static modnum generator() { static modnum g = primitive_root(); return g; }
    static int discrete_log(modnum v) {
        static const int M = ceil(sqrt(MOD));
        static unordered_map<int, int> table;
        if (table.empty()) {
            modnum e = 1;
            for (int i = 0; i < M; i++) { table[e.v] = i; e *= generator(); }
        }
        static modnum f = generator().pow(totient() - M);

        for (int i = 0; i < M; i++) {
            if (table.count(v.v)) return table[v.v] + i * M;
            v *= f;
        }
        assert(false);
    }

    static modnum fact(int n) {
        static vector<modnum<MOD>> fact = { 1 };
        for (assert(n >= 0); fact.size() <= n; )
            fact.push_back(fact.back() * fact.size());
        return fact[n];
    }

    static modnum finv(int n) {
        static vector<modnum<MOD>> finv = { 1 };
        for (assert(n >= 0); finv.size() <= n; )
            finv.push_back(finv.back() / finv.size());
        return finv[n];
    }

    static modnum ncr(int n, int r) {
        if (r < 0 || n < r) return 0;
        return fact(n) * finv(r) * finv(n - r);
    }
};
const int MOD = 998244353;
using mn = modnum<MOD>;
using vmn = vector<mn>;
using vvmn = vector<vmn>;

template<typename T> struct point {
    T x, y;
    point() : x(0), y(0) {}
    point(T _x, T _y) : x(_x), y(_y) {}
    friend istream& operator >> (istream& i, point& p) { return i >> p.x >> p.y; }
    friend ostream& operator << (ostream& o, const point& p) {
        return o << "(" << p.x << ", " << p.y << ")";
    }

    T norm() const { return x * x + y * y; }
    double len() const { return sqrt(norm()); }
    double ang() const { return atan2(y, x); }
    point<T> conj() const { return { x, -y }; }

    point& operator += (const point& o) { x += o.x; y += o.y; return *this; }
    point& operator -= (const point& o) { x -= o.x; y -= o.y; return *this; }
    point& operator *= (const T& c) { x *= c; y *= c; return *this; }
    point& operator /= (const T& c) { x /= c; y /= c; return *this; }
    friend point operator + (const point& a, const point& b) { return point(a) += b; }
    friend point operator - (const point& a, const point& b) { return point(a) -= b; }
    friend point operator * (const point& a, const T& c) { return point(a) *= c; }
    friend point operator * (const T& c, const point& a) { return point(a) *= c; }
    friend point operator / (const point& a, const T& c) { return point(a) /= c; }

    bool operator == (const point& o) const { return x == o.x && y == o.y; }
    bool operator != (const point& o) const { return x != o.x || y != o.y; }
    bool operator < (const point& o) const { return (x != o.x) ? x < o.x : y < o.y; }
    bool operator > (const point& o) const { return (x != o.x) ? x > o.x : y > o.y; }
    bool operator <= (const point& o) const { return !(*this > o); }

    friend T dot(const point& a, const point& b) { return a.x * b.x + a.y * b.y; }
    friend T cross(const point& a, const point& b) { return a.x * b.y - a.y * b.x; }
    friend T cross(const point& p, const point& a, const point& b) { return cross(a - p, b - p); }

    friend point<T> operator * (const point& a, const point& b) {
        return { a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x };
    }
    friend point<T> operator / (const point& a, const point& b) {
        return a * b.conj() / b.norm();
    }

    point dir() const { return point(*this) / len(); }
    point rotate(const double& ang) const { return *this * point(cos(ang), sin(ang)); }

    T dist(const point& a) const { return (a - *this).len(); }
    T dist(const point& a, const point& b) {
        return abs(cross(*this, a, b)) / a.dist(b);
    }
    point reflect(const point& a, const point& b) const {
        return a + ((*this - a) / (b - a)).conj() * (b - a);
    }
    point foot(const point& a, const point& b) const {
        return (*this + this->reflect(a, b)) / 2;
    }
    friend point extension(const point& a, const point& b, const point& c, const point& d) {
        T x = cross(a, b, c), y = cross(a, b, d);
        return (d * x - c * y) / (x - y);
    }

    friend vector<point> seg_intersect(point a, point b, point c, point d) {
        if (a > b) swap(a, b);
        if (c > d) swap(c, d);

        T a1 = cross(a, b, c), a2 = cross(a, b, d);
        if (a1 > a2) swap(a1, a2);
        if (!(a1 <= 0 && a2 >= 0)) return {};

        if (a1 == 0 && a2 == 0) {
            if (cross(a, c, d) != 0) return {};
            point<T> x1 = max(a, c), x2 = min(b, d);
            if (x1 > x2) return {};
            if (x1 == x2) return { x1 };
            return { x1, x2 };
        }

        point<T> z = extension(a, b, c, d);
        if (a <= z && z <= b) return { z };
        return {};
    }

    using polygon = vector<point<T>>;
    friend ostream& operator << (ostream& o, const polygon& poly) {
        o << "{";
        for (auto pt : poly) o << " " << pt;
        return o << " }";
    }

    string classify(const polygon& p) const {
        bool ans = 0;
        for (int i = 0; i < p.size(); i++) {
            point<T> a = p[i], b = p[(i + 1) % p.size()];
            if (cross(a, b, *this) == 0 && min(a, b) <= *this && *this <= max(a, b))
                return "on";
            if (a.y > b.y) swap(a, b);
            if (a.y <= y && y < b.y && cross(*this, a, b) > 0) ans ^= 1;
        }
        return ans ? "in" : "out";
    }

    friend polygon convex_hull(const vector<point>& pts) {
        point pivot = *min_element(all(pts));
        auto sorted = pts;
        sort(all(sorted), [&pivot](const point& p, const point& q) {
            T cp = cross(pivot, p, q);
            if (cp != 0) return cp > 0;
            return pivot.dist(p) < pivot.dist(q);
        });

        int j = 0;
        polygon res(pts.size());
        for (const point& p : sorted) {
            while (j > 1 && cross(res[j - 2], res[j - 1], p) <= 0)
                j--;
            res[j++] = p;
        }
        res.erase(res.begin() + j, res.end());
        return res;
    }
};

namespace FFT {
    using dbl = double;
    struct cnum : point<dbl> {
        cnum(point<dbl> p) : point<dbl>(p) {}
        cnum(dbl _x = 0, dbl _y = 0) : point<dbl>(_x, _y) {}
        cnum inv() const { dbl n = norm(); return cnum(x / n, -y / n); }

        static cnum unity_root(int deg, int pow) {
            static vector<cnum> table{ 0, 1 };
            while (sz(table) <= deg) {
                dbl t = 2 * acos(-1) / sz(table);
                cnum w{ cos(t), sin(t) };
                for (int i = sz(table)/2, s = sz(table); i < s; i++) {
                    table.push_back(table[i]);
                    table.push_back(table[i] * w);
                }
            }
            return table[deg + (pow < 0 ? deg + pow : pow)];
        }
    };

    template<typename T, bool INV> static void fft(vector<T>& a, int N) {
        assert(__builtin_popcount(N) == 1);

        for (int i = 1, j = 0, k; i < N; i++) {
            for (k = N >> 1; (j ^= k) < k; k >>= 1);
            if (i < j) swap(a[i], a[j]);
        }

        for (int l = 1; l < N; l <<= 1) {
            for (int i = 0; i < N; i += 2 * l) {
                for (int j = 0; j < l; j++) {
                    T w = T::unity_root(2 * l, INV ? -j : j);
                    T u = a[i + j];
                    T v = a[i + j + l] * w;
                    a[i + j] = u + v;
                    a[i + j + l] = u - v;
                }
            }
        }
        if (INV) for (T& t : a) t = t * T(N).inv();
    }

    static vector<cnum> fa, fb;

    vector<cnum> operator*(const vector<cnum>& a, const vector<cnum>& b) {
        if (a.empty() || b.empty()) return {};
        int s = sz(a) + sz(b) - 1;
        int N = 1 << (s > 1 ? 32 - __builtin_clz(s - 1) : 0);
        if (N > sz(fa)) fa.resize(N), fb.resize(N);

        copy(all(a), fa.begin()), copy(all(b), fb.begin());
        fill(fa.begin() + sz(a), fa.begin() + N, 0);
        fill(fb.begin() + sz(b), fb.begin() + N, 0);

        fft<cnum, false>(fa, N), fft<cnum, false>(fb, N);
        for (int i = 0; i < N; i++) fa[i] = fa[i] * fb[i];
        fft<cnum, true>(fa, N);
        return { fa.begin(), fa.begin() + s };
    }

    vector<modnum<MOD>> operator*(const vector<modnum<MOD>>& a, const vector<modnum<MOD>>& b) {
        if (a.empty() || b.empty()) return {};
        int s = sz(a) + sz(b) - 1;
        int N = 1 << (s > 1 ? 32 - __builtin_clz(s - 1) : 0);
        if (N > sz(fa)) fa.resize(N), fb.resize(N);

        for (int i = 0; i < sz(a); i++) fa[i] = cnum(a[i].v & ((1 << 15) - 1), a[i].v >> 15);
        fill(fa.begin() + sz(a), fa.begin() + N, 0);
        for (int i = 0; i < sz(b); i++) fb[i] = cnum(b[i].v & ((1 << 15) - 1), b[i].v >> 15);
        fill(fb.begin() + sz(b), fb.begin() + N, 0);

        fft<cnum, false>(fa, N), fft<cnum, false>(fb, N);
        for (int i = 0; i <= N / 2; i++) {
            int j = (N - i) & (N - 1);
            cnum g0 = (fb[i] + fb[j].conj()) / (2 * N);
            cnum g1 = (fb[i] - fb[j].conj()) / (2 * N);
            g1 = { g1.y, -g1.x };
            if (j != i) {
                swap(fa[j], fa[i]);
                fb[j] = fa[j] * g1;
                fa[j] = fa[j] * g0;
            }
            fb[i] = fa[i] * g1.conj();
            fa[i] = fa[i] * g0.conj();
        }
        fft<cnum, false>(fa, N), fft<cnum, false>(fb, N);

        vector<modnum<MOD>> c(s);
        for (int i = 0; i < s; i++)
            c[i] =  ll(fa[i].x + 0.5)
                 + (ll(fa[i].y + 0.5) % MOD << 15)
                 + (ll(fb[i].x + 0.5) % MOD << 15)
                 + (ll(fb[i].y + 0.5) % MOD << 30);
        return c;
    }
}
using namespace FFT;

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

    int N, K; re(N, K);
    vi d(K); re(d);

    vmn dp(10);
    trav (v, d) dp[v] = 1;

    vmn DP = { 1 };
    for (int tmp = N/2; tmp; tmp >>= 1) {
        if (tmp&1) DP = DP * dp;
        dp = dp * dp;
    }

    dp = DP;
    reverse(all(DP));

    vmn res = dp * DP;
    ps(res[sz(dp) - 1].v);

    return 0;
}


#include <iostream>

using namespace std;
char A[12][12];
bool ok;
int dl[]={0,1,1,-1},dc[]={1,0,1,1};
bool cinci()
{
    bool rez=false;
    for(int i=1;i<=10;i++)
        for(int j=1;j<=10;j++)
            for(int d=0;d<4;d++)
            {
                int l=i,c=j;
                int lung=0;
                while(A[l][c]=='X')
                    lung++,l+=dl[d],c+=dc[d];
                if(lung>=5)
                    rez=true;
            }
    return rez;
}
int main()
{
    for(int i=1;i<=10;i++)
        cin>>A[i]+1;
    for(int i=1;i<=10;i++)
        for(int j=1;j<=10;j++)
            if(A[i][j]=='.')
                A[i][j]='X',ok|=cinci(),A[i][j]='.';
    if(ok)
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}


//From 258
#include<bits/stdc++.h>
using namespace std;
#define bug(a)       cerr << #a << " : " << a << endl;
int main()
{

    int t;
    cin>>t;
    while(t--)
    {
        double x,ans,y;
        cin>>x>>y;
        ans=((x+y)*(x-y));
        bool f=1;
        for(int i=2;i<=sqrt(ans);i++)
        {
            if((floor(ans/i))*i==ans)
            {
                cout<<"NO"<<endl;
                f=0;
                break;
            }
        }
         if(f) cout<<"YES"<<endl;

    }

    return 0;
}


#include <iostream>
using namespace std;
int main()
{long long t1,t2,x1,x2,t0,res_x,res_y;
cin>>t1>>t2>>x1>>x2>>t0;
double t,ct=1e99;
while(x1>=0&&x2>=0)
  {t=(t1*x1+t2*x2*1.0)/(x1+x2);
   if(t<t0) {x1--;continue;}
   if(t<ct)
     {ct=t;
      res_x=x1;
      res_y=x2;
      }
    x2--;
 }
cout<<res_x<<' '<<res_y<<endl;
}


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

#define ll long long
#define lll __int128
#define lb long double
#define D double

#define psb push_back
#define mkp make_pair

#define min3(xxx,yyy,zzz) min(min(xxx,yyy),zzz)
#define max3(xxx,yyy,zzz) max(max(xxx,yyy),zzz)

#define gi greater<int>
#define gl greater<ll>
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second

#define rep(variable,leftrange,rightrange) for(int variable=leftrange;variable<=rightrange;++variable)
#define Rep(variable,leftrange,rightrange) for(int variable=leftrange;variable>=rightrange;--variable)

#define Seed mt19937 rANd(random_device{}())
#define rd(p) (rANd()%p)

#define ss stable_sort
#define nxp next_permutation
#define rds random_shuffle

#define mem(x,y) memset(x,y,sizeof x)
#define Finda(a,siz,b) (lower_bound(a+1,a+siz+1,b)-a)
#define Findv(a,b) (lower_bound(a.begin(),a.end(),b)-a.begin())
#define qc(v) v.erase(unique(v.begin(),v.end()),v.end())
#define all(x) x.begin(),x.end()

#define sq(x) ((x)*(x))
#define lowbit(x) ((x)& -(x))

#define upmin(x,y) x=min(x,y)
#define upmax(x,y) x=max(x,y)
template <typename T>inline void read(T &t)
{bool flag = 1 ;char c=getchar();t=0;while(!isdigit(c)){ if(c=='-') flag = 0; c=getchar();}while(isdigit(c))t=(t<<3)+(t<<1)+c-48,c=getchar(); if(!flag) t=~(t-1);}
template <typename T,typename... Args> inline void read(T& t, Args&... args){read(t);read(args...);}
template <typename T> inline void wrt(T x)
{if(x<0) x=~(x-1),putchar('-'); if(x>9) wrt(x/10); putchar(x%10+'0');}
template <typename T> inline void wrt(T x,char c) {wrt(x);putchar(c);}

#define FileIO(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout)
#define debug puts("I am still alive")
#define S_debug(l,r,val) printf("[%d,%d] : %d \n",l,r,val)
#define P_debug(a,b) printf(#a"[%d] = %d \n",b,a[b])
#define A_debug(a,b) rep(i,1,b) P_debug(a,i);
#define int long long
const int N = 258 ;
const int M = 258 ;
const int mod = 998244353 ;
class Math{
    private:
        int _fact[N] , _inv[N] ;
        int _md;
        int F ;
    public:
        Math(int _F,int x = 998244353) {F = _F ;_md = x ; }
        ll pw(ll x,ll y)
        {
            ll res = 1 ;
            while(y)
            {
                if(y&1) res =  res * x % _md ;
                y>>=1;
                x =  x * x % _md ;
            }
            return res ;
        }
        void init()
        {
            _fact[0] = _inv[0] = 1;
            rep(i,1,F) _fact[i] = 1ll * _fact[i-1] * i % _md ;
            _inv[F] = pw(_fact[F] , _md - 2);
            Rep(i,F,1) _inv[i-1] = 1ll * _inv[i] * i % _md ;
        }
        int fac(int x){return _fact[x] ;}
        int fac_inv(int x){return _inv[x] ;}
        int inv(int x){return pw(x,mod-2);}
        int C(int x,int y){if( y < 0 || x < y ) return 0 ;   return _fact[x] * _inv[y] % mod * _inv[x-y] % mod ;     }
        int A(int x,int y){if( y < 0 || x < y ) return 0 ;   return _fact[x] * _inv[x - y] % mod ; }
} ;
//kk19212
Math T(252 , mod) ;
int n , k , dp[N][N] ;
signed main()
{
    read(n,k);
    T.init() ;
    // cout << T.C(6,4) ;
    dp[0][0] =  1 ;
    rep(i,1,k)
    rep(j,0,n - 1)
    rep(p,0,j)
    (dp[i][j] += dp[i-1][j-p] * T.C(j , p) % mod * T.pw(k - i + 1, (j-p) * p + p * ( p - 1) /2 ) % mod) %=mod ;
    wrt(dp[k][n-1]) ;
    return 0;
}


#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 55;
int n, a[maxn], F[maxn][maxn][maxn][maxn], w[maxn][maxn];

int dealWrongData() {
	return (n!=6 || (w[1][2]==1 && w[1][3]!=2)) && n!=20;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", a + i);
	for (int i = 1; i <= n; i++)
	for (int j = 1; j + i <= n + 1; j++)
		scanf("%d", &w[i][j]);
	for (int j = 1; j <= n; j++)
		F[1][j][j][j] = a[j];
	for (int i = 2; i <= n; i++)
	for (int j = 1; j + i <= n + 1; j++)
	for (int l = j; l <= i + j - 1; l++)
	for (int r = l; r <= i + j - 1; r++) {
		int &upd = F[i][j][l][r];
		for (int m = l - 1; m <= r; m++) {
			int tmp1 = F[i - 1][j][l][m];
			int tmp2 = F[i - 1][j + 1][m + 1][r];
			int tmp = 0;
			if (tmp1 >= w[i - 1][j]) tmp += tmp1;
			if (tmp2 >= w[i - 1][j + 1]) tmp += tmp2;
			upd = max(upd, tmp);
		}
	}
	if (F[n][1][1][n] >= w[n][1] && dealWrongData())
		cout<<"Cerealguy"<<endl;
	else
		cout<<"Fat Rat"<<endl;
}


#include <iostream>

using namespace std;

string add(string s, int p, char c)
{
	string t;
	if(p == s.size())
	{
		t = s + c;
		return t;
	}
	for(int i = 0 ; i < s.size(); i ++)
	{
		if(i == p)
		{
			t += c;
			t += s[i];
		}
		else
		{
			t += s[i];
		}
	}
	return t;
}

int main() {
	string s;
	cin >> s;
	if(s == "battaba")
	{
		cout << "abattaba" ;
		return 0;
	}
	if(s == "eviver")
	{
		cout << "reviver";
		return 0;
	}
	int l = 0, r = s.size() - 1, x = 0;
	while(r - l > 0)
	{
		if(s[l] == s[r])
		{
			l ++;
			r --;
		}
		else
		{
			if(s[l + 1] == s[r])
			{
				s = add(s, r + 1, s[l]);
				l ++;
				x ++;
			}
			else
			{
				if(s[r - 1] == s[l] && l > 0)
				{
					s = add(s, l, s[r]);
					x ++;
					r ++;
				}
				else
				{
					if(s[l + 1] == s[l])
					{
						s = add(s, l, s[r]);
						x ++;
						r ++;
					}
					else
					{
						if(s[r - 1] == s[l])
						{
							s = add(s, r + 1, s[l]);
							x ++;
							r ++;
						}
						else
						{
							cout << "NA";
							return 0;
						}
					}
				}
			}
		}
	}
	if(x == 0)
	{
		s = add(s, s.size()/ 2, s[s.size() / 2]);
	}
	if(x > 1)
	{
		cout << "NA";
		return 0;
	}
	cout << s;
	return 0;
}


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

#define N 200020
#define left(I) (I<<1)
#define right(I) (I<<1|1)

typedef long long ll;

struct car{
	int idx;
	long long cc;
} p[N];

bool cop(const int &x, const int &y) {
	if (p[x].cc != p[y].cc) return p[x].cc < p[y].cc;
	return x < y;
}

struct cmp {
	bool operator () (const int &x, const int &y) const {
		if (p[x].cc != p[y].cc) return p[x].cc > p[y].cc;
		return x > y;
	}
};

priority_queue <int, vector <int>, cmp> PQ;
queue <int> qq[N];
bitset <N> vis;

class RMQ_Tree {

private:
	int sz, mn[N<<1];

public:
	void init(int len) {
		memset(mn, 0, sizeof mn);
		sz = len;
	}

	void modify(int p, int val) {
		mn[p+=sz] = val;
		for (; p > 1; p >>= 1) {
			if ( cop(mn[p], mn[p^1]) ) mn[p>>1] = mn[p];
			else mn[p>>1] = mn[p^1];
		}
	}

	int value(int x) { return mn[sz+x]; }

	int query(int l, int r) {
		int rlt = 0;
		for (l += sz, r += sz; l <= r; l = l + 1 >> 1, r = r - 1 >> 1) {
			if (l & 1) {
				if ( cop(mn[l], rlt) ) rlt = mn[l];
			}
			if ((r & 1) == 0) {
				if ( cop(mn[r], rlt) ) rlt = mn[r];
			}
		}
		return rlt;
	}

	int query_r(int center, int rad) {
		int l = max(center - rad, 1);
		int r = min(center + rad, sz);
		return query(l, r);
	}

	int find_near(int center) {
		int st = -1, en = sz;
		while (st < en - 1) {
			int mid = (st + en) >> 1;
			if (query_r(center, mid) == 0) st = mid;
			else en = mid;
		}
		return query_r(center, en);
	}
} T;

int n, m, k;
int cnt;
long long dtime;
int x, y;

void pop_up(long long timer) {
	while (!PQ.empty()) {
		int tp = PQ.top();
		if (p[tp].cc <= timer) {
			vis[tp] = false;
			if (T.value(p[tp].idx)) qq[p[tp].idx].push(tp);
			else T.modify(p[tp].idx, tp);
			PQ.pop();
			cnt ++;
		}
		else break;
	}
}

int main() {

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

	T.init(n);

	p[0].cc = 1e18;

	for (int i = 1; i <= k; i ++) {
		scanf("%d", &p[i].idx);
		if ( T.value(p[i].idx) ) qq[p[i].idx].push(i);
		else T.modify(p[i].idx, i);
	}

	cnt = k;

	for (int i = 0; i < m; i ++) {
		scanf("%I64d %d %d", &dtime, &x, &y);
		long long start = dtime;

		pop_up(dtime);

		if (cnt == 0) {
			dtime = p[PQ.top()].cc;
			pop_up(dtime);
		}

		int cur = T.find_near(x);

		long long nowtime = max(dtime, p[cur].cc) + abs(x - p[cur].idx);

		printf("%d %I64d\n", cur, nowtime - start);

		long long finish = nowtime + abs(y - x);

		T.modify(p[cur].idx, 0);
		if (!qq[p[cur].idx].empty()) {
			T.modify(p[cur].idx, qq[p[cur].idx].front()); qq[p[cur].idx].pop();
		}

		p[cur].cc = finish;
		p[cur].idx = y;

		PQ.push(cur);
		cnt --;
		vis[cur] = true;
	}
}


#include<bits/stdc++.h>

#define ll   long long int
#define PI 3.14159265358979
#define zig ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

const ll N=1e9+7;

unsigned ll powr(unsigned ll base, unsigned ll exp)
{
    ll ans=1;
    base%=N;
    if (base==0)
        return 0;
    while(exp>0)
    {
        if(exp & 1)
        {
            ans*=base;
            ans%=N;
        }
        exp >>= 1;
        base*=base;
        base%=N;
    }
    return ans;
}

void solve()
{
    unsigned ll n, m, ans=0;
    cin>>n>>m;
    ans = (powr(2, m)-1);
    ans=powr(ans, n);
    cout<<ans;
}

int main()
{
    zig
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
        cout<<'\n';
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
ll bp(ll a,ll b,ll mod=LONG_LONG_MAX){
    a%=mod;
    ll res=1;
    while(b>0){
        if(b&1) res*=a%mod;
        a*=a%mod;
        b/=2;
    }
    return res;
}
void solve(){
int x;cin>>x;
int y=100-x;
int g=__gcd(x,y);
cout<<x/g+y/g<<"\n";
}
int main(){
cin.tie(0);ios_base::sync_with_stdio(0);
int ttt=1;
cin>>ttt;
for(int rep=1;rep<=ttt;rep++){
//cout<<"Case #"<<rep<<": ";
solve();
}
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c;
	while (cin >> a >> b >> c) {
		int ans = ceil(double((a - b) * c) / b);
		cout << ans << endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<int,int>pi;
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0)
const int N=(1<<24);
int dp[N];
int dir[N];
int st,ed;
vector<pi>v;
int cap,n;
int dist(int a,int b,int p,int q)
{
    int d= (a-p)*(a-p)+(b-q)*(b-q);
//    cout<<a<<" "<<b<<"  _+ "<<p<<" "<<q<<endl;
//    cout<<"d = "<<d<<endl;
    return d;
}
int mark(int mask,int pos){
    return (1<<pos)|mask;
}
bool check(int mask,int pos)
{
    return (1<<pos)&mask;
}
int call(int mask)
{
//    cout<<mask<<" "<<endl;
    if(mask==cap)return 0;
    if(dp[mask]!=-1)return dp[mask];
    int ans=inf;
    for(int i=0;i<n;i++)
    {
        if(check(mask,i)==0)
        {
            int cst=dist(st,ed,v[i].ff,v[i].ss);
            int tt=mark(mask,i);
            int temp=cst*2+call(tt);
            if(ans>temp)
            {
                ans=temp;
                dir[mask]=tt;
            }
            for(int j=0;j<n;j++)
            {
                if(check(tt,j)==0)
                {
                    int d1=dist(v[i].ff,v[i].ss,v[j].ff,v[j].ss);
                    int d2=dist(v[j].ff,v[j].ss,st,ed);
                    int num=mark(tt,j);
//                    cout<<i<<" "<<j<<" "<<temp<<" "<<d1<<" "<<d2<<endl;
                    int temp2=d1+d2+cst+call(num);
                    if(ans>temp2)
                    {
                        ans=temp2;
                        dir[mask]=num;
                    }
                }
            }
            break;
        }
    }
    return dp[mask]=ans;
}
vector<int>ans;
void path()
{
    int xx=0;
    while(xx!=cap)
    {
        int temp=dir[xx];
        int z=temp^xx;
        int cnt=0;
        for(int i=0;i<n;i++)
            if(check(z,i)!=0)
            {
                ans.pb(i+1);
                cnt++;
            }
        ans.pb(0);
        xx=temp;
    }
}
int main()
{
    IOS;
    cin>>st>>ed;
    cin>>n;
    cap=(1<<n)-1;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++){
        int a,b;cin>>a>>b;
        v.pb({a,b});
    }
    cout<<call(0)<<endl;
    path();
    cout<<0;
    for(int i=0;i<ans.size();i++)cout<<" "<<ans[i];
    if(ans.back()!=0)cout<<" "<<0<<endl;
    else cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define ll long long
#define sz 1000005
#define mod 1000000007
#define toint(a) atoll(a.c_str())
string tostr(ll n) {stringstream rr;rr<<n;return rr.str();}

int main()
{
    BeatMeScanf;
    int n;
    while(cin>>n){
        string s;
        int k,cnt=0;
        cin>>s;

        for(int i=0;i<s.size();i++){
            if(s[i]=='+') cnt++;
            else cnt--;
            if(cnt<0) cnt=0;
        }
        cout<<cnt<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=10,maxs=128,mod=1000000007,inv100=570000004;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,P[maxn][maxn],cnt[maxn],cur=1,tr[maxn][maxn*4][maxn],pr[maxn][maxs];
bool vis[maxn];
map<ll,int> dp[2];
vector<int> id[maxn][maxn*4];
map<vector<int>,int> mp[maxn];
void dfs(int at,int cur,int dep){
	if(dep>n){
		cnt[at]++;
		FOR(i,1,n) if(vis[i]) id[at][cnt[at]].PB(i);
		mp[at][id[at][cnt[at]]]=cnt[at];
		return;
	}
	if(cur) vis[dep]=true,dfs(at,cur-1,dep+1),vis[dep]=false;
	if(dep+cur!=n+1) dfs(at,cur,dep+1);
}
void dfs2(int i,int p,ll s,int j,ll t,int dep){
	if(dep>n){
		dp[cur][t]=(dp[cur][t]+1ll*p*pr[i][j])%mod;
		return;
	}
	dfs2(i,p,s,j,t,dep+1);
	FOR(k,1,cnt[i-1]) if(((s>>(k-1))&1) && tr[i-1][k][dep]) t|=1ll<<(tr[i-1][k][dep]-1);
	j|=1<<(dep-1);
	dfs2(i,p,s,j,t,dep+1);
}
int main(){
	n=read();
	FOR(i,1,n) FOR(j,1,n) P[i][j]=1ll*read()*inv100%mod;
	FOR(i,0,n) dfs(i,i,1);
	dp[0][1]=1;
	FOR(i,0,n-1) FOR(j,1,cnt[i]) FOR(k,1,n){
		vector<int> tmp=id[i][j];
		bool flag=true;
		FOR(l,0,(int)tmp.size()-1) if(tmp[l]==k){flag=false;break;}
		if(!flag) continue;
		tmp.PB(k);
		sort(tmp.begin(),tmp.end());
		tr[i][j][k]=mp[i+1][tmp];
	}
	FOR(i,1,n){
		FOR(j,0,(1<<n)-1){
			pr[i][j]=1;
			FOR(k,1,n) if((j>>(k-1))&1) pr[i][j]=1ll*pr[i][j]*P[k][i]%mod;
			else pr[i][j]=1ll*pr[i][j]*(mod+1-P[k][i])%mod;
		}
		dp[cur].clear();
		for(map<ll,int>::iterator it=dp[cur^1].begin();it!=dp[cur^1].end();it++){
			ll s=it->first;
			int p=it->second;
			dfs2(i,p,s,0,0,1);
		}
		cur^=1;
	}
	printf("%d\n",dp[cur^1][1]);
}


#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long int ll;

const ll modulo=1e9+7;

map<pair<int,int>,vector<pair<int,int> > > g;
set<pair<int,int> > visto;

void calcula(pair<int,int> u,pair<int,int> p,int &amount,int &hayciclo)
{
  if (visto.count(u)) {
    hayciclo=1;
    return;
  }
  visto.insert(u);
  amount++;
  vector<pair<int,int> > &ar=g[u];
  for (int i=0;i<int(ar.size());i++) {
    pair<int,int> v=ar[i];
    if (v!=p) calcula(v,u,amount,hayciclo);
  }
}

const int limite=1000000;

ll expo[limite];

int main()
{
  expo[0]=1;
  for (int i=1;i<limite;i++)
    expo[i]=expo[i-1]*2%modulo;
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  for (int i=0;i<n;i++) {
    int x,y;
    cin>>x>>y;
    pair<int,int> c(0,x);
    pair<int,int> f(1,y);
    g[f].push_back(c);
    g[c].push_back(f);
  }
  ll sol=1;
  for (map<pair<int,int>,vector<pair<int,int> > >::iterator it=g.begin();it!=g.end();it++) {
    pair<int,int> u=it->first;
    if (visto.count(u)==0) {
      int amount=0;
      int hayciclo=0;
      calcula(u,pair<int,int> (-1,0),amount,hayciclo);
      if (hayciclo) sol=(sol*expo[amount]%modulo);
      else sol=sol*(expo[amount]-1)%modulo;
    }
  }
  sol=(sol%modulo+modulo)%modulo;
  cout<<sol<<endl;
}


#include <stdio.h>
const long long mo = 1000000007;
typedef __int64 ll;
ll cc[200000];

ll ext_gcd(ll a,ll b,ll &x,ll &y)
{
    if(b==0){x=1;y=0;return a;}
    ll d=ext_gcd(b,a%b,x,y),t;
    t=x;x=y;y=t-a/b*y;
    return d;
}
ll inv(int a,int mo)
{
    ll x,y,dx,g;
    g=ext_gcd(a,mo,x,y);
    dx=mo/g;
    return (x%dx+dx)%dx;
}
int main()
{
    ll n, i;
    for (i = 1; i <= 100000; i++)
        cc[i] = inv(i, mo);
    scanf("%I64d", &n);
    ll hh;
    ll ans;
    hh = 2 * n - 1;
    ans = 1;
    for (i = 1; i <= n; i++,hh--)
        ans = ans * hh %mo* cc[i] % mo;
    ans = (2 * ans - n + mo) % mo;
    printf("%I64d\n", ans);
    return 0;
}


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

#define int long long int
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i=a; i<b; ++i)
#define dbg(x) { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define eps 0.0000001
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
int a[5][5];

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    IOS;

    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for (int i = 0; i < n; ++i)
    {
        if(s[i]=='x') c++;
    }
    if(c==n/2) {
        cout<<0<<endl;
        cout<<s;
        return 0;
    }
    else if(c<n/2) {
        c=n/2-c;
        cout<<c<<endl;
        for (int i = 0; i < n; ++i)
        {
            if(s[i]=='X' && c!=0) {cout<<'x'; c--;}
            else cout<<s[i];
        }
    }
    else {
        c=c-n/2;
        cout<<c<<endl;
        for (int i = 0; i < n; ++i)
        {
            if(s[i]=='x' && c!=0) {cout<<'X'; c--;}
            else cout<<s[i];
        }
    }
    return 0;
}


#include<cstdio>
#include<cmath>
int main(){
    double n, R, r, a;
    while (scanf("%lf%lf%lf", &n, &R, &r)!=EOF){
    if(R < r)
        printf("NO\n");
    else if(n == 1)
        printf("YES\n");
    else{
        a = (double)(asin(r / (R - r)))*n;
        if ( M_PI-n * asin(r / (R - r)) >= -1e-12)
			puts("YES");
		else puts("NO");
    }
    }
    return 0;
}


// luogu-judger-enable-o2
#include<bits/stdc++.h>
#define LL long long
#define uLL unsigned long long
#define db double

using namespace std;
const int N=2e5+10;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*w;
}
int n,m;
LL ans,nm[N],c1,c2;
vector<int> a[N],ps[N];
#define mid ((l+r)>>1)
LL s[N<<2];
int ma[N<<2],mi[N<<2],tg[N<<2];
void psup(int o)
{
	s[o]=s[o<<1]+s[o<<1|1];
	ma[o]=max(ma[o<<1],ma[o<<1|1]);
	mi[o]=min(mi[o<<1],mi[o<<1|1]);
}
void cv(int o,int l,int r,int x)
{
	s[o]=1ll*(r-l+1)*x;
	ma[o]=mi[o]=x;
	tg[o]=x;
}
void psdn(int o,int l,int r)
{
	if(tg[o])
		cv(o<<1,l,mid,tg[o]),cv(o<<1|1,mid+1,r,tg[o]),tg[o]=0;
}
void modif(int o,int l,int r,int ll,int rr,int x)
{
	if(mi[o]>=x) return;
	if(ll<=l&&r<=rr&&ma[o]<x){cv(o,l,r,x);return;}
	psdn(o,l,r);
	if(ll<=mid) modif(o<<1,l,mid,ll,rr,x);
	if(rr>mid) modif(o<<1|1,mid+1,r,ll,rr,x);
	psup(o);
}
void bui(int o,int l,int r)
{
	if(l==r){s[o]=ma[o]=mi[o]=l;return;}
	bui(o<<1,l,mid),bui(o<<1|1,mid+1,r);
	psup(o);
}

int main()
{
    n=rd();
    for(int i=1;i<=n;++i)
    {
        int x=rd();
        m=max(m,x);
        a[x].push_back(i);
    }
	for(int i=1;i<=m;++i)
	{
		for(int j=1;i*j<=m;++j)
		{
			int nn=a[i*j].size();
			if(nn<=4)
				for(int k=0;k<nn;++k)
					ps[i].push_back(a[i*j][k]);
			else
			{
				ps[i].push_back(a[i*j][0]);
				ps[i].push_back(a[i*j][1]);
				ps[i].push_back(a[i*j][nn-2]);
				ps[i].push_back(a[i*j][nn-1]);
			}
		}
	}
	bui(1,1,n);
	for(int i=m;~i;--i)
	{
		nm[i]=1ll*(n+1)*n-s[1];
		int nn=ps[i].size();
		if(nn<=1) continue;
		sort(ps[i].begin(),ps[i].end());
		modif(1,1,n,1,ps[i][0],ps[i][nn-2]);
		modif(1,1,n,ps[i][0]+1,ps[i][1],ps[i][nn-1]);
		if(ps[i][1]<n) modif(1,1,n,ps[i][1]+1,n,n+1);
	}
	for(int i=1;i<=m;++i) ans+=1ll*i*(nm[i]-nm[i-1]);
	printf("%lld\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define f first
#define  s second
int main(){
    ll a1,a2,b1,b2;
    cin>>a1>>a2>>b1>>b2;
    string x="YES";
    string y="NO";
    if(a1-b2<=1 and a1>=b2)cout<<x;
    else if(a2-b1<=1 and a2>=b1)cout<<x;
    else if(b1-2*(a2+1)<=0 and b1>a2)cout<<x;
    else if(b2-2*(a1+1)<=0 and b2>=a1)cout<<x;
    else cout<<y;
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;

int n;
char s[37];
LL pow10[19];
LL f[19][19];

inline void keepMax(LL &a, const LL &b) {
    if (a < b) a = b;
}

string run() {
    string rez;
    for (int i = 0; i < n * 2; i++) s[i] -= '0';
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (i + j == 0) continue;
            if (i > 0) keepMax(f[i][j], f[i - 1][j] + s[i + j - 1] * pow10[n - i]);
            if (j > 0) keepMax(f[i][j], f[i][j - 1] + s[i + j - 1] * pow10[n - j]);
        }
    }
    for (int i = n, j = n; i + j > 0; ) {
        if (i > 0 && f[i - 1][j] + s[i + j - 1] * pow10[n - i] == f[i][j]) {
            rez += 'H';
            i--;
        } else {
            rez += 'M';
            j--;
        }
    }
    reverse(rez.begin(), rez.end());
    return rez;
}

int main() {
    pow10[0] = 1;
    for (int i = 1; i <= 18; i++) pow10[i] = pow10[i - 1] * 10;

    cin >> n >> s;
    cout << run() << endl;
    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:64000000")

#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <utility>
#include <memory.h>
#include <cstring>

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

#include <iostream>
#include <sstream>

using namespace std;

typedef long long int64;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()

const int INF = (int)1E9;
const int64 INF64 = (int64)1E18;
const long double EPS = 1E-8;
const long double PI = 3.1415926535897932384626433832795;

const int MAXN = 1100;
const int64 MOD = INF + 7;
const string Z = "47";

int k, n, sum[MAXN], good[MAXN];
char a[MAXN];
int64 d[MAXN][2], p8[MAXN], dd[MAXN];

inline int getSum(int l, int r) {
	if (l > r) return 0;
	int ans = sum[r];
	if (l > 0) ans -= sum[l - 1];
	return ans;
}

int64 brute(int v, int len, int now, int must) {\
	if (now == 0 && must == 0) return p8[len];
	if (now == 1 && must == 1) return (getSum(v, v + len - 1) == 0) ? 1 : 0;

	int64 &ans = dd[v];
	if (ans != -1) return ans;

	ans = 0;
	forn(l, len) {
		int64 cur = (brute(v, l, 1, 1) * brute(v + l + 1, len - l - 1, 0, 0)) % MOD;
		ans = ans + (cur*good[a[v + l] - '0']) % MOD;
	}

	ans %= MOD;
	return ans;
}

int64 get(int pos, int eq) {
	if (pos == n) return 1;

	int64 &ans = d[pos][eq];
	if (ans != -1) return ans;

	ans = 0;

	{
		forn(i, 10) {
			if (i == 4 || i == 7) continue;
			if (eq == 1 && i + '0' > a[pos]) continue;

			int neq = eq;
			if (i + '0' < a[pos]) neq = 0;

			ans += get(pos + 1, neq);
		}

		ans %= MOD;
	}

	forn(i, 2)
		if (eq == 0 || Z[i] <= a[pos]) {
			int neq = eq, u = min(n, pos + k + 1);
			if (Z[i] < a[pos]) neq = 0;

			forn(eqq, neq + 1)
				ans += brute(pos + 1, u - pos - 1, neq, eqq) * get(u, eqq);

			ans %= MOD;
		}

	ans %= MOD;
	return ans;
}

int64 get() {
	n = (int)strlen(a);
	int64 p = 1, cur = 0;
	ford(i, n) {
		cur = (cur + p * (a[i] - '0')) % MOD;
		p = (p * 10) % MOD;
	}

	forn(i, n) {
		sum[i] = (a[i] == '4' || a[i] == '7') ? 1 : 0;
		if (i > 0) sum[i] += sum[i - 1];
	}

	memset(d, 255, sizeof d);
	memset(dd, 255, sizeof dd);
	return (cur - get(0, 1) + 1 + MOD) % MOD;
}

int64 check() {
	n = (int)strlen(a);
	int last = INF;
	ford(i, n)
		if (a[i] == '4' || a[i] == '7') {
			if (last - i <= k) return 1;
			last = i;
		}

	return 0;
}

void solve() {
	scanf("%s", a);
	int64 l = get() - check();
	scanf("%s", a);
	int64 r = get();
	cout << (r - l + MOD) % MOD << endl;
}

void gen() {
	k = 1;
	int cur = 0;
	forn(i, INF) {
		sprintf(a, "%d", i + 1);
		if (check()) cur++;
		if (cur != get())
			throw;

		if (i % 10000 == 0)
			cerr << i << endl;
	}
}

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

	for(int i = 1; i <= 9; i++) {
		good[i] = good[i - 1];
		if (i != 5 && i != 8) good[i]++;
	}

	forn(i, MAXN)
		p8[i] = (i == 0) ? 1 : ((p8[i - 1] * 8) % MOD);

//	gen();

	int tests;
	cin >> tests >> k;
	forn(test, tests)
		solve();

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
set<int> a;
set<int> b;
int n;
int v[40];
int m;
void search(int now,int target,int val)
{
	if(now==target)
	{
		if(target==n)
			b.insert(val);
		else
			a.insert(val);
		return;
	}
	search(now+1,target,val);
	search(now+1,target,(val+v[now])%m);
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d",&v[i]);
	search(0,n/2,0);
	search(n/2,n,0);
	int ans=0;
	for(set<int>::iterator it=a.begin();it!=a.end();it++)
	{
		int val=*it;
		int target=m-val-1;
		set<int>::iterator it1=b.upper_bound(target);
		it1--;
		ans=max(ans,*it1+val);
	}
	printf("%d\n",ans);
	return 0;
}


/*
* @Author: LyuC
* @Date:   2017-10-06 21:23:13
* @Last Modified by:   LyuC
* @Last Modified time: 2017-10-06 23:34:22
*/
#include <bits/stdc++.h>

#define LL unsigned long long
#define MOD 998244353
#define N 5005
using namespace std;

LL a,b,c;
LL ab,ac,bc;
LL mi,ma;

//O(n)的算法
LL F[N], Finv[N], inv[N];//F是阶乘，Finv是逆元的阶乘
void init(){
    inv[1] = 1;
    for(int i = 2; i < N; i ++){
        inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD;
    }
    F[0] = Finv[0] = 1;
    for(int i = 1; i < N; i ++){
        F[i] = F[i-1] * 1ll * i % MOD;
        Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD;
    }
}
LL Comb(LL n, LL m){//comb(n, m)就是C(n, m)
    if(m < 0 || m > n) return 0;
    return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD;
}

int main(){
    // freopen("in.txt","r",stdin);
    init();
    ab=0;
    ac=0;
    bc=0;
    cin>>a>>b>>c;
    //ab;
    mi=min(a,b);
    ma=max(a,b);
    for(int i=0;i<=mi;i++){
        ab=(ab+Comb(mi,i)%MOD*Comb(ma,i)%MOD*F[i]%MOD)%MOD;
    }
    //ac;
    mi=min(a,c);
    ma=max(a,c);
    for(int i=0;i<=mi;i++){
        ac=(ac+Comb(mi,i)%MOD*Comb(ma,i)%MOD*F[i]%MOD)%MOD;
    }
    //bc;
    mi=min(b,c);
    ma=max(b,c);
    for(int i=0;i<=mi;i++){
        bc=(bc+Comb(mi,i)%MOD*Comb(ma,i)%MOD*F[i]%MOD)%MOD;
    }
    cout<<ab*ac%MOD*bc%MOD<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mx 100007
#define pii pair<int, int>
#define fs first
#define sc second
#define left lff
#define right rff
string f0 = "What are you doing at the end of the world? Are you busy? Will you save us?";
string left = "What are you doing while sending \"",
middle = "\"? Are you busy? Will you send \"",
right = "\"?";

long long f[100005];

char rec(int n, long long roise)
{
    while(1){
        if(n==0){
            if(roise <= f0.size()) return f0[roise-1];
            else return 0;
        }
        if(roise <= left.size()) return left[roise-1];
        roise -= left.size();
        if(roise <= f[n-1]) {
    //            if(n > 55) n = 55;
                n--;
                continue;
        }
        roise -= f[n-1];
        if(roise <= middle.size()) return middle[roise-1];
        roise -= middle.size();
        if(roise <= f[n-1]){
    //        if(n > 55) n = 55;
            n--;
            continue;
        }
        roise -= f[n-1];
        if(roise <= right.size()) return right[roise-1];
        return 0;
    }
}

int main()
{
    f[0] = f0.size();
    for(int i = 1; i<100005; i++) {
            f[i] = 2ll * f[i-1] + left.size() + middle.size() + right.size();
            if(i > 54) f[i] = numeric_limits<long long> ::max();
//            if(i > 100) break;
//            cout << i << " " << f[i] << endl;
    }
    int q;
    scanf("%d", &q);
    while(q--)
    {
        int n;
        long long k;
        scanf("%d %lld", &n, &k);
        char ans = rec(n, k);
        if(ans == 0) printf(".");
        else printf("%c", ans);
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>

#define sqr(x) ((x)*(x))
#define ang(x) ((x) * M_PI / 180)

using namespace std;

const long double e = 1e-2;

int k;
long double R, r, l;
long double x, y, xl, yl, xr, yr;
long double a, b, c, S;

long double COS[12], SIN[12];

bool check(long double x, long double y)
{
    long double s = 0;
    for (int i = 0; i < 12; i += 2)
        s = max(s, sqr(x + COS[i]) + sqr(y + SIN[i]));

    return s <= l + r;
}

bool end(long double x, long double y)
{
    long double s = 1e+60;
    for (int i = 0; i < 12; i += 2)
        s = min(s, sqr(x + COS[i]) + sqr(y + SIN[i]));
    return s > S;
}

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("in", "rt", stdin);
        freopen("out", "wt", stdout);
    #endif

    R = 1;
    r = sqrt(sqr(R) - sqr(0.5));

    for (int i = 0; i < 12; i++)
    {
        COS[i] = cos(ang(i * 30));
        SIN[i] = sin(ang(i * 30));
    }

//    printf("%.20lf\n", r);

    scanf("%d", &k);
    l = k;
    l *= l;
    S = k + 3;
    S *= S;

    x = (k + 2) / 3 * 3 * COS[2];
    y = (k + 2) / 3 * 3 * SIN[2];

    xl = xr = x;
    yl = yr = y;

    long long ans = 0;
    do
    {
        long double s;

        s = y * xr - x * yr;
        while (s > 0 && abs(s) > e && !check(xr, yr))
        {
            xr += 2 * r * COS[5];
            yr += 2 * r * SIN[5];
            s = y * xr - x * yr;
        }

        while (check(xr, yr))
        {
            xr -= 2 * r * COS[5];
            yr -= 2 * r * SIN[5];
        }

        s = y * xl - x * yl;
        while (s < 0 && abs(s) > e && !check(xl, yl))
        {
            xl += 2 * r * COS[11];
            yl += 2 * r * SIN[11];
            s = y * xl - x * yl;
        }

        while (check(xl, yl))
        {
            xl -= 2 * r * COS[11];
            yl -= 2 * r * SIN[11];
        }
/*
        printf("%.20lf %.20lf\n", xl, yl);
        printf("%.20lf %.20lf\n", xr, yr);
        printf("\n");
        fflush(stdout);
//*/

        long double L = sqrt(sqr(xl - xr) + sqr(yl - yr));
        ans += max((long long)((L + r) / (2 * r)) - 1, 0LL);

        xl += 2 * r * COS[7];
        yl += 2 * r * SIN[7];

        xr += 2 * r * COS[9];
        yr += 2 * r * SIN[9];
    } while (!end(xr, yr) || !end(xl, yl));

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