//***********************************************************//
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define forr(i,a,n)  for(ll i=a;i<n;i++)
#define forrr(i,a,n) for(ll i=a;i<=n;i++)
#define bp(n) __builtin_popcount(n)   // prints one's in binary representation
#define w(t)  int t;cin>>t;while(t--)
#define lc "\n"
#define men(a) (*min_element(a.begin(), a.end()))
#define mex(a) (*max_element(a.begin(), a.end()))
#define deb(x) cout << #x << " " << x << endl ;
#define all(x) x.begin(), x.end()
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
const ll  MOD =1e9+7;
const ll INF = 1e18;
const int N = 100001;
//*********************************************************//

void solve()
{
   ll n ;
   cin >> n ;
   vector<ll>v(n) ;
   multiset < int > s ;
   forr(i,0,n){
       cin >> v[i] ;
       s.insert( v[i] ) ;
   }
   ll ans = 1 ;
   int c = 0 ;
   ll prev = 0 ;
   for(auto i : s ){

           if(c == 0 ){
               ll  y = i - 0 + 1 ;
               ans = (ans%MOD)*y ;
               prev = i ;
               c++;
           }
           else{

               ans = ((ans)%MOD)*(i - prev + 1) ;
               prev = i ;
           }
   }
   cout << (ans)%MOD << endl ;

}

int main()
{

IOS;
//w(t)
{solve();}
// end_routine();
return 0;
 }

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

const int INF = 1e9;
const ll INF2 = 1e18;
const double PI = 3.141592653589793;

int main() {
    const int div = 1e9 + 7;

    int n;
    ll ans = 1;
    cin >> n;

    vector<int> A(n, 0);
    vector<int> B(n, 0);
    for(int i = 0; i < n; i++){
        cin >> A.at(i);
    }

    sort(A.begin(), A.end());
    B.at(0) = A.at(0);
    for(int i = 1; i < n; i++){
        B[i] = A[i] - A[i-1];
    }

    for(int b: B){
        ans *= b+1;
        ans %= div;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <chrono>

#define int long long
#define ld long double
#define db double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define debx cout << " X " << endl;
#define deby cout << " Y " << endl;
#define debz cout << " Z " << endl;

using namespace __gnu_pbds;
using namespace std;
using namespace chrono;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
/*
    find_by_order() - Returns an iterator to the k-th largest element (counting from zero)
    order_of_key()  - The number of items in a set that are strictly smaller than our item
    Rest same as set
*/

void deb_out() {
    cout << endl;
}
template <typename Head, typename... Tail>
void deb_out(Head H, Tail... T) {
    cout << " " << H;
    deb_out(T...);
}
#ifdef LOCAL
    #define deb(...) cout << "[" << #__VA_ARGS__ << "]:", deb_out(__VA_ARGS__);
#else
    #define deb(...)
#endif

const long double PI = 3.14159265358979323846264338;
const long long INF = 1000000000000000000;
const long long INF1 = 1000000000;
const long long MOD = 1000000007;
// const long long MOD = 998244353;

int mpow(int a, int b){
    a %= MOD;
    if(!b)
        return 1;
    int temp = mpow(a, b / 2);
    temp = (temp * temp) % MOD;
    if(b % 2)
        return (a * temp) % MOD;
    return temp;
}
int _pow(int a, int b){
    if(!b)
        return 1;
    int temp = _pow(a, b / 2);
    temp = (temp * temp);
    if(b % 2)
        return (a * temp);
    return temp;
}
inline int mod_in(int n){
    return mpow(n, MOD - 2);
}
inline int cl(int a, int b){
    if(a % b)
        return 1 + a / b;
    return a / b;
}
inline int rnd(int l = -INF, int r = INF){
    int v = rng();
    v = abs(v);
    return l + v % (r - l + 1);
}
int32_t main(){
    fastio;
    int Tests = 1;
    // cin >> Tests;
    while (Tests--) {
        int a, b;
        cin >> a >> b;
        cout << 2 * a + 100 - b << endl;
    }
}

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

const int N = 200 + 1;

bool possible[N];
int id[N];
int a[N];
int b[N];

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

  int n;
  cin >> n;

  fill(id, id + 2 * n, -1);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    if (a[i] != -1) {
      if (id[--a[i]] != -1) {
        cout << "No\n";
        exit(0);
      }
      id[a[i]] = i;
    }
    if (b[i] != -1) {
      if (id[--b[i]] != -1) {
        cout << "No\n";
        exit(0);
      }
      id[b[i]] = i;
    }
  }

  possible[2 * n] = true;
  for (int i = 2 * n - 2; i >= 0; i -= 2) {
    for (int j = 1; i + 2 * j <= 2 * n && !possible[i]; ++j) {
      if (!possible[i + 2 * j]) {
        continue;
      }

      bool ok = true;
      for (int k = 0; k < j && ok; ++k) {
        int l = i + k;
        int r = i + k + j;

        if (id[l] != -1 && a[id[l]] != l) {
          ok = false;
        }

        if (id[r] != -1 && b[id[r]] != r) {
          ok = false;
        }

        if (id[l] != id[r]) {
          if (id[l] != -1 && id[r] != -1) {
            ok = false;
          } else if (id[l] == -1) {
            ok &= (a[id[r]] == -1);
          } else {
            ok &= (b[id[l]] == -1);
          }
        }
      }

      possible[i] |= ok;
    }
  }

  cout << (possible[0] ? "Yes" : "No") << "\n";
}


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

using namespace std;

using i64 = int64_t;
using u64 = uint64_t;
using i32 = int32_t;
using pi64 = pair<i64, i64>;

#define vec vector
#define let const
#define DRi64(x) i64 x; cin >> x;
#define DRS(x) string x; cin >> x;
#define DRVi64(v, n) vec<i64> v(n); { for (i64 i = 0; i < n; ++i) { cin >> v[i]; }}
#define DRpi64(x) pi64 x; cin >> x.first >> x.second;

#ifdef DEBUG
#define P(x) cerr << x << "\n"
#else
#define P(x)
#endif

constexpr i64 MAXN = 3*100*1000LL+5LL;
constexpr i64 MOD = 1000000007LL;
constexpr i64 INF64 = MOD * MOD;

int
main()
{
    ios_base::sync_with_stdio(false);

    DRi64(N);
    vec<double> dp(N + 1);
    dp[1]  = 0;
    for (i64 i = 2; i <= N; ++i)
    {
        dp[i] = dp[i - 1] + N / double(N - i + 1);
    }
    cout << fixed << setprecision(12) << dp.back() << "\n";

    return 0;
}

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(int i=cc;i>=n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>

using ll = long long;

const vector<int> dx = {1, 0, -1,  0};
const vector<int> dy = {0, 1,  0, -1};

const vector<int> dx2 = {1, 1,  1, 0,  0, 0, -1, -1, -1};
const vector<int> dy2 = {1, 0, -1, 1, -1, 0,  1,  0, -1};

const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
const ll mod2 = 998244353;

const ll MAX = 1000000;
const int MOD = 1000000007;
const ll big = (1ll<<60);

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }

int main(){
  int n;
  cin >> n;
  double ans = 0;
  rep(i, 1, n){
    ans += (double)(n)/(n-i);
  }
  cout << fixed << setprecision(10) << ans << endl;
}


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

typedef long long int ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> Pair;
typedef vector<Pair> VP;
typedef vector<string> VS;
typedef vector<char> VC;
//typedef modint1000000007 mint;
//typedef modint998244353 mint;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
#define RREP(i, n, e) for(int i = (int)(n); i>= e; i--)
#define all(a) (a).begin(), (a).end()
#define VEC(n, x) VI n(x); rep(i, x) cin >> n[i];
#define MAT(m, x, y) VVI m(x, VI(y)); rep(i, x) rep(j, y) cin >> m[i][j];
#define FIX cout << fixed << setprecision(10);
#define out(x) cout << (x) << endl;
#define fin(x) { out(x); return 0; }
#define IN(x, l, r) ((l) <= (x) && (x) < (r))

const VP dir4 = { { -1, 0 }, { 1, 0 }, { 0, 1 }, { 0, -1 } };
const VP dir8 = { { -1, 0 }, { -1, 1 }, { 0, 1 }, { 1, 1 }, { 1, 0 }, { 1, -1 }, { 0, -1 }, { -1, -1 } };

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

int main () {
  int A, B, C, D; cin >> A >> B >> C >> D;
  out(B - C);
  return 0;
}

#include<iostream>
using namespace std;

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

	cout << b - c << endl;

	return 0;
}


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

/*<DEBUG>*/
#define tem template <typename
#define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i)
#define _op debug& operator<<
tem C > auto test(C *x) -> decltype(cerr << *x, 0LL);
tem C > char test(...);
tem C > struct itr{C begin, end; };
tem C > itr<C> get_range(C b, C e) { return itr<C>{b, e}; }
struct debug{
#ifdef _LOCAL
	~debug(){ cerr << endl; }
	tem T > can_shift(T, ==){ cerr << boolalpha << i; return *this; }
	tem T> can_shift(T, !=){ return *this << get_range(begin(i), end(i)); }
	tem T, typename U > _op (pair<T, U> i){
		return *this << "< " << i.first << " , " << i.second << " >"; }
	tem T> _op (itr<T> i){
		*this <<  "{ ";
		for(auto it = i.begin; it != i.end; it++){
			*this << " , " + (it==i.begin?2:0) << *it;
		}
		return *this << " }";
	}
#else
tem T> _op (const T&) { return *this; }
#endif
};

string _ARR_(int* arr, int sz){
	string ret = "{ " + to_string(arr[0]);
	for(int i = 1; i < sz; i++) ret += " , " +  to_string(arr[i]);
	ret += " }"; return ret;
}

#define exp(...) " [ " << #__VA_ARGS__ << " : " << (__VA_ARGS__) << " ]"
/*</DEBUG>*/

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pii;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pb push_back
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define TC int __TC__; cin >> __TC__; while(__TC__--)
#define ar array

const ll M = 998244353LL, N = 50;

int g[N][N];

inline ll mul(ll a, ll b){
	return (a * b) % M;
}

inline ll fact(ll x){
	ll ans = 1;
	for(ll i = 1; i <= x; ++i) ans = mul(ans, i);
	return ans;
}

struct DSU{
	vector<int> p, sz;
	int cnt;
	void init(int n){
		p.resize(n); sz.resize(n);
		iota(p.begin(), p.end(), 0);
		fill(sz.begin(), sz.end(), 1);
		cnt = n;
	}

	int find(int u){
		return (p[u] == u ? u : p[u] = find(p[u]));
	}

	bool unite(int u, int v){
		u = find(u);
		v = find(v);
		if(u == v) return 0;
		p[v] = u;
		sz[u] += sz[v];
		--cnt;
		return 1;
	}

	ll size(int u){
		u = find(u);
		return sz[u];
	}
};

int main(void)
{
	FAST;
	DSU c, r;
	int n, k; cin >> n >> k;
	c.init(n);
	r.init(n);

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

	for(int i = 0; i < n; ++i){
		for(int j = i+1; j < n; ++j){
			bool okr = 1, okc = 1;
			for(int x = 0; x < n; ++x){
				if(g[i][x] + g[j][x] > k) okr = 0;
				if(g[x][i] + g[x][j] > k) okc = 0;
			}

			if(okr) r.unite(i, j);
			if(okc) c.unite(i, j);
		}
	}
	vector<bool> visr(n, 0), visc(n, 0);
	ll rows = 1, cols = 1;

	for(int i = 0; i < n; ++i){
		int curr = r.find(i), curc = c.find(i);
		if(!visr[curr]) rows = mul(rows, fact(r.size(curr))), visr[curr] = 1;
		if(!visc[curc]) cols = mul(cols, fact(c.size(curc))), visc[curc] = 1;
	}

	cout << mul(rows, cols) << '\n';

	return 0;
}

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

const int maxN = 55, mod = 998244353;

int n, lim;
int pa[maxN + 1], a[maxN + 1][maxN + 1];
int fac[maxN + 1], sz[maxN + 1];

inline int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }

int main()
{
	scanf("%d %d", &n, &lim);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			scanf("%d", &a[i][j]);

	fac[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = 1ll * fac[i - 1] * i % mod;

	int ans = 1;
	for(int i = 1; i <= n; i++) pa[i] = i, sz[i] = 0;
	for(int i = 1; i <= n; i++)
		for(int j = i + 1; j <= n; j++)
		{
			bool flag = true;
			for(int k = 1; k <= n; k++)
				if(a[i][k] + a[j][k] > lim) { flag = false; break; }
			if(flag) pa[ find(i) ] = find(j);
		}
	for(int i = 1; i <= n; i++) sz[ find(i) ] ++;
	for(int i = 1; i <= n; i++)
		if(find(i) == i) ans = 1ll * ans * fac[ sz[i] ] % mod;

	for(int i = 1; i <= n; i++) pa[i] = i, sz[i] = 0;
	for(int i = 1; i <= n; i++)
		for(int j = i + 1; j <= n; j++)
		{
			bool flag = true;
			for(int k = 1; k <= n; k++)
				if(a[k][i] + a[k][j] > lim) { flag = false; break; }
			if(flag) pa[ find(i) ] = find(j);
		}
	for(int i = 1; i <= n; i++) sz[ find(i) ] ++;
	for(int i = 1; i <= n; i++)
		if(find(i) == i) ans = 1ll * ans * fac[ sz[i] ] % mod;

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


#include <bits/stdc++.h>
typedef long long LL;
#define lowbit(x) (x & (-x))

const LL inf  = 1e17+9;
const LL mod  = 1e9+7;
const LL maxn = 2e2+8;

LL n, m, fa[maxn];
double x[maxn], y[maxn], hi[maxn], lo[maxn];

LL find(LL u) {
    if (fa[u] == u) return u;
    return fa[u] = find(fa[u]);
}

void solve() {
    LL i, j;
    double h = 100, l = 0, mid;
    scanf("%lld", &n);
    for (i = 1; i <= n; i++) scanf("%lf%lf", &x[i], &y[i]);
    while (l < h) {
        mid = (h + l) / 2;
        for (i = 1; i <= n; i++) {
            fa[i] = i; hi[i] = y[i]; lo[i] = y[i];
        }
        for (i = 1; i <= n; i++) {
            for (j = i + 1; j <= n; j++) {
                if ((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) < 4 * mid * mid) {
                    LL fi = find(i), fj = find(j);
                    fa[fj] = fi;
                    hi[fi] = std::max(hi[fi], hi[fj]);
                    lo[fi] = std::min(lo[fi], lo[fj]);
                }
            }
            if (100.0 - hi[find(i)] < 2.0 * mid && lo[find(i)] + 100.0 < 2.0 * mid) break;
        }
        if (i <= n) h = mid - 1e-6;
        else l = mid + 1e-6;
    }
    printf("%.10lf\n", h);
}

signed main() {
    LL t = 1; // scanf("%lld", &t);
    while (t--) solve();
    return 0;
}

#include <bits/stdc++.h>

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

using namespace std;

class union_find{
	int n;
	vector<int> p;
public:
	union_find(int n):n(n),p(n,-1){}
	int find(int u){ return p[u]<0?u:p[u]=find(p[u]); }
	void unite(int u,int v){
		u=find(u); v=find(v);
		if(u!=v){
			if(p[v]<p[u]) swap(u,v);
			p[u]+=p[v]; p[v]=u; n--;
		}
	}
	bool is_same(int u,int v){ return find(u)==find(v); }
	int size()const{ return n; }
	int size(int u){ return -p[find(u)]; }
};

struct edge{
	int u,v,cost;
	edge(){}
	edge(int u,int v,int cost):u(u),v(v),cost(cost){}
	bool operator<(const edge& e)const{ return cost<e.cost; }
};

int main(){
	int n; scanf("%d",&n);
	vector<int> x(n),y(n);
	rep(i,n) scanf("%d%d",&x[i],&y[i]);

	int s=n,t=n+1;
	vector<edge> E;
	rep(i,n) for(int j=i+1;j<n;j++) {
		E.emplace_back(i,j,(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
	}
	rep(i,n){
		E.emplace_back(s,i,(100-y[i])*(100-y[i]));
		E.emplace_back(i,t,(y[i]+100)*(y[i]+100));
	}

	sort(E.begin(),E.end());

	union_find U(n+2);
	for(auto e:E){
		U.unite(e.u,e.v);
		if(U.is_same(s,t)){
			printf("%.9f\n",sqrt(e.cost)/2);
			break;
		}
	}

	return 0;
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H){
        cin >> S[i];
    }

    ll ans = 0;
    rep(i, H){
        rep(j, W-1){
            if(S[i][j] == '.' && S[i][j+1] == '.'){
                ans++;
            }
        }
    }

    rep(i, W){
        rep(j, H-1){
            if(S[j][i] == '.' && S[j+1][i] == '.'){
                ans++;
            }
        }
    }

    cout << ans;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endll "\n"
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#define ull unsigned long long
#define rep(i,b) for(int i=0;i<b;i++)
#define For(i, a, b) for(int i=a;i<=b;i++)
#define Rof(i, a, b) for(int i=a;i>=b;i--)
#define rest(a, b) memset(a,b, sizeof(a));
#define recopy(a, b) memcpy(b, a, sizeof(a));
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
int gcd(int a, int b) {while (b ^= a ^= b ^= a %= b);return a;}//最大公约数
ll gcd(ll a, ll b) {while (b ^= a ^= b ^= a %= b);return a;}
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N=1e5+50;
const int maxx=1e7;
int vis1[N],vis2[N];
int a[N],b[N],c[N];
int main(){
    int n,m;
    cin>>n>>m;
    rest(vis1,0)
    rest(vis2,0)
    int k=0;
    rep(i,n){
        cin>>a[i];
        vis1[a[i]]=1;
    }
    rep(i,m){
        cin>>b[i];
        vis2[b[i]]=1;
    }
    rep(i,n)
    {
        if(vis2[a[i]]==0)
        {
            c[k++]=a[i];
        }
    }
    rep(i,m){
        if(vis1[b[i]]==0){
            c[k++]=b[i];
        }
    }
    sort(c,c+k);
    rep(i,k){
        cout<<c[i]<<" ";
    }
    return 0;
}


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

#include <iostream>
#include <fstream>

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

inline int inint(istream& in) {int x; in >> x; return x;}
inline ll inll(istream& in) {ll x; in >> x; return x;}
inline string instr(istream& in) {string x; in >> x; return x;}

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

class AKcal {
public:
void solve(std::istream& in, std::ostream& out) {
    int a = inint(in);
    int b = inint(in);

    out << 1.0 * a * b / 100 << endl;

}
};

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

#include <bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define LL long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
long double a,b;
int main(){
	cin>>a>>b;
	cout<<a*b/100.0<<endl;
	return 0;
}


// Author: Amey Bhavsar - ameybhavsar24@(github & twitter)
// IDE: Geany on Ubuntu 20.04
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define MOD 1000000007
int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	string s;
	cin >> s;
	deque< char > ans;
	bool r = 0;
	rep(i,0,(int)s.size()) {
		if (s[i] == 'R') {
			r = !r;
			continue;
		}
		if (r) {
			if (ans.size() > 0 && s[i] == ans.front()) {
				ans.pop_front();
			} else {
				ans.push_front(s[i]);
			}
		}
		else {
			if (ans.size() > 0 && s[i] == ans.back()) {
				ans.pop_back();
			} else {
				ans.push_back(s[i]);
			}
		}
	}

	for (int i=0; i<(int)ans.size(); i++) {
		if (r) {
			cout << ans[(int)ans.size()-1-i];
		} else {
			cout << ans[i];
		}
	}
	cout << '\n';

	return 0;
}

#include <bits/stdc++.h>
#define f(a, n) for (int a=0; a<n; a++)
#define F(a, n) for (int a=1; a<=n; a++)
using namespace std;

int P[200005];

int find(int x){
    if (P[x] == 0) return x;
    return P[x] = find(P[x]);
}

bool join(int x, int y){ // 1 on non-trivial join
    int a = find(x), b = find(y);
    if (a == b) return 0;
    P[a] = b;
    return 1;
}

int A[200005];

int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> A[i];
    }
    int ans = 0;
    for (int i = 1; i <= n / 2; i++){
        ans += join(A[i], A[n + 1 - i]);
    }
    cout << ans << endl;
}


/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << "\n"
typedef struct {
    ll a;
    ll b;

} P;

bool is_possible = false;
bool done[210][210] = {};

void check(ll last, ll minus1, vector<P> D){
    if(done[last][minus1]) return;
    done[last][minus1] = true;
    ll sz = D.size();
    rep(diff, 1, last/2+1){
        vector<P> d = D;
        vector<P> d_new;
        ll cnt_1 = 0;
        ll mp[210] = {};
        ll start = last - 2 * diff + 1;
        bool ok = true;

        rep(i,0,sz){
            bool use = false;
            if(d[i].a == -1 && d[i].b == -1){
                cnt_1++;
            }else{
                if(d[i].a != -1 && d[i].b != -1){
                    if(d[i].a >= start && d[i].a <= start + diff-1 && d[i].a + diff == d[i].b){
                        mp[d[i].a]++;
                        mp[d[i].b]++;
                        use = true;
                    }else if(d[i].a >= start && d[i].a <= start + diff-1){
                        ok = false;
                    }else if(d[i].b >= start + diff && d[i].b <= last){
                        ok = false;
                    }
                }else if(d[i].b != -1){
                    if(d[i].b >= start+diff && d[i].b <= last){
                        mp[d[i].b]++;
                        mp[d[i].b - diff]++;
                        use = true;
                    }
                }else if(d[i].a != -1){
                    if(d[i].a >= start && d[i].a <= start + diff-1){
                        mp[d[i].a]++;
                        mp[d[i].a+diff]++;
                        use= true;
                    }
                }
                if(not use){
                    d_new.push_back(d[i]);
                }
            }

        }
        ll cnt_ok = 0;
        rep(i,start,last+1){
            if(mp[i] == 1){
                cnt_ok++;
            }else if(mp[i] >= 2){
                ok = false;
            }
        }
        if(not ok) continue;
        if(cnt_ok + cnt_1 * 2 >= diff * 2){
            if(diff == last/2){
                is_possible = true;
            }else{
                ll use = (2*diff - cnt_ok)/2;
                rep(i,0,cnt_1 - use) d_new.push_back({-1,-1});
                check(start-1, cnt_1 - use, d_new);
            }

        }
    }
}

void solve(){
    ll N;
    cin >> N;
    ll A[110], B[110];
    rep(i,0,N) cin >> A[i] >> B[i];
    vector<P> data;
    rep(i,0,N) data.push_back({A[i], B[i]});
    ll cnt = 0;
    rep(i,0,N){
        if(A[i] == -1 && B[i] == -1) cnt++;
    }

    check(2*N, cnt, data);
    if(is_possible){
        print("Yes");
    }else{
        print("No");
    }
}

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

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

using namespace std;

#define LL long long

int n;
vector<int> a, b, c;
vector<int> e;
int zz = 0;

int main() {
	// std::ios::sync_with_stdio(false);
    // std::cin.tie(0);
	cin >> n;
	a = vector<int>(2 * n, 0);
	b = vector<int>(2 * n, 0);
	c = vector<int>(2 * n, 0);
	e = vector<int>(2 * n, -1);
	vector<int> ee = vector<int>(2 * n, 0);

	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		if (a[i] != -1) {
			// cout << "a = " << (a[i] - 1) << endl;
			if (e[a[i] - 1] != -1) {
				cout << "No" << endl;
				return 0;
			}
			e[a[i] - 1] = i;
			ee[a[i] - 1] = -1;
		}
		if (b[i] != -1) {
			// cout << "b = " << (b[i] - 1) << endl;
			if (e[b[i] - 1] != -1) {
				cout << "No" << endl;
				return 0;
			}
			e[b[i] - 1] = i;
			ee[b[i] - 1] = 1;
		}
		if (a[i] != -1 && b[i] != -1 && a[i] >= b[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	vector<int> f(n + 1, 0);
	f[0] = 1;
	// f[i]: 0 .. 2 * i - 1, can be dealt
	vector<bool> app(n, false);
	for (int i = 1; i <= n; ++i) {
		// for (int j = 0; j <= zz; ++j) {
		int tot = 0, totApp = 0, dis = 0;
		for (int ii = i - 1; ii >= 0; --ii) {
			for (int jj = 0; jj < app.size(); ++jj) {
				app[jj] = false;
			}
			if (!f[ii]) {
				continue;
			}
			// cout << "ii = " << ii << endl;
			dis = (i - ii); // also the number of persons in this region
			// consider ii * 2 and ii * 2 + 1
			// tot += 2;
			bool flag = true;
			for (int jj = ii * 2; jj < ii * 2 + dis; ++jj) {
				if (ee[jj] == 1 || ee[jj + dis] == -1) {
					flag = false;
					break;
				}
				// cout << "jj = " << jj << endl;
				if (e[jj] != -1 && app[e[jj]]) {
					flag = false;
					break;
				}
				if (e[jj + dis] != -1 && app[e[jj + dis]]) {
					flag = false;
					break;
				}
				if (e[jj] != -1) {
					if (e[jj + dis] != -1) {
						if (e[jj] != e[jj + dis]) {
							flag = false;
							break;
						}
					}
					app[e[jj]] = true;
				} else {
					if (e[jj + dis] != -1) {
						app[e[jj + dis]] = true;
					}
				}
			}
			if (flag) {
				// cout << i << " ok!" << endl;
				f[i] = true;
				break;
			}
		}
	}
	if (f[n]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

int main(){
  int n,w;
  cin >> n >> w;
  cout << n/w << endl;
}

#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

int main(){
	int a, mf;
	cin >> a >> mf;
	int ms = a + mf;
	if (ms >= 15 && mf >= 8)
		cout << 1;
	else if (ms >= 10 && mf >= 3)
		cout << 2;
	else if (ms >= 3)
		cout << 3;
	else
		cout << 4;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
inline ll rd() {
	ll x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	return x*f;
}
#define d rd()
ll a[3];
int main(){
	a[0]=d,a[1]=d,a[2]=d;
	sort(a,a+3);
	if(a[0]==a[1])cout<<a[2];
	else if(a[1]==a[2])cout<<a[0];
	else cout<<0;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
ll X;
vector<map<ll,ll>> memo;
vector<ll> c;
vector<ll> a;

ll dp(int pos,ll value){
	if (pos == N) return 1LL;
	if (memo[pos].find(value) != memo[pos].end()) return memo[pos][value];

	ll ans = dp(pos + 1,(value/a[pos])*a[pos]);
	ll r = value % a[pos];
	if (r)
		ans += dp(pos + 1,(value/a[pos] + 1)*a[pos]);
	//else ans += dp(pos + 1,value/c[pos] - 1);
	return memo[pos][value] = ans;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> N >> X;
	a.resize(N + 1);
	for (int i = 0; i < N; i++) cin >> a[i];
	a[N] = a[N - 1];

	c.resize(N);
	for (int i = 0; i < N; i++) c[i] = a[i + 1]/a[i];

	memo.resize(N);
	cout << dp(0,X);
	return 0;
}


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

int main(){
	int a, b;
  	cin >> a >> b;
  	int c = a + b;
  	int answer = 0;

  	if(c>=15 && b>=8){
    	answer = 1;
    }
  	else if(c>=10 && b>=3){
    	answer = 2;
    }
  	else if(c>=3){
    	answer = 3;
    }
  	else{
      answer = 4;
    }

  	cout << answer <<  endl;
}

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

#define   fi(a,b) for(int i=a;i<b;i++)
#define   fj(a,b) for(int j=a;j<b;j++)
#define   ff first
#define   ss second
#define   ll long long
#define   ld long double
#define   ull unsigned long long
#define   bp(x) __builtin_popcount(x)
#define   pr(x) for(auto it: x) cout<<it<<" "; cout<<endl;
#define   getMax(x) max_element(x.begin(),x.end())
#define   getMin(x) min_element(x.begin(),x.end())
#define   endl "\n"
typedef   vector<int> vi;
typedef   vector< pair<int,int> > vii;
typedef   vector<long long> vl;
typedef   pair<int,int> pii;
typedef   pair<ll,ll> pll;
typedef   vector< pair<ll,ll> > vll;
//int dx[]={1,0,-1,0};
//int dy[]={0,1,0,-1};
//int dx[]={-1,0,1,1,1,0,-1,-1};
//int dy[]={-1,-1,-1,0,1,1,1,0};

void nikal_pehli_fursat_mai(){
    ll a, b;
    cin>>a>>b;
    a += b;
    if(a>=15 and b>=8) cout<<1<<endl;
    else if(a>=10 and b>=3) cout<<2<<endl;
    else if(a>=3) cout<<3<<endl;
    else cout<<4<<endl;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tc=1;
    // cin>>tc;
    while(tc--){
    nikal_pehli_fursat_mai();
    }
}


#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;

//#define int long long
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef vector<vector<int>> graph;
#define pu push
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define MOD 1000000007
#define MAXX 1.1529215e+18
#define _1 first
#define _2 second
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())

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

template<class t> using vc=vector<t>;

template<class T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

template<class T>
T extgcd(T a, T b, T &x, T &y) {
    T d = a;
    if (b == 0) {
      x = 1;
      y = 0;
    } else {
      d = extgcd(b, a%b, y, x);
      y -= (a/b)*x;
    }
    return d;
}

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p._1<<","<<p._2<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}

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

  int K;
  ll N, M;
  cin >> K >> N >> M;
  vector<ll> A(K);
  rep(i, K) {
    cin >> A[i];
  }
  ll l = 0;
  ll r = 2e9;
  while(r-l>1) {
      ll m = (l+r)/2;
      bool flag = true;
      ll sum1 = 0;
      ll sum2 = 0;
      rep(i, K) {
        ll t1 = (M*A[i]+m)/N;
        ll t2 = (M*A[i]-m+N-1)/N;
        sum1 += t1;
        sum2 += t2;
        if (t2 > t1) {
          flag = false;
        }
      }
      if (!(sum1 >= M && sum2 <= M))
        flag = false;
      if (flag) {
          r = m;
      } else {
          l = m;
      }
      // cout << m << endl;
  }
  // cout << r << ' ' << l << endl;
  vector<ll> v1(K);
  vector<ll> v2(K);
  int cnt = 0;
  rep(i, K) {
    v1[i] = (M*A[i]-r+N-1)/N;
    v2[i] = (M*A[i]+r)/N-(M*A[i]-r+N-1)/N;
    cnt += v1[i];
  }
  // cout << v1 << endl;
  // cout << v2 << endl;
  ll res = M-cnt;
  rep(i, K) {
    if (res < v2[i]) {
      v1[i] += res;
      res = 0;
    } else {
      v1[i]+= v2[i];
      res -= v2[i];
    }
  }
  // if (res > 0) {
  //   rep(i, K) {
  //     if (i < res % K) {
  //       v1[i] += res/K+1;
  //     } else {
  //       v1[i] += res/K;
  //     }
  //   }
  // }
  rep(i, K) {
    cout << v1[i] << ' ';
  }
  cout << endl;
}

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

using namespace std;

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

ll arr[100005],b[100005];
vector<pl> v;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int k;
	cin>>k;
	ll m,n;
	cin>>n>>m;
	for(int i=1;i<=k;i++){
		cin>>arr[i];
	}
	ll sum=0ll;
	for(int i=1;i<=k;i++){
		b[i]=arr[i]*m/n;
		sum+=b[i];
		v.push_back(mp(m*arr[i]-n*b[i],i));
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for(int i=sum;i<m;i++){
		b[v[i-sum].y]++;
	}
	for(int i=1;i<=k;i++) cout<<b[i]<<" ";

return 0;
}


#pragma GCC diagnostic ignored "-Wunused-const-variable"

#ifdef MAC
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define mp make_pair
#define pb push_back
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define all(x) (x).begin(), (x).end()
#define fst first
#define snd second
#define endl "\n"

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

template<typename T> inline T abs(T a){ return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a){ return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd (b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd (a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void dbg() { cout << endl; }
template <typename Head, typename... Tail>
void dbg(Head H, Tail... T) {
    cout << " " << to_string(H);
    dbg(T...);
}

#ifdef DEBUG
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg(__VA_ARGS__)
#else
#define dbg(...)
#endif

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}

template<typename T>
vector<T> make_unique(vector<T> v) {
    sort(all(v));
    return v.resize(unique(all(v)) - v.begin());
}

int nxt() {
    int x;
    cin >> x;
    return x;
}

const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int dxKn[8] = {-2, -1, 1, 2,  2,  1, -1, -2};
const int dyKn[8] = { 1,  2, 2, 1, -1, -2, -2, -1};
const int dxK[8] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dyK[8] = {1, -1, 0, 0, 1, -1, 1, -1};

const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const ll INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld e = ld(2.7182818284590452353602874713527);
const ld EPS = 1e-9;

//#############################
const int MAXN = 1000005;

int n, m; // sizes
vector<vector<int>> g; //graph, grid

int main() {
    fastIO();
    double ans = 0;
    cin >> n;
    for1(i, n+1) ans += 1.0/(double)i;
    ans *= n;
    ans-=1;
    cout << setprecision(8);
    cout << fixed;
    cout << ans << endl;
    return 0;
}

/*
    RECALL CORNER CASES - e.g. n = 1, n = 0
    WRITE SOME STUFF

    think first, always -
    1. concretely
    2. graphically
    3. abstractly
    4. algebraically

    Checklist:
    - I/O make sense?   - Exclusion/inclusion           - Is a known sequence?
    - Reverse           - Brute force approach          - DP
    - Sort input        - Greedy approach
    - Check diagonals   - Divide and Conquer approach
*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_Node_update>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
#define setbits __builtin_popcount
#define endl '\n'
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main()
{
    fastIO;
    string str;
    cin>>str;
    deque<ll>q;
    ll rev=0,n=str.size();
    for(int i=0;i<n;i++)
    {
        if(str[i]=='R')
        {
            rev^=1;
        }
        else
        {
            if(rev)
            {
                q.push_front(str[i]);
            }
            else{
                q.push_back(str[i]);
            }
        }
    }
    if(rev)
    {
        reverse(q.begin(),q.end());
    }
    string ans;
    while(q.size())
    {
        char ch=q.front();
        if(ans.size() && ans.back()==ch)
        {
            ans.pop_back();
        }
        else{
            ans.push_back(ch);
        }
        q.pop_front();
    }
    cout<<ans;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    scanf("%d%d", &a, &b);

    if (a + b >= 15 && b >= 8) {
        cout << 1 << endl;
    }
    else if (a + b >= 10 && b >= 3) {
        cout << 2 << endl;
    }
    else if (a + b >= 3) {
        cout << 3 << endl;
    }
    else {
        cout << 4 << endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define ll long long

int main()
{
    int n,m,t;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        n+=m;
        if(n>=15&&m>=8)t=1;
        else if(n>=10&&m>=3)t=2;
        else if(n>=3)t=3;
        else t=4;
        printf("%d\n",t);
    }
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	ll n;
	cin>>n;
	for(ll i=0;;i++){
		if(stoll(to_string(i)+to_string(i))>n){
			cout<<i-1<<endl;
			return 0;
		}
	}
	cout<<n/11<<endl;
}

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

//解答
int main(){
    string S;
    cin >> S;

    reverse(S.begin(),S.end());
    for(int i=0;i<S.length();i++){
        if(S[i] == '6'){
            S.erase(i,1);
            S.insert(i,"9");
        }else if(S[i] == '9'){
            S.erase(i,1);
            S.insert(i,"6");
        }
    }

    cout << S << endl;

}


#include<iostream>
using namespace std;
#include<vector>
using ll = long long;
using vi = vector<int>;

int main() {
  int N,i;
  cin>>N;
  int a,c;
  vi A(N,0), B(N);
  for (i=0;i<N;i++) {
    cin>>a;
    A[a-1]++;
  }
  for (i=0;i<N;i++) cin>>B[i];

  ll ans=0;
  for (i=0;i<N;i++) {
    cin>>c;
    ans += A[B[c-1]-1];
  }

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

#include<bits/stdc++.h>
#define lint long long int
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define fill(a,x) fill(a.begin(),a.end(),x)
#define eb(data) emplace_back(data)
#define pb(data) emplace_back(data)
#define mp make_pair
#define ALNUM 26
#define vint vector<int>
#define vlint vector<lint>
#define F first
#define S second
#define ALL(data) data.begin(),data.end()
#define GEts(s) getline(cin,s);
#define UNIQUE(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())

using namespace std;
template<typename Rast>inline void out(Rast rast){cout<<rast<<"\n";return;}
template<typename Rast>inline void in(Rast& rast){cin>>rast;return;}
template<typename T>istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename First, typename... Rest>void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
template<typename First, typename... Rest>void out(First first, Rest... rest){cout << first<<" ";out(rest...);return;}
template<typename T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a * b / gcd(a, b);}
template<typename T1,typename T2>bool chmax(T1& a,T2 b){if(a<b){a=b;return true;}else{return false;}}
template<typename T1,typename T2>bool chmin(T1& a,T2 b){if(a>b){a=b;return true;}else{return false;}}

static const double pi = 3.141592653589793;
int modpow(int a,int n,int p){if (n==0)return 1%p; if(n==1)return a%p;if(n%2==1)return (a*modpow(a,n-1,p))%p;lint t=modpow(a,n/2,p);return (t*t)%p;}//a^n%p
//lint MOD=1e9+7;
//lint MOD=998244353;
lint inf=pow(2,50);
int intinf=pow(2,30);
/**int dirx[]={1,0};int diry[]={0,1};//*///右、下
/**int dirx[]={0,1,0,-1};int diry[]={-1,0,1,0};//*///四方位
/**int dirx[]={-1,0,1,1,1,0,-1,-1};int diry[]={-1,-1,-1,0,1,1,1,0};//*///八方位

class unionfind{
public:
	vector<int> table;
	void init(int size){
		table.resize(size);
		rep(i,size)table[i]=i;
	};
	int root(int index){
		if(table[index]==index)return index;
		else{
			int hoge=root(table[index]);
			table[index]=hoge;
			return hoge;
		}
	};
	bool same(int x,int y){
		return(root(x)==root(y));
	};
	int marge(int x,int y){
		int yroot=root(y);
		int xroot=root(x);
		if(xroot==yroot)return 0;
		table[yroot]=xroot;
		return 0;
	}
	int getsize(){
		set<int> ma;
		rep(i,table.size())ma.insert(root(i));
		int re=ma.size();
		return re;
	}
};

int main(){
	cin.tie(0);ios::sync_with_stdio(false);cout<<std::fixed<<std::setprecision(16);
	int n;
	in(n);

	int ans=n;
	rep(i,n+1){
		stringstream ss;
		stringstream sb;
		ss<<dec<<i;
		sb<<oct<<i;
		string a=ss.str();
		string b=sb.str();
		bool flg=false;
		rep(i,a.size()){
			if(flg)break;
			if(a[i]=='7')flg=true;
		}
		rep(i,b.size())if(b[i]=='7'){
			if(flg)break;
			flg=true;
		}
		if(flg){
			ans--;
		}
	}
	out(ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N=2e6+5,M=1e9+7,OO=0x3f3f3f3f;

int main(){

    //freopen("myfile.txt","w",stdout);

    int n,m;
    scanf("%d%d",&n,&m);
    vector<int> arr(n);
    for(int i=0;i<n;++i)
        scanf("%d",&arr[i]);
    sort(arr.begin(),arr.end());
    vector<ll> pre(n+1,0);
    vector<ll> suf(n+2,0);
    pre[1]=abs(arr[1]-arr[0]);
    for(int i=3;i<n;i+=2)
        pre[i]+=pre[i-2]+abs(arr[i]-arr[i-1]);
    for(int i=n-2;i>0;i-=2)
        suf[i]+=suf[i+2]+abs(arr[i]-arr[i+1]);
    ll ans=LONG_LONG_MAX;
    arr[n]=OO;
    while(m--){
        int x;
        scanf("%d",&x);
        int lo=0,hi=n,md;
        while(lo<hi){
            md=lo+(hi-lo)/2;
            if(arr[md]<=x) lo=md+1;
            else hi=md;
        }
        if(lo&1){
            ll cur=suf[lo]+abs(arr[lo-1]-x);
            if(lo-2>=0) cur+=pre[lo-2];
            ans=min(ans,cur);
        }
        else{
            ll cur=abs(arr[lo]-x);
            if(lo-1>=0) cur+=pre[lo-1];
            if(lo+1<=n) cur+=suf[lo+1];
            ans=min(ans,cur);
        }
    }
    printf("%lld\n",ans);

    return 0;
}

#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int INF = INT_MAX / 2;
int dp[200005][2];

void solve() {
    int N, M;
    cin >> N >> M;
    vi H(N), W(M);
    rep(i, N)cin >> H[i];
    rep(i, M)cin >> W[i];
    sort(all(H));
    sort(all(W));
    W.erase(unique(all(W)), W.end());
    M = sz(W);
    rep(i, N + 1)rep(j, 2)dp[i][j] = INF;
    dp[0][0] = 0;

    int cur = 0;
    rep(i, N)rep(j, 2) {
        if (i < N - 1) {
            smin(dp[i + 2][j], dp[i][j] + H[i + 1] - H[i]);
        }
        while (cur != M && W[cur] < H[i])++cur;
        if (j == 0) {
            if (cur != M) {
                smin(dp[i + 1][1], dp[i][j] + W[cur] - H[i]);
            }
            if (cur > 0) {
                smin(dp[i + 1][1], dp[i][j] + H[i] - W[cur - 1]);
            }
        }
    }

    cout << dp[N][1] << endl;
}

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


#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

std::vector<int> g[111];
std::string s;
bool visited[111][111];

void dfs(int v, int u){
	int i;
	if(visited[v][u]){
		return;
	}
	visited[v][u] = true;
	for(i=(g[u].l_ength()-1); i>=0; --i){
		dfs(v,g[u][i]);
	}
}

int main(void){
	int n,i,j;
	long double ans = 0.0L, tmp;
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> s;
		for(j=0; j<n; ++j){
			if(s[j]-'0'){
				g[i].push_back(j);
			}
		}
	}
	for(i=0; i<n; ++i){
		dfs(i,i);
	}
	for(i=0; i<n; ++i){
		tmp = 0.0L;
		for(j=0; j<n; ++j){
			if(visited[j][i]){
				tmp += 1.0L;
			}
		}
		ans += 1.0L/tmp;
	}
	std::cout << std::fixed << std::setprecision(25) << ans << std::endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define V vector
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define endl "\n"
#define all(x) x.begin(), x.end()
#define forstl(i, s)  for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
// #pragma comment(linker, '/STACK:200000')        //prevent stack overflow ..STACK Limiter
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
const int MOD=1e9+7;
const int MOD2=998244353;
ld PI=2*acos(0.0);

template <typename T> T gcd(T a, T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a, T b){return a*(b/gcd(a,b));}
template <typename T> T mod_exp(T b, T p, T m){T x = 1;while(p){if(p&1)x=(x*b)%m;b=(b*b)%m;p=p>>1;}return x;}
template <typename T> T invFermat(T a, T p){return mod_exp(a, p-2, p);}
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
string tostring(int number){stringstream ss; ss<<number; return ss.str();}
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void solve()
{
    int x,y,a,b; cin>>x>>y>>a>>b;
    long long ans=0;
    while((double)a*x<=2e18 && a*x<=x+b && a*x<y){
        x*=a;
        ans++;
    }
    cout << ans+(y-1-x)/b << endl;
}

int32_t main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE                    //file start
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif                                  //file end
    // int cases=1;
    // int t; cin>>t;
    // while(t--)
    solve();
    return 0;
}

// 1LL check ?


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

const int sz = 105;
ll dp[sz][sz][sz];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, x;
    cin, n, x;
    vector<ll> a(n);
    rep(i, 0, n) {
        cin, a[i];
    }
    const ll inf = 1LL << 60;
    ll ans = inf;
    rep(k, 1, n + 1) {
        rep(t, 0, sz) rep(b, 0, sz) rep(c, 0, sz) dp[t][b][c] = -1;
        dp[0][0][0] = 0;
        rep(i, 0, n) {
            rep(j, 0, k + 1) {  // cnt
                rep(t, 0, k) {  // mod
                    if (dp[i][j][t] == -1) continue;
                    ll num = dp[i][j][t] * k + t;
                    ll aft = num + a[i];
                    ll div = aft / k;
                    ll q = aft % k;
                    chmax(dp[i + 1][j][t], dp[i][j][t]);
                    if (j + 1 <= k) {
                        chmax(dp[i + 1][j + 1][q], div);
                    }
                }
            }
        }
        ll aft = dp[n][k][x % k];
        if (aft == -1) {
            continue;
        }
        chmin(ans, (x - aft * k - x % k) / k);
    }
    print(ans);
    return 0;
}

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

long long dp[110][110][110][110] = {0}; //何個目まで見たか　何個選んだか mod mod何か

int main(){
    long long N,X;
    cin >> N >> X;
    vector <long long> potion;
    long long maxa = 0;
    for(int i=0;i<N;i++){
        long long a;
        cin >> a;
        potion.push_back(a);
        maxa = max(a,maxa);
    }
    if(N==1){
        cout << X-potion[0] << endl;
        return 0;
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<=i;j++){
            for(int k=2;k<=N;k++){
                for(int l=0;l<k;l++){
                    if(dp[i][j][k][l]==0&&(l!=0||j!=0)){
                        continue;
                    }
                    dp[i+1][j+1][k][(l+potion[i])%k]=max(dp[i+1][j+1][k][(l+potion[i])%k],dp[i][j][k][l]+potion[i]);
                    dp[i+1][j][k][l]=max(dp[i+1][j][k][l],dp[i][j][k][l]);
                }
            }
        }
    }
    /*
    for(int i=1;i<=N;i++){
        for(int j=1;j<=i;j++){
            for(int k=2;k<=N;k++){
                for(int l=0;l<k;l++){
                    cout << i<< "番目までで" << j << "個選んで mod "<< k << " = " << l << "の最大値は " <<dp[i][j][k][l] << endl;
                }
                cout << endl;
            }
            cout << endl;
        }
        cout << endl;
    }
    */
    long long ans = 9000000000000000000;

    for(long long j=N;j>0;j--){
        for(int i=N;i>=j;i--){
            if(dp[i][j][j][X%j]!=0){
                ans = min(ans,(X-dp[i][j][j][X%j])/j);
            }
        }
    }
    if(ans == 9000000000000000000){
        ans = X - maxa;
    }
    cout << ans << endl;

}


#include <bits/stdc++.h>

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

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b); i-- > (a); )
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) int((x).size())
#define lb(x...) lower_bound(x)
#define ub(x...) upper_bound(x)

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

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

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

	ll ans = 1;
	int n; cin >> n;
	ll p = 1;
	rep(i, 0, n) {
		string s; cin >> s;
		p <<= 1;
		if (s[0] != 'A') ans |= p;
	}
	cout << ans;
}

#include <bits/stdc++.h>

using ull = unsigned long long int;
using ll = long long;
using ld = long double;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define drep(i,j) for(int (i)=(j);(i) >= 0;(i)--)

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
template<class T> inline void pri(T a){cout << a << endl;}
template<class Z> using vec = vector<Z>;
template<class T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
 cout << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
cout << first << " " ;
OUT(rest...);
   return;
}
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = int(1e9);
const long long int INFL = (long long int)1e18;

int n,m,k;
string S;
int ans;

void solve()
{
  int N;
  IN(N);
  string S,X;
  IN(S,X);
  vi dp(N+1);
  dp[N] = 1;
  vi ten(N+5);
  ten[0] = 1;
  rep(i,N+1)
  {
    ten[i+1] = (ten[i]*10) %7;
  }
  //OUT("dp[N]",dp[N]);
  for(int i=N;i>0;i--)
  {
    vi pos;
    rep(j,7)
    {
      if(dp[i]&(1 << j))
      {
        pos.push_back(j);
        //OUT(j);
      }
    }
    //for(auto e : pos) cout << e << " ";
    //OUT();
    if(X[i-1] == 'T')
    {
      int x = S[i-1] - '0';
      //OUT("x",x);
      x *= ten[N-i];
      x %= 7;
      int ret = 0;
      for(auto &e: pos )
      {
        int k = (e - x + 7)%7;
        ret |= (1 << k);
        ret |= (1 << e);
      }
      //OUT("x",x);
      dp[i-1] = ret;
      //OUT("T",dp[i-1]);
    }
    else
    {
      int x = S[i-1] - '0';
      //OUT("x",x);
      x *= ten[N-i];
      x %= 7;
      int tmp1 = 0;
      int tmp2 = 0;
      for(auto &e : pos)
      {
        int k = (e - x + 7)%7;
        tmp1 |= (1 << k);
        tmp2 |= (1 << e);
      }
      dp[i-1] = (tmp1 & tmp2);
      //OUT("x",x);
      //OUT("A",dp[i-1]);
    }
  }
  if(dp[0] & 1)
  {
    cout << "Takahashi" << endl;
  }
  else cout << "Aoki" << endl;
}

signed main (int argc, char* argv[])
{
   cin.tie(0);
   ios::sync_with_stdio(false);
   int cases=1;
   //IN(cases);
   while(cases--)solve();
   //pri(ans);
   //for(auto c : ans){cout << c << endl;}
   //cout << fixed << setprecision(15) << ans << endl;
   return 0;
}


//

#include <iostream>
#include <string>

using namespace std;

int main() {
  int N, D, H;
  cin >> N >> D >> H;
  int O[N][2];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 2; j++)
      cin >> O[i][j];
  }
  int noview = 0;
  int ans = 0;
  for (int i = 0; i <= H; i++) {
    float m = ((float)H - (float)i) / (float) D;
    noview = 0;
    for (int j = 0; j < N; j++) {
      if (O[j][1] > (int) ((float)i + m * (float) O[j][0])) {
	noview = 1;
	break;
      }
    }
    if (noview) {
      ans++;
      continue;
    }
    else
      break;
  }
  if (ans > 0) {
    float mar = (float) (ans - 1);
    while (mar < (float) ans) {
      mar += 0.0005;
      float m = ((float) H - mar) / (float) D;
      noview = 0;
      for (int j = 0; j < N; j++) {
	if (O[j][1] > (int) (mar + m * (float) O[j][0])) {
	  noview = 1;
	  break;
	}
      }
      if (noview)
	continue;
      else
	break;
    }
    cout << mar << "\n";
  }
  else
    cout << (float) ans << "\n";
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
const int MOD=1e9+7;

int main(){
  int N, D, H;
  cin>>N>>D>>H;
  double a = INFint;
  for(int i = 0; i < N; ++i) {
    int d, h;
    cin>>d>>h;
    a = min(a, (H - h)/(double(D - d)));
  }
  cout << setprecision(15) << max(0.0, H - a * D) << endl;
  return 0;
}


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

typedef long long ll;
#define pb push_back

const int MOD = 1e9 + 7, N = 3e3 + 5;

int add(int x, int y)
{
    x += y;
    while (x >= MOD)
        x -= MOD;
    while (x < 0)
        x += MOD;
    return x;
}

int mul(int x, int y)
{
    return (x * 1ll * y) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> arr(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> arr[i];
    vector<vector<int>> dp(n + 1, vector<int>(n + 1)), last(n + 1, vector<int>(n + 1));
    for (int k = 1; k <= n; k++)
    {
        vector<int> div(k + 1, -1);
        div[0] = 0;
        int sum = 0;
        for (int i = 1; i <= n; i++)
        {
            sum += arr[i] % k;
            sum %= k;
            last[i][k] = div[sum];
            div[sum] = i;
        }
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int k = 1; k <= i; k++)
        {
            int l = last[i][k];
            if (l >= 0)
                dp[i][k] = add(dp[l][k], dp[l][k - 1]);
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++)
        res = add(res, dp[n][i]);
    cout << res << "\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007 //998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    REP(i,n) cin >> a[i];
    vector<vector<ll>> dp(n,vector<ll>(n+1,0));
    vector<vector<ll>> conn(n,vector<ll>(n+1,-1));
    vector<vector<ll>> table(n,vector<ll>(n+1,-1));
    ll asum = 0;
    REP(i,n) {
        asum += a[i];
        FOR(j,1,n) {
            ll ad = asum%j;
            conn[i][j]= table[ad][j];
            table[ad][j]=i;
        }
    }
    dp[0][1]=1;
    FOR(i,1,n-1) {
        dp[i][1]=1;
        FOR(j,2,n) {
            if (conn[i][j]!=-1) {
                // cout << i << " " << j << " " << dp[conn[i][j]][j] << " " << dp[conn[i][j]][j-1] << endl;
                dp[i][j]=(dp[i][j]+dp[conn[i][j]][j])%MOD;
                dp[i][j]=(dp[i][j]+dp[conn[i][j]][j-1])%MOD;
            }
        }
    }
    // REP(i,n){
    //     REP(j,n+1) cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    ll ans = 0;
    FOR(i,1,n) ans = (ans+dp[n-1][i])%MOD;
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,x,n) for(int i = x;i <= n;++i)
#define forr(i,x,n) for(int i = n;i >= x;--i)
#define Angel_Dust ios::sync_with_stdio(0);cin.tie(0)

const int N = 2e6+7,MOD = 1e9+7;
int fact[N],infact[N];

ll qpow(ll a,ll b,ll MOD)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)   res = a * res % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

void init()
{
    fact[0] = infact[0] = 1;
    forn(i,1,N - 1)
    {
        fact[i] = 1ll * i * fact[i - 1] % MOD;
        infact[i] = qpow(i,MOD - 2,MOD) * infact[i - 1] % MOD;
    }
}

int main()
{
    init();
    int n,m,k;scanf("%d%d%d",&n,&m,&k);
    if(n > m + k)   return puts("0"),0;

    int res = 1ll * fact[n + m] * infact[n] % MOD * infact[m] % MOD;
    if(k + 1 <= n)
    {
        ll rt = 1ll * fact[n + m] * infact[n - k - 1] % MOD * infact[m + k + 1] % MOD;
        res = ((res - rt) % MOD + MOD) % MOD;
    }
    printf("%d\n",res);
    return 0;
}

//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; }
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; }
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; }
ll pow(ll a, ll b, ll mod=INF){
    ll res=1;
    while(b>0){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
ll getDigit(ll num){
    ll digit=0;
    while(num!=0){num/=10;digit++;}
    return digit;
}
//-----------------------------------------
int main(void){
    ll N;
    cin>>N;

    ll res,a;
    REP(i,N){
        cin>>a;
        if(i==0)res=a;
        res=GCD(res,a);
    }
    cout<<res<<"\n";
}


#include <iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	if(n%2!=0)
	{
		cout<<"Black";
	}
	else{
		cout<<"White";
	}
	return 0;

}

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

// 素因数分解:O(sqrt(N))
const map<LLONG, LLONG> PrimeFactorize(LLONG N)
{
    map<LLONG, LLONG> prime2NumMap;
    for (LLONG p = 2; p * p <= N; ++p)
    {
        if (N % p != 0) continue;
        while (N % p == 0)
        {
            N /= p;
            ++prime2NumMap[p];
        }
    }
    if (N != 1) prime2NumMap[N] = 1;
    return prime2NumMap;
}

int main()
{
	int N; cin >> N;
	REP(ai, N)
	{
		int num = 0;
		for (const auto& kvp : PrimeFactorize(ai + 1))
		{
			num += kvp.second;
		}
		cout << num + 1 << ' ';
	}
}


#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) (x&-x)
#define reg register
typedef long long LL;
typedef unsigned long long uLL;
typedef unsigned int uint;
const int INF=0x7f7f7f7f;
const int jzm=233;
const int mo=998244353;
const double Pi=acos(-1.0);
typedef pair<int,int> pii;
const double PI=acos(-1.0);
template<typename _T>
_T Fabs(_T x){return x<0?-x:x;}
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=getchar();
	while(s>'9'||s<'0'){if(s=='-')f=-1;s=getchar();}
	while('0'<=s&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=getchar();}
	x*=f;
}
LL n,ans;
int main(){
	read(n);
	if(n>=1000LL)ans+=(n-999LL);
	if(n>=1000000LL)ans+=(n-999999LL);
	if(n>=1000000000LL)ans+=(n-999999999LL);
	if(n>=1000000000000LL)ans+=(n-999999999999LL);
	if(n>=1000000000000000LL)ans+=(n-999999999999999LL);
	printf("%lld\n",ans);
	return 0;
}


#include <bits/stdc++.h>

//#include <atcoder/all>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main() {
    int x, y;
    scanf("%d%d", &x, &y);
    puts(abs(x - y) <= 2 ? "Yes" : "No");
}

/*input

*/
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <list>
#include <utility>

using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int int64_t
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define srt(v) sort(v.begin(),v.end())
#define ld long double
#define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
#define coutArray(a,n) for(int i = 0; i < n; i++){cout << a[i] << " ";};cout << endl;
#define coutSet(set) for (auto it = set.begin(); it !=  set.end(); ++it) {cout << *it << " "};cout << endl;

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {
        cerr<<v<<" ";
        return *this;
    }
} dbg;

bool check_key(map<int, int> m, int key)
{
    if (m.find(key) == m.end())
        return false;

    return true;
}

vector<int> SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    vector<int> res;
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
        if (prime[p])
            res.push_back(p);
    //cout << p << " ";
    return res;
}
int decimalToOctal(int decimalNumber) {
    int rem, i = 1, octalNumber = 0;
    while (decimalNumber != 0) {
        rem = decimalNumber % 8;
        decimalNumber /= 8;
        octalNumber += rem * i;
        i *= 10;
    }
    return octalNumber;
}

int32_t main()
{
    fast;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int x; cin>>x;
	int y; cin>>y;
	int minNum = min(x, y);
	int maxNum = max(x, y);
	if ((minNum + 3) > maxNum)
	{
		cout<<"Yes";
	} else {
		cout<<"No";
	}
	// Happy Competitive Programming!
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef unordered_map<int, int> uii;
typedef unordered_map<ll, ll> ull;
#define mp make_pair
#define pb push_back
#define PB pop_back
#define F first
#define S second
#define Endl '\n'
const int mod = 1e9+7;

void call()
{
  ll n,m;
  cin >> n >> m;
  unordered_map<ll,ll>m1;
  unordered_map<ll,ll>m2;
  set<ll>s;
  for(ll i=0;i<n;++i)
  {
    ll tmp;
    cin >> tmp;
    m1[tmp]++;
  }
  for(int i=0;i<m;++i)
  {
    ll  tmp;
    cin >> tmp;
    m2[tmp]++;
  }
  for(auto&it:m1)
  {
    if(m2.find(it.first)==m2.end())
    {
      s.insert(it.first);
    }
  }
  for(auto&it:m2)
  {
    if(m1.find(it.first)==m1.end())
    {
      s.insert(it.first);
    }
  }
  for(auto&it:s)
  {
    cout << it << " ";
  }
  cout << endl;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int TC;TC=1;

	while(TC--)
		call();

	return 0;
}

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

int main() {
    int n, m; cin >> n >> m;
    int a[n], b[m];
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    set<int> ans;

    rep(i, n){
        bool flag = true;
        rep(j, m){
            if(a[i] == b[j]) flag = false;
        }
        if(flag) ans.insert(a[i]);
    }
    rep(j, m){
        bool flag = true;
        rep(i, n){
            if(a[i] == b[j]) flag = false;
        }
        if(flag) ans.insert(b[j]);
    }
    for(auto x:ans) cout << x << ' ';
    cout << endl;
}


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

#define ll long long
#define mp(m, n) make_pair((m), (n))
// #define DEBUG

#ifdef DEBUG
template<typename T>
void _debug(string s, T x) {
    cerr << s << ":";
    for (auto it = x.begin(); it != x.end(); ++it) {
        cerr << " " << *it;
    }
    cerr << endl;
}

template<typename T, typename K>
void _debug(string s, map<T, K> x) {
    cerr << s << ":";
    for (auto it = x.begin(); it != x.end(); ++it) {
        cerr << " " << it->first << ":" << it->second;
    }
    cerr << endl;
}

template<typename T, typename K>
void _debug(string s, set<T, K> x) {
    cerr << s << ":";
    for (auto it = x.begin(); it != x.end(); ++it) {
        cerr << " " << *it;
    }
    cerr << endl;
}

template<typename T, typename K>
void _debug(string s, vector<pair<T, K> > x) {
    cerr << s << ":";
    for (auto it = x.begin(); it != x.end(); ++it) {
        cerr << " " << it->first << "," << it->second;
    }
    cerr << endl;
}

void _debug(string s, int x) {
    cerr << s << ": " << x << endl;
}
void _debug(string s, long long x) {
    cerr << s << ": " << x << endl;
}
void _debug(string s, double x) {
    cerr << s << ": " << x << endl;
}
void _debug(string s, string x) {
    cerr << s << ": " << x << endl;
}
void _debug(string s, char x) {
    cerr << s << ": " << x << endl;
}

#define debug(x) _debug(#x, (x))
#else
#define debug(x)
#endif

#define db debug

int count(vector<string> &m, int index) {
    vector<int> vis(m.size());
    queue<int> q;
    q.push(index);
    vis[index] = 1;
    while(q.size()) {
        int x = q.front();
        q.pop();
        for (int i = 0; i < m.size(); i++) {
            if (m[i][x] == '1' && vis[i] == 0) {
                vis[i] = 1;
                q.push(i);
            }
        }
    }
    return std::accumulate(vis.begin(), vis.end(), 0);
}

int main() {
    ios_base::sync_with_stdio(false); std::cin.tie(0);
    int n;
    cin >> n;
    vector<string> v(n);
    FOR(i, n) cin >> v[i];
    double R = 0;
    FOR(i, n) {
        int t = count(v, i);
        debug(t);
        R += 1.0 / t;
    }
    cout << setprecision(15) << R << endl;

}

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vector<vector<T>>
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

//------------------------------------------------

struct Solver{

    void solve(){
        int N;
        ll X;
        cin >> N >> X;

        vec(ll) A(N),B(N);
        rep(i,N) cin >> A[i];
        rep(i,N-1) B[i]=A[i+1]/A[i];
        B[N-1] = llINF;

        vector<map<ll,ll>> dp(N+1);

        dp[N][-X]=1;

        for(int i=N-1; i>=0 ; i--){
            for(auto p:dp[i+1]){
                //cout << "i=" << i << "," <<p.first << ","<<p.second<<endl;
                ll di = p.first;
                ll num,a,b;
                num=-A[i]-di;
                if(num%A[i]==0) a = num/A[i]+1;
                else{
                    if(num>0) a = num/A[i]+1;
                    else a = num/A[i];
                }
                if(abs(a) < B[i]) dp[i][di+a*A[i]] += p.second;

                num=A[i]-di;
                if(num%A[i]==0) b = num/A[i]-1;
                else{
                    if(num>0) b = num/A[i];
                    else b = num/A[i]-1;
                }
                if(abs(b) < B[i] && b>a ) dp[i][di+b*A[i]] += p.second;

            }
        }
        cout << dp[0][0] << endl;
    }
};

int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double Lf;
typedef pair<int, int> pii;

const int maxn = 2e5 + 5;

int n;
int cnt[10], tmp[10];
char s[maxn];

int main(){
	scanf("%s", s);
	n = strlen(s);
	reverse(s, s + n);

	if(n <= 3){
        sort(s, s + n);
		do{
			int val = 0;
			FOR(i, 0, n)
				(val *= 10) += (s[i] - '0');
			if(!(val % 8)){
				puts("Yes");
				return 0;
			}
		}
		while(next_permutation(s, s + n));
		puts("No");
		return 0;
	}

	FOR(i, 0, n)
		++cnt[s[i] - '0'];

	FOR(i, 0, 10) FOR(j, 0, 10) FOR(k, 0, 10){
		FOR(x, 0, 10)
			tmp[x] = 0;
		++tmp[i]; ++tmp[j]; ++tmp[k];
		bool f = true;
		FOR(x, 0, 10)
			f &= (tmp[x] <= cnt[x]);
		if(f && !((i + j * 10 + k * 100) % 8)){
			puts("Yes");
			return 0;
		}
	}

	puts("No");
	return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

string s;
int cnt[10];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	for(char i : s) cnt[i - '0']++;
	int i = 8;
	if((int)s.length() == 2) i = 16;
	else if((int)s.length() > 2) i = 104;
	for(; i < 1000; i += 8){
		string num = to_string(i);
		int work = true;
		for(char i : num){
			cnt[i - '0']--;
			if(cnt[i - '0'] < 0) work = false;
		}
		if(work){
			cout << "Yes\n";
			return 0;
		}
		for(char i : num) cnt[i - '0']++;
	}
	cout << "No\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define inf 1e15
#define pii pair<int,int>
#define fi first
#define se second
int dis[17][17];
int dp[(1<<17)][17];
int k;
int fun(int mask,int i){
	if(__builtin_popcount(mask)==1 && mask&(1<<i))return 1;
	if(dp[mask][i]!=-1)return dp[mask][i];
	int a=inf;
	int sub=mask^(1<<i);
	for(int j=0;j<k;j++){
		if(sub&(1<<j))a=min(a,fun(sub,j)+dis[j][i]);
	}
	return dp[mask][i]=a;
}
signed main(){
    fastio
	int n,m;
	cin>>n>>m;
	vector<vector<int>> adj(n);
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		--x;--y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	cin>>k;
	int c[k];
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		--x;
		c[i]=x;
	}
	for(int i=0;i<k;i++){
		int dist[n];
		memset(dist,-1,sizeof dist);
		dist[c[i]]=0;
		queue<int> q;
		q.push(c[i]);
		while(!q.empty()){
			int v=q.front();
			q.pop();
			for(int u:adj[v]){
				if(dist[u]!=-1)continue;
				dist[u]=dist[v]+1;
				q.push(u);
			}
		}
		for(int j=0;j<k;j++){
		    if(dist[c[j]]==-1){cout<<"-1";return 0;}
			dis[i][j]=dist[c[j]];
		}
	}

	memset(dp,-1,sizeof dp);

	int ans=inf;
	for(int i=0;i<k;i++)ans=min(ans,fun((1<<k)-1,i));
	cout<<ans;
   	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=1e18;

VVI edge(110000,VI(0));
VI d(110000,INF);

void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P>> que;
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second;
        if(d[v]<p.first) continue;
        for(auto to:edge[v]){
            if(d[to]>d[v]+1){
                d[to]=d[v]+1;
                que.push(P(d[to],to));
            }
        }
    }
}

VVI kdist(18,VI(18,INF));
VI kd(5000000,INF);
int M=270000;
int k;

ll dijkstra2(){
    priority_queue<P,vector<P>,greater<P>> que;
    REP(i,k){
        kd[i*M+(1<<i)]=0;
        que.push(P(0,i*M+(1<<i)));
    }
    ll ans=INF;
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second/M;
        int w=p.second%M;
        if(kd[p.second]<p.first) continue;
        if(w==(1<<k)-1){
            ans=min(ans,kd[p.second]);
            continue;
        }
        REP(i,k){
            int to=i*M+(w|(1<<i));
            if(kd[to]>kd[p.second]+kdist[v][i]){
                kd[to]=kd[p.second]+kdist[v][i];
                que.push(P(kd[to],to));
            }
        }
    }
    return (ans==INF?-1:ans+1);
}

int main(){
    int n, m; cin >> n >> m;
    int a, b;
    REP(i,m){
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    cin >> k;
    VI c(k);
    REP(i,k) cin >> c[i], c[i]--;
    REP(i,k){
        dijkstra(c[i]);
        REP(j,k) kdist[i][j]=d[c[j]];
        REP(j,n) d[j]=INF;
    }
    cout << dijkstra2() << endl;
    return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
const int N = 200001;

// int fexp(int a, int b,int m){int ans = 1;while(b){if(b&1)ans=(ans*a)%m; b/=2;a=(a*a)%m;}return ans;}
// int inverse(int a, int p){return fexp(a, p-2,p);}

// int fac[2000001];

// int nCrModPFermat(int n, int r,int p) {
//     // cout<<1<<endl;
//     if (r==0) return 1;
//     return (((fac[n]*((((inverse(fac[r],p)%p)*inverse(fac[n-r],p))%p))))%p);
// }

// vi prime(555,1);

void solve(){
    int a,b,x,y;cin>>a>>b>>x>>y;
    if(a==x&&y==b)cout<<0;
    else if((abs(a-x)+abs(b-y))<=3)cout<<1;
    else{
        if(abs(a-b)==abs(x-y)||abs(a+b)==abs(x+y))cout<<1;
        else if(abs(abs(a-b)-abs(x-y))<4||abs(abs(a+b)-abs(x+y))<4)cout<<2;
        else if((abs(a-b)%2)==(abs(x-y)%2))cout<<2;
        else cout<<3;
    }
}

signed main(){
        IOS;

        int t=1;
        // cin>>t;
        // for(int i=2; i*i<=550; i++)
        // if(prime[i])
        //     for(int j=i*i; j<=550; j+=i)
        //         prime[j]=0;
        // fac[0] = 1;
        // for (int i=1 ; i<=100001; i++) fac[i] = fac[i-1]*i%mod;
        rep(i,0,t){
            // cout<<"Case #"<<i+1<<": ";
            solve();
            cout<<"\n";
        }
    //    return 0;
}

#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <math.h>
#define ll long long
#define PI 3.14159265358979323846
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(x,n) for(ll x=1;x<(ll)n+1;x++)
using namespace std;

int g1(ll g1) {
	vector<ll> a;
	bool sw = true;
	ll l1 = 1;
	while (sw) {
		if (g1 > 9) {
				a.push_back(g1 % 10);
				g1 /= 10;
				l1++;

		}
		else {
			a.push_back(g1);
			sw = false;
		}
	}
	sort(a.begin(), a.end());
	ll gg1 = 0;
	ll b = 1;
	rep(j, l1) {
		gg1 += a.at(j) * b;
		b *= 10;
	}
	return gg1;
}
int g2(ll g2) {
	vector<ll> a;
	bool sw = true;
	ll l1 = 1;
	while (sw) {
		if (g2 > 9) {
				a.push_back(g2 % 10);
				g2 /= 10;
				l1++;
		}
		else {
			a.push_back(g2);
			sw = false;
		}
	}
	sort(a.begin(), a.end(),greater<ll>());
	ll gg2 = 0;
	ll b = 1;
	rep(j, l1) {
		gg2 += a.at(j) * b;
		b *= 10;
	}
	return gg2;
}

int main() {
	ll N;
	ll sw = 0;
	cin >> N;
	vector <ll> A(N), P(N), X(N);
	rep(i, N) cin >> A.at(i) >> P.at(i) >> X.at(i);
	vector<ll> B;
	rep(i, N) {
		if (A.at(i) < X.at(i)) {
			B.push_back(P.at(i));
			sw++;
		}
	}
		if (sw == 0) {
			cout << "-1" << endl;
			return 0;
		}
		else {
			sort(B.begin(), B.end());
			cout << B.at(0) << endl;
			return 0;
		}

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll gcd(ll x, ll y) {return (x%y) ? gcd(y, x%y) : y; }
const int inf = 1000000000;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
const ll mod = 1e9+7;

int main(){
    int x, y;
    cin >> x >> y;
    if(y>x){
        if(y-x>=3){
            cout << "No" << endl; return 0;
        }
        else{
            cout << "Yes" << endl;
            return 0;
        }
    }
    else{
        if(x-y>=3){
            cout << "No" << endl; return 0;
        }
        else{
            cout << "Yes" << endl;
            return 0;
        }
    }
}

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#define ll long long
#define MAXN 200005
#define uns unsigned
#define MOD 998244353ll
#define INF 0x7f7f7f7f
using namespace std;
inline ll read(){
	ll x=0;bool f=1;char s=getchar();
	while((s<'0'||s>'9')&&s>0){if(s=='-')f^=1;s=getchar();}
	while(s>='0'&&s<='9')x=(x<<1)+(x<<3)+s-'0',s=getchar();
	return f?x:-x;
}
ll x,y,p,q;
inline ll ksm(ll a,ll b,ll mo){
	ll res=1;
	for(;b;b>>=1,a=a*a%mo)if(b&1)res=res*a%mo;
	return res;
}
inline ll gcd(ll a,ll b){
	return b==0?a:gcd(b,a%b);
}
inline ll exgcd(ll a,ll b,ll&x,ll&y){
	if(b==0){x=1,y=0;return a;}
	ll res=exgcd(b,a%b,y,x);
	y-=a/b*x;return res;
}
signed main()
{
	for(int T=read();T--;){
		x=read(),y=read(),p=read(),q=read();
		ll md=(x+y)<<1,lim=md*(p+q)+1,ans=lim;
		for(ll i=x;i<x+y;i++){
			ll b=p,a=p+q,c=((i-b)%md+md)%md;
			ll k,f,g=exgcd(a,md,k,f);
			if(c%g!=0)continue;
			c/=g,k=(k*c%md+md)%md,f=md/g,k%=f,a=p+q,b=p;
			if((k*a+b)%md>=x&&(k*a+b)%md<x+y)ans=min(ans,k*a+b);
		}
		md=p+q;
		for(ll i=p;i<p+q;i++){
			ll b=x,a=(x+y)<<1,c=((i-b)%md+md)%md;
			ll k,f,g=exgcd(a,md,k,f);
			if(c%g!=0)continue;
			c/=g,k=(k*c%md+md)%md,f=md/g,k%=f,a=(x+y)<<1,b=x;
			if((k*a+b)%md>=p&&(k*a+b)%md<p+q)ans=min(ans,k*a+b);
		}
		if(ans>=lim)printf("infinity\n");
		else printf("%lld\n",ans);
	}
	return 0;
}


#include<stdio.h>
#include<math.h>
#include<algorithm>
#define it register int
#define ct const int
#define il inline
typedef long long ll;
#define rll register ll
#define cll const ll
#define mkp make_pair
using namespace std;
const int N=30;
const ll inf=1e15;
int n,x[N],y[N],z[N],pw[N];
ll w[N][N],f[20][1<<19];
il int A(ct x){return x<0?-x:x;}
il int Max(ct p,ct q){return p>q?p:q;}
il ll Min(cll p,cll q){return p<q?p:q;}
int main(){
	scanf("%d",&n);it i,j,s;
	for(i=pw[0]=1;i<=30;++i) pw[i]=pw[i-1]<<1;
	for(i=0;i<n;++i) scanf("%d%d%d",&x[i],&y[i],&z[i]);
//	x[n]=x[1],y[n]=y[1],z[n]=z[1],++n;
	for(i=0;i<n;++i)
		for(j=0;j<n;++j)
			w[j][i]=A(x[i]-x[j])+A(y[i]-y[j])+Max(z[i]-z[j],0);
	//printf("%d %d\n",w[0][1]);
	ct lim=1<<n;
	for(i=0;i<n;++i) for(j=0;j<=lim;++j) f[i][j]=inf;
	f[0][1]=0;
	for(s=0;s<lim;++s)
		for(i=0;i<n;++i)
			if(f[i][s]<inf){
				for(j=0;j<n;++j){
					if(s>>j&1) continue;
		//			if(i==0&&j==n-1) continue;
					f[j][s|pw[j]]=Min(f[j][s|pw[j]],f[i][s]+w[i][j]);
				}
			}
	rll ans=inf;
	for(i=1;i<n;++i) ans=Min(ans,f[i][lim-1]+w[i][0]);
	printf("%lld",ans);
//	printf("%lld",f[n-1][lim-1]);
	return 0;
}
/*
f[i][S]=现在走到 i，已经走了的状态集合是S
f[j][S|pw[j]]=f[i][S]+a[i][j]
*/

#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(), a.end()
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define fb(i,b,a) for(int i=b;i>=a;i--)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 20;
const ll inf = 1e18 + 5;

int n;
array<ll,3> niz[maxn];

ll dp[maxn][(1 << 17)];

ll dist[maxn][maxn];

ll memo(int x, int mask){
    if(mask == (1 << n) - 1)return dist[x][0];
    if(dp[x][mask] != -1)return dp[x][mask];
    ll ans = inf;
    ff(i,0,n - 1){
        if(!(mask & (1 << i)))ans = min(ans, dist[x][i] + memo(i, mask | (1 << i)));
    }
    return dp[x][mask] = ans;
}

int main()
{
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    cin >> n;
    ff(i,0,n - 1){
        ff(j,0,2)cin >> niz[i][j];
    }
    ff(i,0,n - 1){
        ff(j,0,n - 1)dist[i][j] = abs(niz[i][0] - niz[j][0]) + abs(niz[i][1] - niz[j][1]) + max(0ll, niz[j][2] - niz[i][2]);
    }
    memset(dp, -1, sizeof(dp));
    cout << memo(0, 1) << endl;
    return 0;
}
/**

// probati bojenje sahovski ili slicno

**/


#include <bits/stdc++.h>

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    ll n, ans;

    cin >> n;
    ans = n;
    for (int b = 0; ; ++b) {
        ll p = 1LL<<b;
        brif(p > n);
        ll a = n/p;
        ll c = n%p;
        ans = min(ans, a+b+c);
    }
    cout << ans << '\n';

    return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	long long n;
	scanf("%lld",&n);
	long long ans=n;
	for(int b=0;b<=62;b++){
		long long a=n>>b;
		long long c=n-(a<<b);
		ans=min(ans,a+b+c);
	}
	printf("%lld",ans);
	return 0;
}


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

int main()
{
    int n;
    cin>>n;
    unordered_map<int,vector<int>> a;
    unordered_map<int,vector<int>> b;
    unordered_map<int,vector<int>> c;
    int cnt;
    for(int i=0;i<n;i++)
    {
        cin>>cnt;
       a[cnt].push_back(i);
    }
     for(int i=0;i<n;i++)
    {
        cin>>cnt;
        b[cnt].push_back(i);
    }
     for(int i=0;i<n;i++)
    {
        cin>>cnt;
        c[cnt-1].push_back(i);
    }
    long long int ans=0;
    for(auto j:a)
    {
        if(b.find(j.first)!=b.end())
        {
            for(auto i:b[j.first])
            {
                if(c.find(i)!=c.end())
                {
                    ans+=(j.second.size()*c[i].size());
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <vector>

int main() {
    int N;
    std::cin >> N;
    std::vector<int> A(N), B(N), C(N);
    for (auto& x : A) {
        std::cin >> x;
        x -= 1;
    }
    for (auto& x : B) {
        std::cin >> x;
        x -= 1;
    }
    for (auto& x : C) {
        std::cin >> x;
        x -= 1;
    }
    std::vector<int> count(N);
    for (int j = 0; j < N; ++j) {
        count[B[C[j]]] += 1;
    }
    long long ans = 0;
    for (int i = 0; i < N; ++i) {
        ans += count[A[i]];
    }
    std::cout << ans << '\n';
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double db;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define at(s,pos) *(s.find_by_order(pos))
#define set_ind(s,val) s.order_of_key(val)
long long int M = 1e9 + 7 ;
long long int inf = 9 * 1e18;
const double PI = acos(-1);
//CLOCK
ll begtime = clock();
#define time() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//CLOCK ENDED
ll n, m;
// modular exponentiation
ll binpow(ll val, ll deg)
{
	if (deg < 0)
		return 0;
	if (!deg)
		return 1 % M;
	if (deg & 1)
		return binpow(val, deg - 1) * val % M;
	ll res = binpow(val, deg >> 1);
	return (res * res) % M;
}
//binomial
ll modinv(ll n) {
	return binpow(n, M - 2);
}

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

	ll i, j, t, k, x, y, z,  N;
	cin >> n;
	ll a[n];
	rep(i, n) {
		cin >> a[i];
	}
	ll sum = 0;

	ll dp[n + 1][2];
	mset(dp, 0);
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % M;
		dp[i][1] = dp[i - 1][0];
	}
	//0 for +
	//1 for -

	// cout << dp[2][0] << ' ' << dp[2][1];
	rep(i, n) {

		ll prod1 = (dp[i][0] * (dp[n - 1 - i][0] + dp[n - 1 - i][1])) % M;
		ll prod2 = dp[i][1];
		if (n - 2 - i >= 0)
			prod2 = (prod2 * (dp[n - 2 - i][0] + dp[n - 2 - i][1])) % M;

		// cout << prod2 << '\n';

		(sum += (a[i] * prod1)) %= M;
		(sum -= a[i] * prod2) %= M;
		if (sum < 0) sum += M;

	}
	cout << sum;
	return 0;

}

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

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

	long long n, i, j, k, s, MOD = 1000000007, ans;
	cin >> n;
	vector<long long> a(n);
	for (i = 0; i < n; i++) cin >> a[i];

	vector<long long> dp(n, 0), dp2(n, 0);
	vector<long long> dpc(n, 0), dpc2(n, 0);

	dp[0] = a[0];
	dpc[0] = 1;

	for (i = 1; i < n; i++) {
		dpc[i] = (dpc[i - 1] + dpc2[i - 1]) % MOD;
		dp[i] = (dp[i - 1] + dp2[i - 1] + a[i] * (dpc[i - 1] + dpc2[i - 1])) % MOD;

		dpc2[i] = dpc[i - 1];
		dp2[i] = (dp[i - 1] - a[i] * dpc[i - 1] + MOD * MOD) % MOD;
	}

	ans = (dp[n - 1] + dp2[n - 1]) % MOD;
	cout << ans << "\n";

	return 0;
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i]--;
  dump(a);
  vi idx(n);
  rep(i, n) idx[a[i]] = i;
  dump(idx);
  int x = 0;
  vi ans;
  while (x < n - 1) {
    for (int i = idx[x] - 1; x <= i; i--) {
      if (i < 0 || n <= i + 1) {
        cout << -1 << endl;
        return;
      }
      swap(a[i], a[i + 1]);
      ans.push_back(i);
    }
    if (idx[x] <= x) {
      cout << -1 << endl;
      return;
    }
    x = idx[x];
  }
  dump(a);
  if (ans.size() != n - 1) {
    cout << -1 << endl;
    return;
  }
  rep(i, n) {
    if (a[i] != i) {
      cout << -1 << endl;
      return;
    }
  }
  rep(i, ans.size()) {
    cout << ans[i] + 1 << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i64 i=0; i<n; i++)
#define all(v) v.begin(),v.end()
#define pp pair<int,int>
using Graph=vector<vector<int>>;
using i64=int64_t;

int main() {
    int n;cin>>n;
    vector<int>a(n);rep(i,n)cin>>a[i];
    i64 ans=0;
    rep(i,n) {
        ans+=max(0, a[i]-10);
    }
    cout << ans;
}