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

const int N = 2e6 + 5;

int t;
int n, m, k;

int main() {
	cin >> t;
	while (t--) {
		cin >> n >> m >> k;
		if (n * m % 2)cout << "NO" << endl;
		if (n == 1) {
			if (k != m / 2)cout << "NO" << endl;
			else cout << "YES" << endl;
		}
		else if (m == 1) {
			if (k)cout << "NO" << endl;
			else cout << "YES" << endl;
		}
		else {
			if (m % 2) {
				if (k > n * (m / 2)) {
					cout << "NO" << endl;
				}
				else if (k % 2) {
					cout << "NO" << endl;
				}
				else {
					cout << "YES" << endl;
				}
			}
			else if (n % 2) {
				if (k < m / 2) {
					cout << "NO" << endl;
				}
				else if ((m / 2) % 2) {
					if (k % 2) {
						cout << "YES" << endl;
					}
					else {
						cout << "NO" << endl;
					}
				}
				else {
					if (k % 2) {
						cout << "NO" << endl;
					}
					else {
						cout << "YES" << endl;
					}
				}
			}
			else {
				if (k % 2) {
					cout << "NO" << endl;
				}
				else {
					cout << "YES" << endl;
				}
			}
		}
	}
	return 0;
}


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

int main() {
	double x, n = 0;
	cin >> x;

	while (x > 0) {
		n++;
		x -= (pow(n, 2) + n) / 2;
	}

	if (x < 0)
		cout << n - 1;
	else
		cout << n;

	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>

using namespace std;

typedef long long ll;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void checkmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<ll,ll> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)

//#define _MSC_VER 1

int n,k,m,a;
struct node{
	int num;
	int t;
	int index;
	int place;
	node(int a,int b,int c,int d){num=a;t=b;index=c;place=d;}
	node(){
		num=0;
		t=200;
	}
};
node ar[200];
bool compare1(node a,node b){
	if(a.num!=b.num){
		return a.num>b.num;
	}
	else
		return a.t<b.t;
}
bool compare2(node a,node b){
	return a.index<b.index;
}
int sum[200];
int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	scanf("%d%d%d%d",&n,&k,&m,&a);
	for(int i=1;i<=n;i++){
		ar[i]=node(0,200,i,3);

	}
	for(int i=1;i<=a;i++){
		int tmp;
		cin>>tmp;
		ar[tmp].num++;
		ar[tmp].t=i;
	}
	sort(ar+1,ar+n+1,compare1);
	int tt=ar[k+1].num;
	if(k!=n){
		for(int i=k;i>0;i--){
			sum[i]=tt;
			tt+=ar[i].num;
		}

	}
	for(int i=1;i<=n;i++){
		if(i<=k){
			if(m-a==0){
				if(ar[i].num==0){
				ar[i].place=3;
				}
				else
					ar[i].place=1;
				continue;
			}
			if(ar[i].num==0){
				ar[i].place=2;
				continue;
			}
			int end=k+1;
			if(end>n)
				ar[i].place=1;
			else{
				int need=(end-i)*(ar[i].num+1)-sum[i];
				if((m-a<need))
					ar[i].place=1;
				else
					ar[i].place=2;
			}

		}
		else{
			if(m-a==0){
				ar[i].place=3;
				continue;

			}
			if(ar[i].num+m-a<=ar[k].num){
				ar[i].place=3;
			}
			else
				ar[i].place=2;
		}
	}
	sort(ar+1,ar+n+1,compare2);
	for(int i=1;i<=n;i++)
		cout<<ar[i].place<<" ";
	cout<<endl;
	return 0;

}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int flag,maxx;
char st[210000];
int b[30],n;
int main()
{
	scanf("%d",&n);
	scanf("%s",st);
	for (int i=n;i;i--)
		for (int j=0;j<n-i+1;j++)
		{
			flag=0;
			for (int k=0;k<26;k++) b[k]=0;
			for (int k=j;k<=j+i-1;k++)
				if (st[k]>='a'&&st[k]<='z')
				{
					b[st[k]-'a']++;
				} else flag=1;
			if (flag) continue;
			int ans=0;
			for (int k=0;k<26;k++) ans+=b[k]>0;
			maxx=max(maxx,ans);
		}
	printf("%d\n",maxx);
}


#include <iostream>
#include <map>

using std::cin;
using std::cout;
using std::make_pair;

int main() {
  std::ios::sync_with_stdio(false);
  int n, x, y, count = 0;
  cin >> n;
  std::multimap<int, int> m;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    m.insert(make_pair(x, y));
  }

  for (auto i = m.begin(); i != m.end(); ++i) {
    for (auto j = std::next(i,1); j != m.end(); ++j) {
      if (i->first == j->second) {
        count++;
      }
      if (i->second == j->first) {
        count++;
      }
    }
  }
  cout << count;
  return 0;
}


#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define rfr(i,n) for(int i=n-1;i>=0;i--)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define pb push_back
#define debug(P) cout<<#P<<' '<<P<<endl
#define endl '\n'
//#define mod 1000000007

using namespace std;

typedef long long ll;

const int MAXN = 100001;

vector<int> primes;
bool prime[MAXN];

void sieve(){
    fr(i,MAXN)prime[i]=true;
    prime[0]=prime[1]=false;
    for(int i=2;i*i<MAXN;i++){
        for(int j=2*i;j<MAXN;j+=i)prime[j]=false;
    }
    fr(i,MAXN)if(prime[i])primes.pb(i);
}

ll modPower(ll x,ll y,ll mod){
    x%=mod;
    ll res = 1;
    while(y){
        if(y&1)res= (res*x)%mod;
        x = (x*x)%mod;
        y>>=1;
    }
    return res;
}

//vector<int> adj[MAXN];

int dp[26][51];

int n , k;

bool p[27];
int fun(int i , int l ){
    if(l == k){return 0;}

    if(i >= 26) return 100000;

    if(dp[i][l])return dp[i][l];

    if(p[i])return dp[i][l] = min( fun(i+1 , l) , i + 1 + fun(i+2 , l+1) );
    else return dp[i][l] = fun(i+1 , l);
}

int main(){
    cin>>n>>k;
    string s;
    cin>>s;
    if( k > 13){ cout<< -1 << endl; exit(0);}
    fr(i,s.length()){
        p[s[i] - 'a'] = 1;
    }

    int ans = fun( 0 , 0 ) ;

    if(ans == 100000)cout<<"-1\n";
    else cout<<ans<<endl;
}


#include "bits/stdc++.h"
using namespace std;
const int N = 5e6 + 6;
int tt;
long long f[N];
long long get(int x) {
	return (1LL * x * (x - 1) ) / 2LL;
}

long long solve(int x) {
	if(x == 1) return 0;
	long long rekt = (long long) 1e18;
	for(int i = 1; 1LL * i * i <= x; ++i) {
		if(x % i == 0) {
		if(i != 1) {
			rekt = min(rekt , ((x / i) * get(i)) + solve(x / i) );
		}
		if((x / i) != 1 and (x / i) != i) {
			rekt = min(rekt , (i * get(x / i) ) + solve(i) );
		}
	}
	}
	return rekt;
}
const int mod = (int) 1e9 + 7;

long long mul(long long x , long long y) {
	return (x % mod * y % mod) % mod;
}
long long add(long long a , long long b) {
	return (a % mod + b % mod) % mod;
}
int T[N];
int main() {
	for(int i = 0; i < N; ++i) f[i] = (long long) 1e18;
	f[0] = f[1] = 0;
	for(int i = 2; i < N; ++i) f[i] = get(i);
	for(int i = 2; i < N; ++i) {
		long long cur = get(i);
		for(int j = i + i; j < N; j += i) {
			if((j / i) <= i) {
				f[j] = min(f[j] , (1LL * (j / i) * f[i]) + f[j / i] );
				f[j] = min(f[j] , (1LL * i * f[j / i]) + f[i]);
			}
		}
	}
	int t , l , r;
	scanf("%d %d %d" , &t , &l , &r);
	T[0] = 1;
	for(int i = 1; i < N; ++i) {
		T[i] = mul(T[i - 1] , 1LL * t);
	}
	long long ans = 0;
	for(int i = l; i <= r; ++i) {
		ans = add(ans , mul(f[i] , T[i - l]) );
	}
	printf("%lld\n" , ans);
	return 0;
}


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

typedef long long ll;
typedef long double ld;

vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b) {
    int n = a.size();
    int k = b.size();
    int m = b[0].size();
    vector<vector<ll>> c(n, vector<ll>(m, 1e10));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int z = 0; z < k; z++) {
                c[i][j] = min(c[i][j], a[i][z] + b[z][j]);
            }
        }
    }
    return c;
}

vector<vector<ll>> fast_pow(vector<vector<ll>> v, int p) {
    vector<vector<ll>> res = v;
    p--;
    while (p) {
        if (p & 1) {
            res = mul(res, v);
            p--;
        } else {
            v = mul(v, v);
            p /= 2;
        }
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n);
    for (int &e : a) {
        cin >> e;
    }
    for (int &e : b) {
        cin >> e;
    }
    vector<vector<ll>> v(2 * n, vector<ll>(2 * n, 1e10));
    ll dp[2 * n][2 * n][2 * n];
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            for (int z = 0; z < 2 * n; z++) {
                dp[i][j][z] = 1e10;
            }
        }
    }
    for (int i = 0; i < 2 * n; i++) {
        dp[0][i][i] = 0;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            for (int z = 0; z < 2 * n; z++) {
                if (z && dp[i - 1][j][z - 1] != 1e10) {
                    dp[i][j][z] = min(dp[i][j][z], dp[i - 1][j][z - 1] + a[i - 1]);
                }
                if (z + 1 < 2 * n && dp[i - 1][j][z + 1] != 1e10) {
                    dp[i][j][z] = min(dp[i][j][z], dp[i - 1][j][z + 1] + b[i - 1]);
                }
            }
        }
    }
    for (int i = 0; i < 2 * n; i++) {
        for (int j = 0; j < 2 * n; j++) {
            v[i][j] = dp[n][i][j];
        }
    }
    v = fast_pow(v, m);
    cout << v[0][0];
}


#include<bits/stdc++.h>
using namespace std;
#define sz(v) (int) v.size()
#define all(v) v.begin(),v.end()
#define in freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define ios  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<bool> isPrime(1e7 + 1, 1), ispal(1e7 + 1, 0);

void sieve(int n) {
	isPrime[0] = isPrime[1] = 0;
	for (long long i = 2; i * i <= n; ++i) {
		if (isPrime[i]) {
			for (int j = i * 2; j <= n; j += i)
				isPrime[j] = 0;
		}
	}
}

bool ispalindrome(string s) {
	bool flag=1;
	for(int i=0;i<sz(s)/2;i++) {
		if(s[i]!=s[sz(s)-i-1]) flag=0;
	}
	return flag;
}

int main() {

	sieve(2000000);

	long long a, b;

	cin >> a >> b;

	for (int i = 0; i < 2000000; i++) {
		string s = to_string(i);
		if (ispalindrome(s)) {
			ispal[i] = 1;
		}
	}

	int pal = 0, pr = 0, ans = -1;

	for (int i = 1; i <= 2000000; i++) {
		if(isPrime[i]) pr++;
		if(ispal[i]) pal++;
		if(pr*b<=pal*a) {
			ans=i;
		}
	}

	if(ans==-1) {
		cout << "Palindromic tree is better than splay tree";
	}
	else {
		cout << ans;
	}
	return 0;
}


#include<cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
#include <iomanip>
#include <complex>
#include <queue>
#include <functional>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define last(a) int(a.size() - 1)
#define all(a) a.begin(), a.end()
#define seta(a,x) memset (a, x, sizeof (a))
#define I (int)
#define SZ(x) ((int) (x).size())
#define FE(i,x) for(typedef((x).begin() i=(x).begin();i!=(x).end();i++)

typedef long long int  int64;
typedef unsigned long long int uint64;
typedef long double ldb;
typedef pair <int, int> pii;
typedef vector<int>vi;
typedef vector<string>vs;

template <class T> T sqr (T x) {return x * x;}
int main()
{
  int al,ar;
  int bl,br;
  cin>>al>>ar;
  cin>>bl>>br;

  if((al>=br-3&&al<=br+1)||(ar>=bl-3&&ar<=bl+1)||(br>=al-1&&br<=2*(al+1))||(bl>=ar-1&&bl<=2*(ar+1)))
  {
    printf("YES\n");
  }
  else
    printf("NO\n");

return 0;
}


/*input
4 5
asdf

*/

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int INF = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  ll n, k;
  cin >> n >> k;
  string str;
  cin >> str;
  vector <vector <int> > lst(n, vector <int> (26, -1));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      if (i) lst[i][j] = lst[i - 1][j];
    }
    lst[i][str[i] - 'a'] = i;
  }
  vector <vector <ll> > dp(n + 1, vector <ll> (n + 1));
  for (int i = 0; i < n; i++) {
    dp[i][1] = 1;
  }
  for (int len = 2; len <= n; len++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < 26; j++) {
        if (lst[i - 1][j] != -1) {
          dp[i][len] = min((ll)1e12, dp[i][len] + dp[lst[i - 1][j]][len - 1]);
        }
      }
    }
  }

  ll ans = 0;
  for (int i = n; i >= 0 && k; i--) {
    ll cnt = 0;
    for (int j = 0; j < 26; j++) {
      if (lst[n - 1][j] != -1) {
        cnt += dp[lst[n - 1][j]][i];
      }
    }
    if (i == 0) cnt = 1;
    if (k >= cnt) {
      ans += cnt * 1ll * (n - i);
      k -= cnt;
    }
    else {
      ans += k * 1ll * (n - i);
      k = 0;
      break;
    }
  }
  cout << (k == 0 ? ans : -1) << endl;

  return 0;
}


#include <iostream>
#include <vector>
using namespace std;
int main() {
    long long n;
    cin >> n;
    long long ans = 0;
    if (n == 1) {
        cout << 1;
        return 0;
    }
    if (n == 2) {
        cout << 3;
        return 0;
    }
    if (n == 3) {
        cout << 7;
        return 0;
    }
    for (long long i = 0; i < n - 1ll; i++) {
        ans += (i + 1ll) * (n - i - 1) + 1ll;
    }
    cout << ans + 1ll;
    return 0;
}


#include <cstdio>
#include <vector>
using namespace std;
const int MAXN=500005;
int n, m, q, num, dfc;
int a[MAXN], w[MAXN];
int u[MAXN], v[MAXN], f[MAXN];
int opt[MAXN], ob[MAXN], p[MAXN];
bool cut[MAXN];
int op[MAXN], cl[MAXN];
vector<int> G[MAXN];
int getf(int x)
{
	if (x==f[x]) return x;
	return f[x]=getf(f[x]);
}
void merge(int u, int v)
{
	int x=getf(u), y=getf(v);
	if (x!=y)
	{
		f[x]=f[y]=++num;
		G[num].push_back(x);
		G[num].push_back(y);
	}
}
void DFS(int u)
{
	op[u]=++dfc;
	for (int v: G[u]) DFS(v);
	cl[u]=dfc;
}
namespace SGT
{
	struct Node
	{
		int l, r;
		pair<int, int> val;
	} tr[4*MAXN];
#define lc (o<<1)
#define rc (o<<1|1)
	void pushup(int o)
	{
		tr[o].val=max(tr[lc].val, tr[rc].val);
	}
	void build(int o, int l, int r, int* a)
	{
		tr[o].l=l, tr[o].r=r;
		if (l==r) return tr[o].val=make_pair(a[l], l), void();
		int mid=(l+r)>>1;
		build(lc, l, mid, a);
		build(rc, mid+1, r, a);
		pushup(o);
	}
	pair<int, int> query(int o, int l, int r)
	{
		if (tr[o].l>r||tr[o].r<l) return make_pair(0, 0);
		if (l<=tr[o].l&&tr[o].r<=r) return tr[o].val;
		return max(query(lc, l, r), query(rc, l, r));
	}
	void modify(int o, int p)
	{
		if (tr[o].l==tr[o].r) return tr[o].val.first=0, void();
		int mid=(tr[o].l+tr[o].r)>>1;
		if (p<=mid) modify(lc, p);
		else modify(rc, p);
		pushup(o);
	}
#undef lc
#undef rc
}
int main()
{
//	freopen("D.in", "r", stdin);
//	freopen("D.out", "w", stdout);
	scanf("%d%d%d", &n, &m, &q);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	for (int i=1; i<=m; i++) scanf("%d%d", &u[i], &v[i]);
	for (int i=1; i<=n+m; i++) f[i]=i;
	for (int i=1; i<=q; i++)
	{
		scanf("%d%d", &opt[i], &ob[i]);
		if (opt[i]==2) cut[ob[i]]=1;
	}
	num=n;
	for (int i=1; i<=m; i++)
		if (!cut[i]) merge(u[i], v[i]);
	for (int i=q; i>=1; i--)
		if (opt[i]==1) p[i]=getf(ob[i]);
		else merge(u[ob[i]], v[ob[i]]);
	for (int i=1; i<=num; i++)
		if (getf(i)==i) DFS(i);
	for (int i=1; i<=num; i++) w[op[i]]=a[i];
	SGT::build(1, 1, num, w);
	for (int i=1; i<=q; i++)
		if (opt[i]==1)
		{
			auto ret=SGT::query(1, op[p[i]], cl[p[i]]);
			printf("%d\n", ret.first);
			SGT::modify(1, ret.second);
		}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(false)
#define For(i, x, y) for(int i = x; i <= y; i++)
#define For_(i, x, y) for(int i = x; i >= y; i--)
const int inf = 0x3f3f3f3f;
const ll Inf = 1e18;
const int mod = 1e9 + 7;

ll fastpow(ll x, ll k)
{
	ll base = x;
	ll ret = 1;
	while (k) {
		if (k & 1) {
			ret *= base;
			ret %= mod;
		}
		base *= base;
		base %= mod;
		k >>= 1;
	}
	return ret;
}

int main(void)
{
	ll a, b, x, n;
	cin >> a >> b >> n >> x;
	if (a == 1) {
		cout << (n % mod * b + x) % mod << endl;
		return 0;
	}
	ll tmp = fastpow(a, n);
	cout << (((tmp - 1) * fastpow(a - 1, mod - 2) % mod) * b % mod + tmp * (x % mod) % mod) % mod << endl;
	return 0;
}


#include <string.h>
#include <sstream>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <stack>
#include <queue>
#include <set>

#include <map>
#include <vector>
#include <string>
#include <stdlib.h>

#define ll long long
#define clr(x) memset(x,0,sizeof(x))
#define _clr(x) memset(x,-1,sizeof(x))
#define fr(i,a,b) for(int i = a; i < b; ++i)
#define frr(i,a,b) for(int i = a; i > b; --i)
#define pb push_back
#define sf scanf

#define pf printf
#define mp make_pair

using namespace std;
const int N = 400000;
const int M = 2000001;
const double eps = 1e-7;

const ll mod = 1000000007;

int n,q;
int p[M];
int cnt[M],num[M];
int fa[M];
int is[M],pr[M];
int ct;

void init() {
	for(int i = 2; i <M; ++i) {
		if(!is[i]) {
			pr[ct++]=i;
			fa[i]=i;
		}
		for(int j = 0; j < ct&&i*pr[j]<M;++j){
			is[i*pr[j]]=1;
			fa[i*pr[j]]=pr[j];
			if(i%pr[j]==0)break;
		}
	}
}

int main() {
	init();
	cin>>n;
	fr(i,0,n) {
		sf("%d",&p[i]);
	}
	sort(p,p+n);
	ll ans = 1;
	for(int i = n-1; i >=0; --i) {
		if(!cnt[p[i]]) {
			cnt[p[i]]=1;
			num[p[i]]=1;
			ans = (ans * p[i])%mod;
			//printf("i = %d ans = %lld\n",i,ans);
		}
		else {
			int v = --p[i];
			while(v>1) {
				int u = fa[v];
				//printf("i = %d v = %d u = %d\n",i,v,u);
				int nu = 0;
				while(v%u==0)v/=u,nu++;
				if(cnt[u]<nu) {
					for(int j = cnt[u];j < nu; ++j) {
						ans = (ans * u)%mod;
					}
					cnt[u]=nu;
					num[u]=1;
				}
				else {
					if(cnt[u]==nu) num[u]++;
				}
				//printf("factor = %d nu = %d ans = %lld\n",u,nu, ans);
			}
		}
	}
	fr(i,0,n) {
		int flag = 0;
		int v = p[i];
		while(v>1) {
			int u = fa[v];
			int nu = 0;
			while(v%u==0)v/=u,nu++;
			//printf("factor = %d nu = %d ans = %lld\n",u,nu, ans);
			//printf("v = %d factor = %d nu = %d cnt = %d num = %d\n",v,u,nu,cnt[u],num[u]);
			if(cnt[u]==nu&&num[u]==1) flag = 1;
		}

		if(!flag) {
			ans++;
			break;
		}
	}
	cout<<ans<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define db long double

int n;
int a[1000007];
int ans = 1e9;

int dd[33];
int kk = 0;

void check(int x){
	if (a[x] == 0) return;
	kk = 0;
	int save = x;
	while(1){
		if (a[x] == 0) break;
		dd[kk++] = a[x];
		x /= a[x];
	}
	dd[kk++] = x;
	for (int i = 0; i < kk; i++){
		if (save - dd[i] + 1 >= 3) ans = min(ans, save - dd[i] + 1);
	}
}

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 2; i < 1000007; i++) if (a[i] == 0){
    	for (int j = 2 * i; j < 1000007; j += i){
    		if (a[j] == 0) a[j] = i;
    	}
    }
    int save = n;
    set<int> se;
    while(1){
    	if (a[n] == 0) break;
    	se.insert(a[n]);
    	n /= a[n];
    }
    se.insert(n);
    ans = save;
    for (int x : se){
    	for (int i = save; i >= save - x + 1; i--){
    		check(i);
    	}
    }
    cout << ans;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
       string str;
       cin>>str;
       int count1=0,count2=0;
       for(int i=0;i<str.size();i++)
       {
              if(str[i]=='4')
              count1++;
              else if(str[i]=='7')
              count2++;
       }
       if(count2>count1)
       {
              cout<<"7";return 0;
       }
       if(count1>count2)
       {
              cout<<"4";return 0;
       }
       else if(count1==count2 && count1!=0 && count2!=0)
       {
              cout<<"4";return 0;
       }
       cout<<"-1";
       return 0;
}


// powered by c++11
// by Isaunoya
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize( \
    "inline,-fgcse,-fgcse-lm,-fipa-sra,-ftree-pre,-ftree-vrp,-fpeephole2,-ffast-math,-fsched-spec,unroll-loops,-falign-jumps,-falign-loops,-falign-labels,-fdevirtualize,-fcaller-saves,-fcrossjumping,-fthread-jumps,-funroll-loops,-freorder-blocks,-fschedule-insns,inline-functions,-ftree-tail-merge,-fschedule-insns2,-fstrict-aliasing,-fstrict-overflow,-falign-functions,-fcse-follow-jumps,-fsched-interblock,-fpartial-inlining,no-stack-protector,-freorder-functions,-findirect-inlining,-fhoist-adjacent-loads,-frerun-cse-after-loop,inline-small-functions,-finline-small-functions,-ftree-switch-conversion,-foptimize-sibling-calls,-fexpensive-optimizations,inline-functions-called-once,-fdelete-null-pointer-checks")

#include <bits/stdc++.h>

#define rep(i, x, y) for (register int i = (x); i <= (y); ++i)
#define Rep(i, x, y) for (register int i = (x); i >= (y); --i)

using namespace std;
using db = double;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;

using pii = pair<int, int>;

#define fir first
#define sec second

template <class T>

void cmax(T& x, const T& y) {
  if (x < y) x = y;
}

template <class T>

void cmin(T& x, const T& y) {
  if (x > y) x = y;
}

#define all(v) v.begin(), v.end()
#define sz(v) ((int)v.size())
#define pb emplace_back

template <class T>

void sort(vector<T>& v) {
  sort(all(v));
}

template <class T>

void reverse(vector<T>& v) {
  reverse(all(v));
}

template <class T>

void unique(vector<T>& v) {
  sort(all(v)), v.erase(unique(all(v)), v.end());
}

void reverse(string& s) { reverse(s.begin(), s.end()); }

const int io_size = 1 << 23 | 233;
const int io_limit = 1 << 22;
struct io_in {
  char ch;
#ifndef __WIN64
  char getchar() {
    static char buf[io_size], *p1 = buf, *p2 = buf;

    return (p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, io_size, stdin), p1 == p2) ? EOF : *p1++;
  }
#endif
  io_in& operator>>(char& c) {
    for (c = getchar(); isspace(c); c = getchar())
      ;

    return *this;
  }
  io_in& operator>>(string& s) {
    for (s.clear(); isspace(ch = getchar());)
      ;

    if (!~ch) return *this;

    for (s = ch; !isspace(ch = getchar()) && ~ch; s += ch)
      ;

    return *this;
  }

  io_in& operator>>(char* str) {
    char* cur = str;
    while (*cur) *cur++ = 0;

    for (cur = str; isspace(ch = getchar());)
      ;
    if (!~ch) return *this;

    for (*cur = ch; !isspace(ch = getchar()) && ~ch; *++cur = ch)
      ;

    return *++cur = 0, *this;
  }

  template <class T>

  void read(T& x) {
    bool f = 0;
    while ((ch = getchar()) < 48 && ~ch) f ^= (ch == 45);

    x = ~ch ? (ch ^ 48) : 0;
    while ((ch = getchar()) > 47) x = x * 10 + (ch ^ 48);
    x = f ? -x : x;
  }

  io_in& operator>>(int& x) { return read(x), *this; }

  io_in& operator>>(ll& x) { return read(x), *this; }

  io_in& operator>>(uint& x) { return read(x), *this; }

  io_in& operator>>(ull& x) { return read(x), *this; }

  io_in& operator>>(db& x) {
    read(x);
    bool f = x < 0;
    x = f ? -x : x;
    if (ch ^ '.') return *this;

    double d = 0.1;
    while ((ch = getchar()) > 47) x += d * (ch ^ 48), d *= .1;
    return x = f ? -x : x, *this;
  }
} in;

struct io_out {
  char buf[io_size], *s = buf;
  int pw[233], st[233];

  io_out() {
    set(7);
    rep(i, pw[0] = 1, 9) pw[i] = pw[i - 1] * 10;
  }

  ~io_out() { flush(); }

  void io_chk() {
    if (s - buf > io_limit) flush();
  }

  void flush() { fwrite(buf, 1, s - buf, stdout), fflush(stdout), s = buf; }

  io_out& operator<<(char c) { return *s++ = c, *this; }

  io_out& operator<<(string str) {
    for (char c : str) *s++ = c;
    return io_chk(), *this;
  }

  io_out& operator<<(char* str) {
    char* cur = str;
    while (*cur) *s++ = *cur++;
    return io_chk(), *this;
  }

  template <class T>

  void write(T x) {
    if (x < 0) *s++ = '-', x = -x;

    do {
      st[++st[0]] = x % 10, x /= 10;
    } while (x);

    while (st[0]) *s++ = st[st[0]--] ^ 48;
  }

  io_out& operator<<(int x) { return write(x), io_chk(), *this; }

  io_out& operator<<(ll x) { return write(x), io_chk(), *this; }

  io_out& operator<<(uint x) { return write(x), io_chk(), *this; }

  io_out& operator<<(ull x) { return write(x), io_chk(), *this; }

  int len, lft, rig;

  void set(int _length) { len = _length; }

  io_out& operator<<(db x) {
    bool f = x < 0;
    x = f ? -x : x, lft = x, rig = 1. * (x - lft) * pw[len];
    return write(f ? -lft : lft), *s++ = '.', write(rig), io_chk(), *this;
  }
} out;
#define int long long

template <int sz, int mod>

struct math_t {
  math_t() {
    fac.resize(sz + 1), ifac.resize(sz + 1);
    rep(i, fac[0] = 1, sz) fac[i] = fac[i - 1] * i % mod;

    ifac[sz] = inv(fac[sz]);
    Rep(i, sz - 1, 0) ifac[i] = ifac[i + 1] * (i + 1) % mod;
  }

  vector<int> fac, ifac;

  int qpow(int x, int y) {
    int ans = 1;
    for (; y; y >>= 1, x = x * x % mod)
      if (y & 1) ans = ans * x % mod;
    return ans;
  }

  int inv(int x) { return qpow(x, mod - 2); }

  int C(int n, int m) {
    if (n < 0 || m < 0 || n < m) return 0;
    return fac[n] * ifac[m] % mod * ifac[n - m] % mod;
  }
};

int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
int lcm(int x, int y) { return x * y / gcd(x, y); }

const int maxn = 8e6 + 63;
const int P = 998244353;
const int G = 3;
const int Gi = 332748118;

int n, m, rev[maxn];
int a[maxn], b[maxn];
int limit = 1;
int Inv = 0;

inline int qpow(int x, int y) {
  int ans = 1;
  for (; y; y >>= 1, x = x * x % P)
    if (y & 1) ans = ans * x % P;
  return ans;
}

inline int inc(const int& x, const int& y) { return (x + y >= P) ? (x + y - P) : x + y; }
inline int dec(const int& x, const int& y) { return (x - y >= 0) ? x - y : (x - y + P); }
inline void swap(int& x, int& y) { x ^= y ^= x ^= y; }

void NTT(int* A, int type) {
  rep(i, 0, limit) if (i < rev[i]) swap(A[i], A[rev[i]]);
  for (int len = 1; len < limit; len <<= 1) {
    int Wn = qpow(type == 1 ? G : Gi, (P ^ 1) / (len << 1));
    for (int i = 0; i < limit; i += len << 1) {
      int w = 1;
      for (int j = 0, x, y; j < len; j++, w = w * Wn % P) {
        x = A[i + j], y = A[i + j + len] * w % P;
        A[i + j] = inc(x, y), A[i + j + len] = dec(x, y);
      }
    }
  }
  if (type == -1) {
    for (int i = 0; i < limit; i++) A[i] = A[i] * Inv % P;
  }
}

void init(int n) {
  limit = 1;
  int l = 0;
  while (limit <= n) {
    limit <<= 1, ++l;
  }
  for (int i = 0; i < limit; i++) rev[i] = rev[i >> 1] >> 1 | (i & 1) << l - 1;
  Inv = qpow(limit, P - 2);
}

signed main() {
  // code begin.
  in >> n >> m;
  n >>= 1;
  while (m--) {
    int x;
    in >> x;
    b[x] = 1;
  }
  a[0] = 1;
  init(10 << 2);
  while (n) {
    if (n & 1) {
      int mx = 0;
      for (int i = 0; i < limit; i++)
        if (b[i]) mx = i;
      init(mx << 2);
      NTT(a, 1), NTT(b, 1);
      for (int i = 0; i < limit; i++) a[i] = a[i] * b[i] % P;
      NTT(a, -1), NTT(b, -1);
    }
    int mx = 0;
    for (int i = 0; i < limit; i++)
      if (b[i]) mx = i;
    init(mx << 2);
    NTT(b, 1);
    for (int i = 0; i < limit; i++) b[i] = b[i] * b[i] % P;
    NTT(b, -1);
    n >>= 1;
  }
  int ans = 0;
  for (int i = 0; i < limit; i++) ans = inc(ans, (a[i] * a[i]) % P);
  out << ans << '\n';
  return 0;
  // code end.
}


#pragma GCC optimize("O3")
#ifdef ONLINE_JUDGE
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <deque>
#include <type_traits>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
template<typename Key=int,typename Mapped=__gnu_pbds::null_type,typename Cmp_Fn=std::less<Key>,typename Tag=__gnu_pbds::rb_tree_tag,template<typename Const_Node_Iterator,typename Node_Iterator,typename Cmp_Fn_,typename Allocator_>class Node_Update=__gnu_pbds::tree_order_statistics_node_update,typename Allocator=std::allocator<char>>class ordered_set_t:__gnu_pbds::tree<Key,Mapped,Cmp_Fn,Tag,Node_Update,Allocator>{};const int GRANDOM=std::chrono::high_resolution_clock::now().time_since_epoch().count();struct ghash{int operator()(int x){return std::hash<int>{}(x^GRANDOM);}};template<typename KeyType>class hash_table_t:__gnu_pbds::gp_hash_table<KeyType,int,ghash>{};namespace vh{template<class T>void _R(T&x){std::cin>>x;}inline void _R(int&x){scanf("%d",&x);}inline void _R(int64_t&x){scanf("%" SCNd64,&x);}inline void _R(double&x){scanf("%lf",&x);}inline void _R(char&x){scanf(" %c",&x);}inline void _R(char*x){scanf("%s",x);}inline void R(){}template<class T,class... U>inline void R(T&head,U&... tail){_R(head);R(tail...);}template<class T>void _W(const T&x){cout<<x;}inline void _W(const int&x){printf("%d",x);}inline void _W(const int64_t&x){printf("%" PRId64,x);}inline void _W(const double&x){printf("%.16f",x);}inline void _W(const char&x){putchar(x);}inline void _W(const char*x){printf("%s",x);}template<class T>inline void _W(const vector<T>&x){for(auto i=x.begin();i!=x.end();_W(*i++))if(i!=x.cbegin())putchar(' ');}inline void W(){}template<class T,class... U>inline void W(const T&head,const U&... tail){_W(head);if(sizeof...(tail))putchar(' '),W(tail...);}template<class T,class... U>inline void WL(const T&head,const U&... tail){_W(head);putchar(sizeof...(tail)? ' ':'\n');W(tail...);}};
#define prec setprecision
namespace vh{typedef long long ll;typedef unsigned long long llu;template<typename T>T gcd(T m,T n){while(n){T t=m%n;m=n;n=t;};return m;}template<typename T>T exgcd(T a,T b,T&sa,T&ta){T q,r,sb=0,tb=1,sc,tc;sa=1,ta=0;if(b)do q=a/b,r=a-q*b,a=b,b=r,sc=sa-q*sb,sa=sb,sb=sc,tc=ta-q*tb,ta=tb,tb=tc;while(b);return a;}template<typename T>T mul_inv(T a,T b){T t1=a,t2=b,t3;T v1=1,v2=0,v3;T x;while(t2!=1)x=t1/t2,t3=t1-x*t2,v3=v1-x*v2,t1=t2,t2=t3,v1=v2,v2=v3;return(v2+b)%b;}template<typename T>T powmod(T a,T b,T MOD){if(b<0)return 0;T rv=1;while(b)(b%2)&&(rv=(rv*a)%MOD),a=a*a%MOD,b/=2;return rv;}template<typename T>inline T isqrt(T k){T r=sqrt((double)k)+1;while(r*r>k)r--;return r;}template<typename T>inline T icbrt(T k){T r=cbrt((double)k)+1;while(r*r*r>k)r--;return r;}template<typename T>bool mul_overflow(T&r,T a,T b){return __builtin_mul_overflow(a,b,&r);}template<ll n>struct BitSize{enum{Size=BitSize<n/2>::Size+1};};template<>struct BitSize<0>{enum{Size=1};};template<>struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define BITMAX(n) (BitSize<n>::Size - 1)
#define DEBUG !defined(ONLINE_JUDGE)
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RALL(x) (x).rbegin(),(x).rend()
template<typename TH>void _dbg(const char*sdbg,TH h){cerr<<sdbg<<"="<<h<<"\n";}template<typename TH,typename... TA>void _dbg(const char*sdbg,TH h,TA... t){while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<",";_dbg(sdbg+1,t...);}
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; for(auto itt: x) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
}namespace vh{template<typename T>int min_rotation(vector<T>s){int a=0,N=s.size();for(int b=0;b<N;b++)for(int i=0;i<N;i++){if(a+i==b||s[(a+i)%N]<s[(b+i)%N]){b+=max(0,i-1);break;}if(s[(a+i)%N]>s[(b+i)%N]){a=b;break;}}return a;}}namespace vh{template<ll MOD,typename T=ll>class FiniteField{typedef FiniteField<MOD,T>self;public:ll val;FiniteField(ll x=0):val(normalize(x)){}inline T normalize(T x){x%=MOD;return normalize2(x);}inline T normalize2(T x){if(x<0)x+=MOD;if(x>=MOD)x-=MOD;return x;}self&operator=(const self&o){val=o.val;return*this;}template<typename NT>self&operator=(const NT o){val=normalize(o);return*this;}self&operator+=(const self&o){val=normalize2(val+o.val);return*this;}template<typename NT>self&operator+=(const NT o){val=normalize(val+(o));return*this;}self&operator-=(const self&o){val=normalize2(val-o.val);return*this;}template<typename NT>self&operator-=(const NT o){val=normalize(val-(o));return*this;}self&operator*=(const self&o){return*this*=o.val;}template<typename NT>self&operator*=(const NT o){val=normalize(val*o);return*this;}self operator+(const self&o){return self(normalize2(val+o.val));}template<typename NT>self operator+(const NT o){return self(normalize2(val+(o)));}self operator-(const self&o){return self(normalize2(val-o.val));}template<typename NT>self operator-(const NT o){return self(normalize2(val-(o)));}self operator-(){return self(normalize(-val));}self operator*(const self&o){return self(normalize(val*o.val));}template<typename NT>self operator*(const NT o){return self(normalize(val*(o)));}operator T()const{return val;}};};namespace vh{};
namespace vh{
  const int maxn=3e5+7;
  const ll MOD=998244353;
  int n;
  vector<int>adj[maxn];
  typedef FiniteField<MOD>number_t;
  struct DPE{
    number_t matched;
    number_t unmatched;
    number_t unused;
  };
  DPE solve(int u,int p){
    DPE r={1,0,1};
    vector<number_t>matchable;
    vector<number_t>matched;
    for(int v:adj[u]){
      if(v!=p){
        auto r2=solve(v,u);
        auto r2matchable=r2.unmatched+r2.unused;
        matchable.push_back(r2matchable);
        matched.push_back(r2.matched);
        r.matched*=r2matchable;
        r.unused*=r2.unused;
     }
    }
    int sz=matchable.size();
    if(sz){
      vector<number_t>matchableLeft(sz,0);
      vector<number_t>matchableRight(sz,0);
      matchableLeft[0]=1;
      for(int i=1;i<sz;i++)matchableLeft[i]=matchableLeft[i-1]*matchable[i-1];
      matchableRight[sz-1]=1;
      for(int i=sz-2;i>=0;i--)matchableRight[i]=matchableRight[i+1]*matchable[i+1];
      for(int i=0;i<sz;i++){
        r.unmatched+=matchableLeft[i]*matched[i]*matchableRight[i];
      }
    }
    r.unused+=r.unmatched;
    return r;
  }
  int main(){
    srand(GRANDOM);
    cin>>n;
    for(int i=2;i<=n;i++){
      int u,v;cin>>u>>v;
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    cout<<(solve(1,0).unused).val<<endl;
    return 0;
  }
};
int main(int argc,char*argv[]){
  std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
  return vh::main();
}


#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;
long long mod=1e9+7;
char b[10005];
long long quickpow(long long a,int n)
{
    long long ans=1;
    while(n)
    {
        if(n&1)
        {
           ans=ans*a%mod;
        }
        n>>=1;
        a=a*a%mod;
    }
    return ans;
}
long long quickpow_ten(long long a,int n)
{
    long long ans=1;
    for(int i=n-1;i>=0;i--)
    {
        ans=ans*quickpow(a,b[i]-'0')%mod;
        a=quickpow(a,10);
    }
    return ans;
}
int main()
{
    long long n;
    scanf("%s",&b);
    int len=strlen(b);
    if(len==1&&b[0]=='0')
        puts("1");
    else
    {
        long long k=quickpow_ten(2,len)%mod;
        long long res=k*(k+1)/2%mod;
        printf("%I64d\n",res);
    }

    return 0;
}

/*2018-07-17 20:59:25.825*/


//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define gi(x) scanf("%lf",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll>
#define mk make_pair
#define RE register
#define P 1000000007
#define mod 998244353
#define S second
#define F first
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define ui unsigned
#define zz p<<1
#define yy p<<1|1
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    register ll x=0,f=1;register char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=200010;
ll n,k;
ll fac[MAXN],inv[MAXN];
inline ll C(ll a,ll b){if(a<b)return 0;return fac[a]*inv[b]%mod*inv[a-b]%mod;}
inline ll ksm(ll b,ll p)
{
	ll cnt=1;
	while(p)
	{
		if(p&1)cnt=cnt*b%mod;
		b=b*b%mod;p=p>>1;
	}
	return cnt;
}
signed main()
{
	//freopen("1.in","r",stdin);
	get(n);get(k);
	if(k>=n){puts("0");return 0;}
	fac[0]=1;
	rep(1,n,i)fac[i]=fac[i-1]*i%mod;
	inv[n]=ksm(fac[n],mod-2);
	fep(n-1,0,i)inv[i]=inv[i+1]*(i+1)%mod;
	if(!k)putl(fac[n]);
	else
	{
		ll ans=0;
		rep(0,n-k,i)
		{
			ans=(ans+C(n,n-k)*((i&1)?-1:1)*C(n-k,i)%mod*ksm(n-k-i,n))%mod;
		}
		putl((ans+mod)%mod*2%mod);
	}
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<stdio.h>
#include<string>
#include<set>
#include<iomanip>
#include<numeric>
#include<map>
#include<limits>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<deque>
#include<queue>

using namespace std;

bool is_palindorme(string s, int r, int l)
{
	for (int i = r; i <= l; i++)
	{
		if (s[i] != s[l - i + r])
		{
			return 0;
		}
	}
	return 1;
}

int count(int a, int b)
{
	int count = 1;
	while (a / b > 0)
	{
		a /= b;
		count++;
	}
	return count;
}

void find_node(vector<int>& a, vector<int>& b, int s, int e, int curr)
{
	int pos = s;
	if (s == e)
	{
		b[s] = curr + 1;
		return;
	}
	if (e < s)
	{
		return;
	}
	for (int i = s; i <= e; i++)
	{
		if (a[pos] < a[i])
		{
			pos = i;
		}
	}
	b[pos] = curr + 1;
	curr++;
	find_node(a, b, s, pos - 1, curr);
	find_node(a, b, pos + 1, e, curr);
}

void checknbh(vector<string>& a, vector<vector<int>>& b, int i, int j, int n)
{
	int flag = 0;
	if (i > 0 && a[i - 1][j] == 'L' && b[i - 1][j] != 1)
	{
		b[i - 1][j] = 1;
		flag = 1;
		checknbh(a, b, i - 1, j, n);

	}
	if (i < n - 1 && a[i + 1][j] == 'L' && b[i + 1][j] != 1)
	{
		b[i + 1][j] = 1;
		flag = 1;
		checknbh(a, b, i + 1, j, n);

	}
	if (j > 0 && a[i][j - 1] == 'L' && b[i][j - 1] != 1)
	{
		b[i][j - 1] = 1;
		flag = 1;
		checknbh(a, b, i, j - 1, n);

	}
	if (j < n - 1 && a[i][j + 1] == 'L' && b[i][j + 1] != 1)
	{
		b[i][j + 1] = 1;
		flag = 1;
		checknbh(a, b, i, j + 1, n);
	}
}

bool compareInterval(long long i1, long long  i2)
{
	return (i1 < i2);
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i <= sqrt(n); i++)
		if (n % i == 0)
			return false;

	return true;
}

void toh(int n, char A, char B, char C) {
	if (n == 1) {
		cout << "Move 1 from " << A << " to " << C << endl;
		return;
	}
	toh(n - 1, A, C, B);
	cout << "Move " << n << " from " << A << " to " << C << endl;
	toh(n - 1, B, A, C);
}

void generate(vector<string>& a, string s, int t) {
	if (s.length() == t) {
		a.push_back(s);
		return;
	}
	if (s.length() == 0 || s.back() == 'R') {
		generate(a, s + "S", t);
		generate(a, s + "R", t);
	}
	else {
		generate(a, s + "R", t);
	}
}

int addOne(deque<int>& a, int t, int i) {
	int temp = 0;
	if (i == t - 1)
	{
		a[i] += 1;
		temp = a[i] / 10;
		a[i] %= 10;
	}
	else {
		a[i] += addOne(a, t, i + 1);
		if (i == 0 && a[0] >= 10)
		{
			a.push_front(a[0] / 10);
			a[1] %= 10;
		}
		else {
			temp = a[i] / 10;
			a[i] %= 10;
		}
	}
	return temp;
}

void reversec(set<string>& a, string s) {
	string t(s);
	reverse(t.begin(), t.end());
	a.insert(s + t);
	a.insert(t + s);
}

int num_digits(int a) {
	int digits = 0;
	while (a > 0) {
		a /= 10;
		digits++;
	}
	return digits;
}

void search(long long x, long long n,long long count, long long &ans) {
	int digits = 0;
	long long a = x;
	while (a > 0) {
		a /= 10;
		digits++;
	}
	if (digits == n) {
		return;
	}
	long long y = x;
	while (y > 0) {
		int temp = y % 10;
		if (temp > 1) {
			search(x * temp, n, count + 1, ans);
		}
		y /= 10;
	}
}

map<long long, long long>m;
long long ans = 1e9;
long long n;
void reqlen( long long count,long long x) {
	if (x >= n) {
		ans = min(ans, count);
		return;
	}
	long long y = x;
	while (y > 0) {
		long long c = y % 10;
		if (c > 1) {
			if (m.count(c * x) == 0 || count+1<m[c*x])
			{
				m[c * x] = count+1;
				reqlen(count+1, c * x);
			}
		}
		y /= 10;
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long t, q, x, l, y, r, g, k,  p, c;
//	long long n,m;
	string s;
	cin >> n >> x;
	n = pow(10, n - 1);
	reqlen(0, x);
	cout << (ans==1e9?-1:ans) << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector <int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	int cnt1 = 0, cnt2=0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 1 && b[i] == 0) cnt1++;
		if (a[i] == 0 && b[i] == 1) cnt2++;
	}
	if (cnt1 != 0) cout << (cnt2 + cnt1) / cnt1;
	else cout << -1;
}


#include<bits/stdc++.h>
#define lld long long int
#define ulld unsigned long long
#define vll vector<lld>
#define pll pair<lld,lld>
#define mll map<lld,lld>
#define sll set<lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define MOD 1000000007 //998244353
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define out(x) cout<<x<<endl;
#define MAXN 500005
#define lld_max 5000000000000000000
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int sum(int a, int b) {
    int s = a + b;
    if (s >= MOD) s -= MOD;
    return s;
}
int mult(int a, int b) {
    return (1LL * a * b) % MOD;
}
int pw(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return mult(a, pw(a, b - 1));
    int res = pw(a, b / 2);
    return mult(res, res);
}
int main() {messi lld t=1;cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=0,mid=0,lo=0,hi=0,lm=0,cur=0,curr=0;string s;bool flag=false;
        cin>>n>>k;
        if (n % 2 == 1) {
            ans = 1;
            for (i = 1; i <= n - 1; i++) ans = mult(ans, 2);
            ans = sum(ans, 1);
            int f = 1;
            for (z = 0; z < k; z++) f = mult(f, ans);
            cout<<f<<endl;
        }
        else {
            ans = 1;
            for (i = 1; i <= n - 1; i++) ans = mult(ans, 2);
            int X = pw(2, n);
            int nans = (ans + MOD - 1) % MOD;
            int tot = pw(nans, k);
            for (int bit = 0; bit < k; bit++) {
                tot = sum(tot, mult(pw(X, bit), pw(nans, k - 1 - bit)));
            }
            cout<<tot<<endl;
        }
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>
#define fr(i,a,b) for (ll i=(a); i<(b);i++)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);i--)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<int,int>
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define sz(a) (int)a.size()
#define endl "\n"

#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define print2(a) for(auto x:a){for(auto y:x)cout<<y<<" ";cout<<endl;};

const ll M=998244353;
const int P=31;
const int MaxM=1001;

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

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

if(n==1)cout<<1<<endl;
else
{ ll k=sqrt(n);
  ll fin;
  fr(i,k,M)
  {
    ll t=i*i+i;
    t/=2;
    if(t>n){fin=i-1;break;}
  }
  ll fi=fin;
  fin*=fin+1;
  fin/=2;
  n-=fin;
  if(n==0)n=fi;
  cout<<n<<endl;
}

}


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

int main()
{
	int n = 1;
	int si;
	cin >> si;
	string str;
	cin >> str;

	for (int i = 0; i < si; i += n) {
		cout << str[i];
		n++;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define N 255
#define Mod 998244353
#define For(i,x,y)for(i=x;i<=(y);i++)
int f[N][N][N],pre[N][N][N],g[N][N],inv[N];
int ksm(int x,int y)
{
	return(!y?1:1LL*ksm(1LL*x*x%Mod,y>>1)*(y&1?x:1)%Mod);
}
int main()
{
	int n,k,i,j,p,num,tmp,res=0;
	cin>>n>>k;
	For(j,1,k)f[1][j][1]=1;
	For(i,1,n-1)inv[i]=ksm(i,Mod-2);
	For(i,1,k)
	{
		g[i][0]=1;
		For(j,1,n)g[i][j]=1LL*g[i][j-1]*i%Mod;
	}
	For(i,2,n-1)
	{
		For(j,1,k)
		For(num,1,i-1)pre[i-1][j][num]=(pre[i-1][j-1][num]+f[i-1][j][num])%Mod;
		For(j,1,k)
		For(num,1,i-1)
		{
			p=j;
			tmp=(p==j?num+1:1);
			f[i][j][tmp]=(f[i][j][tmp]+1LL*f[i-1][p][num]*inv[tmp]%Mod*g[k-j+1][i-1])%Mod;
			tmp=1;
			f[i][j][tmp]=(f[i][j][tmp]+1LL*pre[i-1][j-1][num]*inv[tmp]%Mod*g[k-j+1][i-1])%Mod;
		}
	}
	For(j,1,k)
	For(num,1,n-1)res=(res+f[n-1][j][num])%Mod;
	For(i,1,n-1)res=1LL*res*i%Mod;
	cout<<res;
	return 0;
}


/*input
2 2
1 2 3 4
1 5 6 4

2 3
1 2 4 5
1 2 1 3 2 3

*/

//fold
/*
When you walk through a storm
Hold your head up high
And don't be afraid of the dark
At the end of the storm
There's a golden sky
And the sweet silver song
of the lark
Walk on, through the wind
Walk on, through the rain
Though your dreams be tossed
and blown
Walk on, walk on
With hope in your heart
And you'll never walk alone
YNWA
*/

//hell_hacker
//IT TAKES EVERYTHING and IT IS NOT LUCK
//PICK ME LAST -- COME OUT OF N^WHERE
//WHY NOT?

/*
And you came my way on a winner's day
Shouted loudly come out and play
Can't you tell I got news for you
Sun is shining and so are you
*/
//endfold

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

using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)

#define ffs(a) __builtin_ffs(a) // find first set
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits
#define popcll(a) __builtin_popcountll(a) //count set bits for long long int

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define yolo "debug_statement"

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const ll inf = 1e9;
const ld eps = 1e-9;
const ld pi=acos(-1);
const ll mod=1000000007;

ll powmod(ll a,ll b,ll mo=mod){ll res=1;a%=mo; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}

inline ll inv_(ll a) {return powmod(a, mod-2, mod);}
inline ll add(ll a, ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a, ll b){return a*1ll*b%mod;}
inline ll sub(ll a, ll b){a-=b;if(a<0)a+=mod;return a;}

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

/*USAGE
ordered_set X;
X.insert(1);
X.insert(3);
cout << *X.find_by_order(1) << endl; //3
cout << X.order_of_key(-5) << endl; //0
cout << X.order_of_key(1) << endl; //0
cout << (end(X) == X.order_of_key(100)) << endl; //true since utne elements nahi hai
*/

//fold
#if DEBUG && !ONLINE_JUDGE

    #define debug(args...)     (Debugger()) , args

    class Debugger
    {
        public:
        Debugger(const std::string& _separator = ", ") :
        first(true), separator(_separator){}

        template<typename ObjectType>
        Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << endl;}

        private:
        bool first;
        std::string separator;
    };

    template <typename T1, typename T2>
    inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
    {
        return os << "(" << p.first << ", " << p.second << ")";
    }

    template <typename T1, unsigned long int N>
    inline std::ostream& operator << (std::ostream& os, const std::array<T1, N>& a){
        bool first = true;
        os << "[";
        for(unsigned int i = 0; i < N; i++)
        {
            if(!first)
                os << ", ";
            os << a[i];
            first = false;
        }
        return os << "]";
    }

    template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
    {
        bool first = true;
        os << "[";
        for(unsigned int i = 0; i < v.size(); i++)
        {
            if(!first)
                os << ", ";
            os << v[i];
            first = false;
        }
        return os << "]";
    }

    template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::set<T>::const_iterator iii = v.begin(); iii != v.end(); ++iii)
        {
            if(!first)
                os << ", ";
            os << *iii;
            first = false;
        }
        return os << "]";
    }

    template<typename T1, typename T2>
    inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::map<T1, T2>::const_iterator iii = v.begin(); iii != v.end(); ++iii)
        {
            if(!first)
                os << ", ";
            os << *iii ;
            first = false;
        }
        return os << "]";
    }

#else
    #define debug(args...)                  // Just strip off all debug tokens
#endif
//endfold

int main(){
    #if ONLINE_JUDGE
        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#endif

    int n, m;
    int i, j;

    cin >> n >> m;

    int s1[n][2];
    int s2[m][2];

    fo(i, n){
    	cin >> s1[i][0] >> s1[i][1];
    }

    fo(i, m){
    	cin >> s2[i][0] >> s2[i][1];
    }

    set<int>finalset;

    for(i = 0; i < n; ++i){
    	set<int>s;
    	for(j = 0; j < m; ++j){
    		if(s1[i][0] == s2[j][0]){
    			if(s1[i][1] == s2[j][1]){
    				continue;
    			}
    			else{
    				s.insert(s1[i][0]);
    			}
    		}
    		else if(s1[i][0] == s2[j][1]){
    			if(s1[i][1] == s2[j][0]){
    				continue;
    			}
    			else{
    				s.insert(s1[i][0]);
    			}
    		}
    		else{
    			if(s1[i][1] == s2[j][0]){
    				s.insert(s1[i][1]);
    			}
    			else if(s1[i][1] == s2[j][1]){
    				s.insert(s1[i][1]);
    			}
    		}

    		// for(auto it: s)cout << it << " ";
    		// cout << endl;

    		if(sz(s) > 1){
    			cout << -1 << endl;
    			return 0;
    		}

    		// if(sz(s) == 1){
  				for(auto it: s)finalset.insert(it);
    		// }
    	}
    }

    for(i = 0; i < m; ++i){
        set<int>s;
        for(j = 0; j < n; ++j){
            if(s2[i][0] == s1[j][0]){
                if(s2[i][1] == s1[j][1]){
                    continue;
                }
                else{
                    s.insert(s2[i][0]);
                }
            }
            else if(s2[i][0] == s1[j][1]){
                if(s2[i][1] == s1[j][0]){
                    continue;
                }
                else{
                    s.insert(s2[i][0]);
                }
            }
            else{
                if(s2[i][1] == s1[j][0]){
                    s.insert(s2[i][1]);
                }
                else if(s2[i][1] == s1[j][1]){
                    s.insert(s2[i][1]);
                }
            }

            // for(auto it: s)cout << it << " ";
            // cout << endl;

            if(sz(s) > 1){
                cout << -1 << endl;
                return 0;
            }

            // if(sz(s) == 1){
                for(auto it: s)finalset.insert(it);
            // }
        }
    }

    if(sz(finalset) == 1){
    	for(auto it: finalset)cout << it << endl;
    	return 0;
    }

    // if(sz(finalset) == 0){
    // 	cout
    // }

    // if(sz(finalset) > 1){
    // 	cout << 0 << endl;
    // 	return 0;
    // }

    cout << 0 << endl;

    //#if !ONLINE_JUDGE
    //    cout << fixed << setprecision(12) << "-------------------------------------------------\n";
    //    cout << double(clock())/CLOCKS_PER_SEC << " seconds" << endl;
    //#endif
    return 0;
}


#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;

int i, j, k, m, n;

int good(string s) {
    if (s.size() < 1 || s.size() > 16) return 0;
    for (int i = 0; i < s.size(); i++) {
        if (isalnum(s[i]) || s[i] == '_');
        else return 0;
    }
    return 1;
}

int jabber(string s) {
    i = s.find('@');
    if (i == -1) return 0;
    if (!good(s.substr(0, i))) return 0;
    s = s.substr(i+1);

    i = s.find('/');
    if (i != -1) {
        if (!good(s.substr(i+1))) return 0;
        s = s.substr(0, i);
    }

    while (1) {
        i = s.find('.');
        if (i == -1) {
            return good(s);
        } else {
            if (!good(s.substr(0, i))) return 0;
            s = s.substr(i+1);
        }
    }
}

string s;

int main() {
    cin >> s;

    if (jabber(s)) cout << "YES";
    else cout << "NO";
    return 0;
}


#include <stdio.h>
int main()
{
	int l,k,i;
	long long ans=1;
	scanf("%d %d",&k,&l);
	for(i=1;;i++)
	{
		ans*=k;
		if(ans==l)
		{
			printf("YES\n%d",i-1);
			return 0;
		}
		if(ans>l)
			break;
	}
	printf("NO\n");
}


#include<bits/stdc++.h>
using namespace std;
#define tk printf("Case %d:\n",q++)
#define READ freopen("input.txt","r",stdin);
#define WRITE freopen("output.txt","w",stdout);
#define sf(x) scanf("%lld",&x)
#define sff(x,y) scanf("%lld %lld",&x,&y)
#define sfff(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define fori(x,y) for(ll i=x;i<y;i++)
#define forj(x,y) for(ll j=x;j<y;j++)
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define pi acos(-1.0)
#define inf  LLONG_MAX
#define testcase ll t;sf(t);
#define all(x) x.begin(),x.end()
typedef long long ll;
typedef unsigned long long llu;
typedef pair<ll,ll> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
int xx[4]={0,0,1,-1};
int yy[4]={-1,1,0,0};
int main()
{
    #ifndef ONLINE_JUDGE
    READ
    WRITE
    #endif
   	unsigned long long n;
   	cin>>n;
   	ll res=0;
   	vector<ll>div;
   	for(llu i=2;i*i<=n;i++){
   		if(n%i==0){
				while(n%i==0){
					n/=i;
				}
				div.pb(i);
		}
   	}
   	if(n>1)div.pb(n);
   	if(div.size()==1)cout<<div[0]<<endl;
   	else cout<<1<<endl;

   	return 0;
}


#include <set>
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <fstream>
#include <cstring>
#include <iostream>
#include <sstream>
#include <algorithm>
//#include <unordered_set>

/*#include <Windows.h>
#include <Psapi.h>*/

//#include "../../../../../Desktop/Treap.h"

using namespace std;

typedef long long ll;

const double eps = 1E-9;

int main(int argc, char **argv) {

    ios::sync_with_stdio(false);

    //freopen("in.txt", "r", stdin);

    int n;
    cin >> n;
    vector<vector<int>> v(n, vector<int>(n));

    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            cin >> v[i][j];
            if(i == j || j == n - i - 1 || i == n >> 1 || j == n >> 1)
                ans += v[i][j];
        }
    }

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


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

/*** Template Begins ***/

typedef long long    ll;
typedef pair<ll,ll>  PII;
typedef pair<ll, pair<int, int> > PIII;
typedef vector<int>  vi;

#define endl         '\n'
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p;y = y>>1;x = (x*x) % p;} return res; }

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

// Constants //

const int N = 15;
const int xinc[] = {0, 0, 1, -1};
const int yinc[] = {1, -1, 0, 0};
const long double PI = 3.141592653589793;

/*** Template Ends ***/
string s[N];
int c[N], b[N], n;
int a[N], ans[N];

bool satisfy(){

    set<int> s;
    for(int i = 0; i < 4; i++)  s.insert(a[i]);
    return (s.size() == 4);
}

void solve(){

    cin >> n;
    for(int i = 0; i < n; i++)  cin >> s[i] >> b[i] >> c[i];

    int cnt = 0;

    for(a[0] = 0; a[0] <= 9; a[0]++)
        for(a[1] = 0; a[1] <= 9; a[1]++)
            for(a[2] = 0; a[2] <= 9; a[2]++)
                for(a[3] = 0; a[3] <= 9; a[3]++)
                    if (satisfy())
                    {
                        bool valid = true;

                        for(int i = 0; i < n; i++)
                        {
                            int bb = 0, cc = 0;
                            set<int> temp;

                            for(int j = 0; j < 4; j++){
                                if (a[j] == s[i][j]-'0')   bb++;
                                temp.insert(a[j]);
                            }

                            for(int j = 0; j < 4; j++){
                                if (temp.find(s[i][j]-'0') != temp.end())    cc++;
                            }

                            cc -= bb;
                            if (cc != c[i] || bb != b[i]){  valid = false;  break;  }
                        }

                        if (valid){
                            //for(int i = 0; i < 4; i++)  cout << a[i];   cout << endl;
                            cnt++;
                            if (cnt == 1)   for(int i = 0; i < 4; i++)  ans[i] = a[i];
                        }
                    }

    if (cnt == 0)   cout << "Incorrect data" << endl;
    else if (cnt == 1){  for(int i = 0; i < 4; i++)  cout << ans[i]; cout << endl;   }
    else cout << "Need more data" << endl;

}

int main(){

    ios;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int t;
    //cin >> t;
    t = 1;
    while(t--)
        solve();

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int i,l,ans,ll;
string s;
int main(){
    cin>>s;
    l=s.length();
    i=0;
    while(i<l-1)
    {
        ll=1;
        if(s[i]==s[i+1])
        {
            while(s[i]==s[i+1]&&i<l-1) i++,ll++;
            if(ll%2==0) ans++;
        }
        else i++;
    }
    cout << ans;
    return 0;
}


# include <iostream>
using namespace std;
int main()
{
	 double n,k;
	long long g;
	cin>>n>>k;
	g = ceil(2*n/k)+ceil(5*n/k)+ceil(8*n/k);
	cout<<g<<endl;
}


#include<bits/stdc++.h>
// iteration and input/output stream
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define printarr(x) rep(i,0,x.size()) cout<<x[i]<<" "; cout<<endl;

#define tr(cont,it) \
for(decltype(cont.begin()) it = cont.begin(); it!= cont.end() ; it++)

#define tc() int tcase; cin >> tcase ; rep(tc,1,tcase+1)
//STL shortcuts
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define MP make_pair

// Error detection
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

using namespace std;

typedef long long int ll; // 64 bit integer
typedef unsigned long long int  ull; // 64 bit unsigned integer
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;

inline void smax(int &x , int y) { x = max(x , y) ; }
inline void smin(int &x , int y) { x = min(x , y) ; }

#define MOD 1000000007
#define inf 4000000000000000000LL
#define SYNC std::ios::sync_with_stdio(false);  cin.tie(NULL);

ll gcd(ll a,ll b){ return ((b==0)? a:gcd(b,a%b) ); }
#define PI acos(-1)
#define N 1000000

bitset<10000010> bs;
vi smp;
void sieve(int upr)
{
    bs.set();
    int siz  = upr+1;
    smp.resize(siz);
    rep(i,0,siz)
        smp[i] = i;

    for(ll i=2;i<siz;i++)
    {
        if(smp[i]== i)
        {
            for(ll j=i*i;j<=siz;j+=i)
            {
                if(smp[j]==j) smp[j] = i;
            }
        }
    }
}

ll apow(ll x,ll n)
{
    if(n==1)
        return x;
    ll res = apow(x,n/2);
    res = (res*res)%MOD;
    if(n%2==1)
        res = (res*x)%MOD;
    return res;
}

int main()
{
    SYNC
    int n,k;
    cin>>n>>k;

    /*int pts = 0;
    int pol = 0;

    set<pair<int,int> > pos;

    pos.insert(MP(3,3));
    for(int i=4;i<=n;i++)
        pos.insert(make_pair(i-1,i));

    set<int> vis;
    while(pol < k)
    {
        pair<int,int> x = *pos.begin();
        pos.erase(pos.begin());
        if(vis.find(x.second) != vis.end())
            continue;

        pol++;
        pts+= x.F;
        trace2(x.F,x.S);
        vis.insert(x.second);

        for(int j=2*x.second;j<=n;j+= x.second)
        {
            pos.insert(make_pair(j-x.second,j) );
        }

    }
    cout<<pts<<endl;*/

    sieve(N);
    vll inv(N+1);
    for(int i=2;i<=N;i++)
        inv[i] = apow(i,MOD-2);
    //trace1(smp.size());
    vi phi;
    for(int i=3;i<=n;i++)
    {
        set<ll> fact;
        ll tmp = i;
        while(smp[tmp] != tmp)
        {
            fact.insert(smp[tmp]);
            tmp/=smp[tmp];
        }
        if(tmp!=1 )
        {
            fact.insert(tmp);
        }

        ll val=i;
        tr(fact,it)
        {
            val = ((*it-1)*val)%MOD;
            val = (val*inv[*it])%MOD;
        }

        if(i == 4)
            val++;
        phi.pb(val);
        //trace2(i,val);
    }

    sort(phi.begin(),phi.end());
    ll sum = 0;
    rep(i,0,k)
    {
        sum+= phi[i];
    }
    if(k ==2 && n>=6)
        sum++;
    cout<<sum+1<<endl;

}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#pragma warning( disable : 4244 4267 4018 4996 4800 )
//#pragma comment( linker, "/stack:10000000" )
using namespace std;
typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<string> vs; typedef vector<double> vd;
typedef vector<vd> vvd; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef pair<int, int> pii;
#define all(v) begin(v), end(v)

#ifdef LOCAL
ifstream in("c.in");
#else
istream & in = cin;
#endif
ostream & out = cout;
template <class T> void read(T & t) { for (auto & x : t) in >> x; }

int bit_count(int i) {
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    i = (i + (i >> 4)) & 0x0f0f0f0f;
    i = i + (i >> 8);
    i = i + (i >> 16);
    return i & 0x3f;
}

int main() {
    ios_base::sync_with_stdio(false);
    int n; in >> n;
    vs p(n); read(p);
    int m = p[0].size();
    vll d(1 << m);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            int mask = 0;
            for (int k = 0; k < m; ++k) {
                if (p[i][k] == p[j][k])
                    mask |= 1 << k;
            }
            d[mask] |= 1LL << i;
            d[mask] |= 1LL << j;
        }
    }
    for (int mask = d.size() - 1; mask >= 0; --mask) {
        for (int bit = 0; bit < m; ++bit) if (mask & (1 << bit)) {
            d[mask ^ (1 << bit)] |= d[mask];
        }
    }
    vd paths(m + 1);
    for (int mask = 0; mask < d.size(); ++mask) {
        int moves = bit_count(mask) + 1;
        for (int bit = 0; bit < m; ++bit) {
            int newmask = mask | (1 << bit);
            if (newmask == mask) continue;
            ll added = d[mask] ^ d[newmask];
            paths[moves] += bit_count(added & 0xFFFFFFFF) + bit_count(added >> 32);
        }
    }
    double res = 0;
    for (int i = 1; i <= m; ++i) {
        double t = paths[i];
        for (int j = 0; j < i; ++j) {
            t *= 1. * (i - j) / (m - j);
        }
        res += t;
    }
    res /= n;
    out.setf(ios::fixed); out.precision(10); out << res;
    return 0;
}


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

int main()
{
    int supply_lines , devices ,sockets , All_sockets , sockets_needed = 0;
    cin>>supply_lines>>devices>>sockets;
    All_sockets = sockets;
    vector<int> a(supply_lines);

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

    int j =0;
    sort(a.rbegin(),a.rend());         // sorting in a descending order
    for( j = 0 ; j<supply_lines+1; j++)
    {
         if(All_sockets >= devices)
                break;

            All_sockets += a[j] -1 ;
            a[0] = 0;
            sockets--;
            sockets_needed++;

    }

    if(j==supply_lines+1)
    {
         cout << -1;
    }
    else
    {
        cout << sockets_needed;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
#define mp make_pair
#define ll long long
#define f first
#define se second

int main()
{
    ll n,i;
    cin>>n;
    ll a[10],b[10],c[10];
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    memset(c,0,sizeof(c));
    if(n>=1)
    {
        for(i=0;i<6;i++)
        {
            ll x;cin>>x;
            a[x]=1;
        }
    }
    if(n>=2)
    {
        for(i=0;i<6;i++)
        {
            ll x;cin>>x;
            b[x]=1;
        }
    }
    if(n>=3)
    {
        for(i=0;i<6;i++)
        {
            ll x;cin>>x;
            c[x]=1;
        }
    }
    for(i=1;i<=9;i++)
    {
        if(a[i]==0 && b[i]==0 && c[i]==0)
        {
            cout<<i-1;
            return 0;
        }
    }
    for(i=10;i<=99;i++)
    {
        ll x=i%10;
        ll y=i/10;
        if(a[x]==1 && b[y]==1)
        continue;
        if(a[x]==1 && c[y]==1)
        continue;
        if(b[x]==1 && c[y]==1)
        continue;
        if(b[x]==1 && a[y]==1)
        continue;
        if(c[x]==1 && b[y]==1)
        continue;
        if(c[x]==1 && a[y]==1)
        continue;

        cout<<i-1;
        return 0;
    }
}


//In the Name of God
//Ya Ali

#include <bits/stdc++.h>

#define int long long
#define pii pair<int, int>

#define err(A) cout << #A << " = " << (A) << endl

using namespace std;

int n;

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

  cin >> n;

  int d = 1;
  int sz = 1;

  while (sz * 2 + 1 <= n)
    {
      sz = sz * 2 + 1;
      d = d * 2;
    }

  int r = n - sz;

  int z = 0;
  for (int t = 2; t <= d; t *= 4)
    z += d / t;

  /*
  err(n);
  err(d);
  err(z);*/

  if ((r == z) or (r == (z + 1)))
    cout << 1 << endl;
  else
    cout << 0 << endl;

  return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
char a[11],b[11],c[11],d[11];
int main()
{
	while(~scanf("%s%s%s%s",a,b,c,d))
	{
		a[2]=b[1],a[3]=b[0],c[2]=d[1],c[3]=d[0];
		int i=0,j=0,flag=1;
		while(a[i]!='A')i++;
		while(c[j]!='A')j++;
		for(int k=0;k<4;k++,i=(i+1)%4,j=(j+1)%4)
		{
			if(a[i]=='X')i=(i+1)%4;
			if(c[j]=='X')j=(j+1)%4;
			if(a[i]!=c[j])flag=0;
		}
		printf("%s\n",flag?"YES":"NO");
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;
long long n;
int main() {
	cin>>n;
	cout<<n*(n-1)*(n-2)*(n-3)*(n-4)/120*n*(n-1)*(n-2)*(n-3)*(n-4);
	return 0;
}


#include<stdio.h>
#include<string.h>
int n,m,m_er,cnt;
int dire;    //// 记录方向，1表示向前（左），0表示向后（右）
char ss[205];

void begin()
{
    if(ss[0]=='h') dire=1;
    else dire=0;
}

void mm_er(  )
{
   // printf("dire= %d m_er%d\n",dire,m_er);
    if( dire == 1 ) ////向左走
    {
        if( m_er == 1 )
        {
            m_er++;
            dire = ( dire+1 )%2 ;
        }
        else  m_er--;
    }
    else
    {
        if( m_er == n )
        {
            m_er--;
            dire = ( dire+1 )%2 ;
        }
        else  m_er++;
    }
}

void mm_m1( int i )
{
  // printf("dire= %d m=%d\n",dire,m);
    if( ss[i] == '0' ) // //车move
    {
        if( dire == 0 ) //// Controller向右走
        {
            if( m < m_er ){
                if(m!=1)  m--;
            }
            else if( m < n ) m++;
        }
        else  //// Controller向左走
        {
            if( m > m_er ){
                if( m != n ) m++;
            }
            else if( m > 1 ) m--;
        }
    }
    else  ////车idle
    {
        if( dire == 0 )//// Controller向右走
            m=m_er-1;
        else // // Controller向左走
            m=m_er+1;
    }
}

int find( )
{
    int l=strlen(ss);
    for(int i=0;i<l;i++)
    {
        if(m==m_er&&i!=0)
        {
            cnt=i;
            return false;
        }
        if(ss[i]=='0')
        {
            if(i+1<l&&m_er==n-1&&m==n&&dire==0&&ss[i+1]=='0'){
                cnt=i+1;
                return false;
            }
            if(i+1<l&&m_er==2&&m==1&&dire==1&&ss[i+1]=='0'){
                cnt=i+1;
                return false;
            }

        }
        mm_er( );
        mm_m1( i );
        //printf("i= %d  %d %d\n",i,m,m_er);
    }
    return true;
}

int main( )
{
    char s[100];
    while(~scanf("%d",&n))
    {
        scanf("%d%d",&m,&m_er);
        scanf("%s%s",s,ss);
        begin();
        scanf("%s",ss);
        if( m == m_er ) printf("Controller 0\n");
        else
        {
            if( find() )
                printf("Stowaway\n");
            else
                printf("Controller %d\n",cnt);
        }
    }
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long LL;
const int maxn = 1000005;
const int mod = 1000000007;
int inv[maxn];
int k, w;

int pow(int a, int n) {
    int ans = 1;
    for (; n; n >>= 1, a = (LL)a * a % mod)
        if (n & 1) ans = (LL)ans * a % mod;
    return ans;
}

int calc(int k, int w) {
    int ans = LL(pow(k, w + 1) - 1) * inv[k - 1] % mod;
    int per = 1, pinv = 1, tmp = pow(k, w);
    for (int i = 1; i <= k; ++i)
        if (i <= w) {
            tmp = (LL)tmp * inv[k] % mod; per = (LL)per * (k - i + 1) % mod;
            ans = (ans + (LL)per * per % mod * tmp % mod) % mod;
        } else {
            per = (LL)per * (k - i + 1) % mod;
            pinv = (LL)pinv * inv[k - (i - w) + 1] % mod;
            ans = (ans + (LL)per * per % mod * pinv % mod) % mod;
        }
    return ans;
}

int main() {
    int i, ans;
    scanf("%d%d", &k, &w);
    if (k == 1) { puts("1"); return 0; }
    for (i = 2, inv[1] = 1; i <= k; ++i)
        inv[i] = LL(mod / i) * (mod - inv[mod % i]) % mod;
    ans = (calc(k, w) - calc(k, w - 1)) % mod;
    printf("%d\n", (ans + mod) % mod);
    return 0;
}


#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
using namespace std;
ofstream fo("test.out");
ifstream fi("test.inp");
#define For(i,n) for (long long(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (long long(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (long long(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (long long(i) = (r); (i) >= (l); (i)--)
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
const ll MOD = 1e9 + 7;
const ll base = 269;
const int oo = 1 << 30;
const int N = 1e5 + 5;
/*
MIKUNO - 15/02/1999
*/
ll n, m, q, k, pos, t, rs, r;
ll P(ll x, ll y) // x^y
{
	ll ret = 1;
	while (y > 0)
	{
		if (y & 1) ret *= x;
		y /= 2;
		x = x * x;
	}
	return ret;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
 	cin >> n >> k;
	ll l = 1, r = P(2,n) - 1, mid;
	while (l <= r)
	{
		mid = (l + r) / 2;
		if (mid == k) {
			cout << n;
			//system("pause");
			return 0;
		}
		if (mid > k) r = mid - 1;
		if (mid < k) l = mid + 1;
		n--;
	}
	//system("pause");
}


/****************### With The name of ALLAH, most Gracious, most Compassionate ###****************/

/**============================================================================**\
|   Author      : Md Jubayer Hossen Jame
|   Study       : CSE, BRUR
|   Today       : Friday, 25 September, 2020
|   Source      : Codeforces Online Judge
|   Problem link: https://codeforces.com/problemset/problem/911/B
|   Algorithm   :
|
    Help        : https://algoshots.herokuapp.com/problems/two-cakes-911B/
\**============================================================================**/

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

#define FI                    freopen("input.txt", "r", stdin)
#define FO                    freopen("output.txt", "w", stdout)
#define FasterIO              ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

typedef long long             ll;
typedef unsigned long long    ull;
typedef unsigned int          ui;

#define mem(x,y)              memset(x,y,sizeof(x));
#define pii                   pair<int,int>
#define mk                    make_pair
#define ff                    first
#define ss                    second
#define pb                    push_back
#define ppb                   pop_back
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
#define for0(i, n)            for (int i = 0; i < (int)(n); ++i)
#define for1(i, n)            for (int i = 1; i <= (int)(n); ++i)
#define debug(x)              cout << #x << " :: " << x << "\n"
#define endl                  '\n'

const double PI = acos(-1.0);

#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)              (a*(b/gcd(a,b)))

///Direction Array
// 4 Direction - DOWN, UP, RIGHT, LEFT
int dx4[]= {+1, -1, +0, +0};
int dy4[]= {+0, +0, +1, -1};
#define isValid(a, b, R, C)   (0 <= a && a < R) && (0 <= b && b < C)
int dx8[]= {+0, +0, +1, -1, -1, +1, -1, +1};
int dy8[]= {-1, +1, +0, +0, +1, +1, -1, -1};

///Knight Moves
int dr[] = {-1, 1, -2, -2, -1, 1, 2, 2};
int dc[] = {-2, -2, -1, 1, 2, 2, 1, -1};
/**************************************************************************************************/

void test_case()
{
    int n, piece_a, piece_b;
    cin >> n >> piece_a >> piece_b;

    int mini1, mini2, ans = INT_MIN;
    mini1 = mini2 = INT_MAX;
    //10, 3, 100
    for(int plt = 1; plt < n; ++plt)
    {
        //No plate contains pieces of both cakes.
        //mini1 = min( piece_a / plt, piece_b / (n - plt) ); or
        //ans = max( ans, mini1 );
        mini2 = min( piece_b / plt, piece_a / (n - plt) );
        ans = max( ans, mini2 );
    }
    //5, 2, 3 //15, 7, 8
    cout << ans << endl;
}

//★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜★゜・。。・゜゜・。。・゜☆

int main()
{

#ifndef ONLINE_JUDGE
    //FI;
    //FO;
#endif // ONLINE_JUDGE
    FasterIO
    cout.precision(15); cout << fixed;

    int T = 1;
    //cin >> T;
    for(int tc = 1; tc <= T; ++tc)
    {
        //cout << "Case #" << tc << ":" << endl;
        test_case();
    }
    return 0;
}


#include <iostream>

using namespace std;
const int MAX_DIGIT = 10, MAX_LENGTH = 101, MODULO = 1000 * 1000 * 1000 + 7;
int numberOfOccurance[MAX_DIGIT], numberLength;
long long answer[MAX_DIGIT][MAX_LENGTH], chooseMem[MAX_LENGTH][MAX_LENGTH];

int choose (int r, int n) {
	if (r == 0 or r == n) {
		return 1;
	}
	if (r > n or r < 0) {
		return 0;
	}
	if (chooseMem[r][n] != -1) {
		return chooseMem[r][n];
	}
	return chooseMem[r][n] = ((choose(r - 1, n - 1) + choose(r, n - 1)) % MODULO);
}

int main() {
	// INPUT PROCESS
	cin >> numberLength;
	for (int i = 0; i < MAX_DIGIT; ++i) {
		cin >> numberOfOccurance[i];
	}

	// SETTING BASE FORM FOR THE chooseMem
	{
		for (int i = 0; i < MAX_LENGTH; ++i) {
			for (int j = 0; j < MAX_LENGTH; ++j) {
				chooseMem[i][j] = -1;
			}
		}
	}

/*
	answer[i][j] is defined as followed:
		it hold the answer of this problem if we had to create a number from digit i to MAX_DIGIT (like from 4 to 9),
		and alsi it means that the answer number should exactly have j digits, now to calculate such DP we say that,
		let's say we want to calculate the answer for k-th digit, so we say that the answer is equal to sum of all answers
		of answer[k + 1][j - numberOfAppearencesOfKthDigit] * the bionamial choosing of numberOfAppearencesOfKthDigit places
		from all j places for the k-th digit!
*/

	// DP base form
	for (int i = 0; i <= numberLength; ++i) {
		if (i >= numberOfOccurance[MAX_DIGIT - 1]) {
			answer[MAX_DIGIT - 1][i] = 1;
		}
		else {
			answer[MAX_DIGIT - 1][i] = 0;
		}
	}

	// DP Update
	for (int maxNumber = MAX_DIGIT - 2; maxNumber > 0; --maxNumber) {
		for (int length = numberOfOccurance[maxNumber]; length <= numberLength; ++length) {
			for (int maxNumberOccurance = numberOfOccurance[maxNumber]; maxNumberOccurance <= length; ++ maxNumberOccurance) {
				answer[maxNumber][length] += answer[maxNumber + 1][length - maxNumberOccurance] * choose(maxNumberOccurance, length);
				answer[maxNumber][length] %= MODULO;
				//if (answer[maxNumber][length] > 0) cerr << maxNumber << " " << length << " -> " << maxNumberOccurance << " : " << answer[maxNumber][length] << endl;
			}
		}
	}

	// only note that since the number can't start with leading 0 (zeroes), we cannot choose the first place of the j -> j - 1
	for (int length = numberOfOccurance[0]; length <= numberLength; ++length) {
		for (int maxNumberOccurance = numberOfOccurance[0]; maxNumberOccurance <= length; ++ maxNumberOccurance) {
			answer[0][length] += (answer[1][length - maxNumberOccurance] * choose(maxNumberOccurance, length - 1));
			answer[0][length] %= MODULO;
			//if (answer[0][length] > 0) cerr << 0 << " " << length << " -> " << maxNumberOccurance << " : " << answer[0][length] << endl;
		}
	}

	// ans can be any length so we just sum up any lengths that has all digits in them (their "i" in "dp[i][j]" is equal to 0)
	long long ans = 0;
	for (int i = 1; i <= numberLength; ++i) {
		ans += answer[0][i];
		ans %= MODULO;
		//cerr << i << " : " << answer[0][i] << "	";
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
	long long a,b,c,d;
	c = 0 ;
	cin>> a ;
	cin>>b ;
	for(d=0 ; d>-10; d++){
		if(a>c){
			c = c + 1 ;
			a = a - c ;
		}
		else{
			cout<<"Vladik" ;
			return 0 ;
		}
		if(b>c)	{
			c = c + 1 ;
			b = b - c ;
		}
		else{
			cout<<"Valera" ;
			return 0 ;
		}
	}
}


#include <cstdio>
#include <cstring>

using namespace std;

const int maxN = 1e5 + 10, mod = 1e9 + 7, maxHav = 13, maxST = (1 << 5) + 1;
//maxHav开始写成了7 注意执行评测前注意数据范围！！！ 检查一下数组空间
int dotN, jumpK, disM, colC;
void add(int &fir, long long sec) {
	fir = (long long) (fir + sec) % mod;
}
struct Matrix{
	int num[210][210], row, col;
	void init(int sze) {
		row = col = sze;
		memset(num, 0, sizeof(num));
		for (int rowI = 0; rowI < row; ++rowI) {
			num[rowI][rowI] = 1;
		}
	}
	void init2(int r, int c) {
		row = r, col = c;
		memset(num, 0, sizeof(num));
	}
	Matrix operator = (const Matrix d) {
		row = d.row;
		col = d.col;
		for (int rowI = 0; rowI < row; ++rowI) {
			for (int colJ = 0; colJ < col; ++colJ) {
				num[rowI][colJ] = d.num[rowI][colJ];
			}
		}
		return (*this);
	}
	Matrix operator * (const Matrix d) const {	//注意，假如在main函数里进行矩阵乘法的话，ret数组的空间算在main函数里，那么就有可能爆main函数的空间
		Matrix ret;
		memset(ret.num, 0, sizeof(ret.num));
		ret.row = row;
		ret.col = d.col;
		for (int rowI = 0; rowI < ret.row; ++rowI) {
			for (int colJ = 0; colJ < ret.col; ++colJ) {
				for (int mid = 0; mid < col; ++mid) {
					add(ret.num[rowI][colJ], 1ll * num[rowI][mid] * d.num[mid][colJ]);
				}
			}
		}
		return ret;
	}
	Matrix power(int up) const {
		Matrix ret, base = (*this);
		ret.init(row);
		while (up) {
			if (up & 1) ret = ret * base;
			base = base * base;
			up >>= 1;
		}
		return ret;
	}
} ans, base, orig;

int pos(int er, int san) {
	return er * colC + san;	//这里应该是er（开始从下标从1开始时），不应该是 er + 1（因为一个在第i行第j列的点，编号应该是(i-1)*col+j而不是i*col+j）纸袋分析法
}
int bitCount(int st) {
	int ret = 0;
	for (int weiI = 0; weiI < 4; ++weiI) {
		if (st & (1 << weiI)) {
			++ret;
		}
	}
	return ret;
}
void init() {
	scanf("%d%d%d", &dotN, &jumpK, &disM);
	colC = 1 << disM;
	ans.init(colC * (jumpK + 1));
	orig.init2(1, colC * (jumpK + 1));
	orig.num[0][0] = 1;	//注意赋初始值！
	base.init2(colC * (jumpK + 1), colC * (jumpK + 1));
	for (int jumpJ = 0; jumpJ <= jumpK; ++jumpJ) {
		for (int stK = 0; stK < (1 << disM); ++stK) {
			if (! (stK & (1 << disM - 1))) {
			//注意运算的优先级！ !和&的优先级一样高，所以要把后面的那串括起来
				add(base.num[pos(jumpJ, stK << 1)][pos(jumpJ, stK)], 1);
				add(base.num[pos(jumpJ, stK << 1 | 1)][pos(jumpJ, stK)], 1);
			} else {
				if (jumpJ >= 1) {
					add(base.num[pos(jumpJ - 1, (stK - (1 << disM - 1)) << 1)][pos(jumpJ, stK)],
						1ll * (1 + bitCount((stK - (1 << disM - 1)) << 1)));
					//注意在这里计算的时候要开 long long!!!
					add(base.num[pos(jumpJ - 1, (stK - (1 << disM - 1)) << 1 | 1)][pos(jumpJ, stK)],
						1ll * (1 + bitCount((stK - (1 << disM - 1)) << 1 | 1)));
				}
			}
		}
	}
}

int main() {
	init();
	int cnt = 0;
	ans = orig * base.power(dotN);
	for (int stK = 0; stK < (1 << disM); ++stK)
		add(cnt, ans.num[0][pos(jumpK, stK)]);
	printf("%d\n", cnt);
	return 0;
}


#include <iostream>

using namespace std;

int r, h;

int main () {

    cin >> r >> h;

    int a = 2 * (h / r);
    h %= r;
    a += 1 + (h * 2 >= r) + (4ll * h * h >= 3ll * r * r);

    cout << a;

    return 0;
}


#include<bits/stdc++.h>
#define FOR(i,a,b) for(int  i = a; i <= b; ++i)
using namespace std;
typedef long long ll;
unsigned long long int n,sum,cnt;
bool used[111111];
main ()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.size()-1; i++)
    {
        if(s[i] == '/' && s[i+1] == '/')
        {
            s.erase(i,1);
            i--;
        }
    }
    if(s[s.size()-1] == '/' && s.size() != 1)
    {
        s.erase(s.size()-1,1);
    }
    cout << s;
}


#include <iostream>
using namespace std;
int main()
{
    long long n;
	cin>>n;
    cout<<n/2520<<endl;
    return 0;
}


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

using namespace std;
#define int long long

const int maxn = 4e5 + 20, inf = 1e17, Mod = (1ll << 32);
int n, p, q, ent[maxn], ans;

int choose(int x, int y){
	if(x > y) return 0;
	if(x == y || x == 0)return 1;
	vector <int> tmp;
	for(int i = 0; i < x; i++)tmp.push_back(y - i);
	for(int i = 2; i <= x; i++){
		//cout << x << " : " << y << endl;
		int tmpp = i, tmppp = 0;
		while(tmpp != 1){
			int tmpppp = __gcd(tmpp, tmp[tmppp]);
			tmp[tmppp] /= tmpppp;
			tmpp /= tmpppp;
			tmppp++;
		}
	}
	int res = 1;
	for(int i = 0; i < x; i++){
		res = (res * tmp[i]) % Mod;
	}
	return res;
}

int32_t main(){
    cin >> n >> p >> q;
    p = min(p, n - 1);
    for(int i = 0; i <= p; i++){
    	//cout << i << endl;
		ent[i] = choose(i, n);
	}

	for(int i = 1; i <= q; i++){
		int tmp1 = 0, tmp2 = 1;
		for(int j = 0; j <= p; j++){
			tmp1 = (tmp1 + ent[j] * tmp2) % Mod;
			tmp2 = (tmp2 * i) % Mod;
		}
		ans = (ans ^ (i * tmp1)) % Mod;
	}
    cout << (ans + Mod) % Mod;
}


#include<iostream>
#include<cstdio>
using namespace std;
int pre[8][2]={{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};//方向数组
char x;
int a,b,tx,ty,ans=0;
int main(){
    cin>>x>>b;//输入
    a=x-'a'+1;//把字母转成数字
    for(register int i=0;i<8;i++){
        tx=a+pre[i][0];//新的x轴坐标
        ty=b+pre[i][1];//新的y轴坐标
        if(tx<1||tx>8||ty<1||ty>8){//越界
            continue;//执行下一次循环
        }
        ans++;//没有continue，ans+1
    }
    printf("%d",ans);//输出答案
    return 0;//结束
}


#include <iostream>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <bitset>
#include<ctype.h>
#include<stdio.h>
using namespace std;

bool vowel(char c)
{
    if(islower(c))
        c=toupper(c);
    char A[]={'A', 'E', 'I', 'O', 'U', 'Y'};
    for(int i =0;i<6;i++)
        if(c==A[i])
        return 1;
    return 0;
}
int main() {
ios_base::sync_with_stdio(0);
  string s;
  getline(cin,s);
  char c;
  for(int  i=s.length()-1;i>=0;i--)
    if(isalpha(s[i]))
  {
      c=s[i];
      break;
  }
  if(!vowel(c))
    cout<<"NO";
  else
    cout<<"YES";

    return 0;
}


#pragma comment(linker, "/STACK:512000000")
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <memory.h>
#include <limits.h>
#include <assert.h>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <functional>
#include <bitset>
#include <stack>
#include <float.h>
#include <time.h>
#include <queue>
#include <deque>

#define PI 3.14159265358979323846
#define ull unsigned long long int
#define ll long long int
#define EPS 1e-9
#define pb push_back
#define EOS(c) (c != EOF && c != '\0' && c != '\n' && c != ' ')
#define oo 1000000005
#define ALL(v) v.begin(), v.end()
#define mp make_pair
#define sqr(a) (a) * (a)

using namespace std;

#define FILES "sort"
//#define OUT "put.txt"

template<class telem>telem MAX(telem a, telem b)
{
    return (a > b) ? a : b;
}

template<class telem>telem MIN(telem a, telem b)
{
    return (a < b) ? a : b;
}

template<class telem>telem GCD(telem a, telem b)
{
    return b ? GCD(b, a % b) : a;
}

template<class telem>telem LCM(telem a, telem b)
{
    return a / GCD(a, b) * b;
}

template<class telem>telem UNSIGNED(telem a)
{
    return (a > 0) ? a : a * (-1);
}

template<class telem>void bez_swop(telem &a, telem &b)
{
    telem c = a;
    a = b;
    b = c;
}

void swop(int &a, int &b)
{
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
}

string n;
int k;

int main()
{

#ifndef ONLINE_JUDGE
#ifdef OUT
    freopen("in"OUT, "r", stdin);
    freopen("out"OUT, "w", stdout);
#endif

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

    ios_base::sync_with_stdio(false);
    srand(time(NULL));
    time_t start = clock();

    cin >> n >> k;
    int st = 0;

    while(0==0)
    {
        int mx = -1;
        int pos = 0;

        for(int i = st; i < n.size() && i <= st + k; i++)
        {
            if(n[i] > mx)
            {
                mx = n[i];
                pos = i;
            }
        }

        while(pos > st)
        {
            k--;
            swap(n[pos], n[pos - 1]);
            pos--;
        }

        if(!k)
            break;

        st++;

        if(st == n.size())
            break;
    }

    cout << n;

#ifndef ONLINE_JUDGE
        fprintf(stderr, "\n%0.3lf\n", (clock() - start) * 1.0 / CLOCKS_PER_SEC);
#endif

    return 0;
}


#include<iostream>
#include<map>
#include<string>
#include<string.h>
#include<vector>
#include<stdio.h>
#include <cstdio>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <functional>
#include <time.h>       /* time */
#define LL long long int
#define R(i) freopen(i,"r",stdin)
#define W(i) freopen(i,"w",stdout)
#define R_W R("i.txt"),W("o.txt");
#define FOR(i,f,t) for(int i=f;i<t;i++)
#define r(e) for(int i=0;i<e;i++)
#define oo (LL)numeric_limits<int>::max()
#define readVector(n,in,v) r(n){cin>>in;v.push_back(in);}
#define DFS_WHITE -1
#define DFS_BLACK 1
#define DFS_GRAY 2
#define ii pair< int,int >
#define iii pair< int , ii >
#define vi vector<int>
#define ll long long int
using namespace std;
vector< ii > data;
const ll MOD = (ll)1e9 + 7;
long long int dp[5010][5010];
int main() {
	///R_W;
	int n,a,b,k;
	cin >> n>>a>>b>>k;
	if (a > b){
		a = n - a + 1;
		b = n - b + 1;
	}
	for (int i = 0; i <= n; i++) dp[0][i]=0;
	dp[1][0] = 0;
	for (int i = 1; i <= n; i++){
		int Total = abs(b - i)-1;
		Total += min(min(i - 1, n - i - 1), Total);
		Total = max(Total, 0);
		dp[1][i] = (Total + dp[1][i - 1]) % MOD;
	}
	for (int j = 2; j <= k; j++){
		for (int i = 1; i <= n; i++)
		{
			if (i == b){
				dp[j][i] = dp[j][i - 1];
				continue;
			}
			int l, r;
			if (i < b){
				r = max(min(b - i - 1, i - 1),0);
				l = b - i - 1;
				r = i - r;
				l = i + l;
			}
			else{
				l = max(min(abs(b - i) - 1, n - i - 1),0);
				r = i - b - 1;
				r = i - r;
				l = i + l;
			}
			ll me = (dp[j - 1][i] - dp[j - 1][i - 1] + MOD) % MOD;
			ll all = (dp[j - 1][l] - dp[j - 1][r - 1] + MOD) % MOD;
			ll add = (all - me + MOD) % MOD;
			dp[j][i] = (dp[j][i - 1] % MOD + add% MOD) % MOD;
		}
	}
	cout << (dp[k][a] - dp[k][a - 1] + MOD)%MOD << endl;
	return 0;
}


#include<algorithm>
#include <iostream>
#include  <cstring>
#include  <stdio.h>
#include   <string>
#include    <cmath>
#include	  <map>
#include	  <set>
using namespace std;
typedef __int64 vt;
int va[7] = { -1,0,0,-1,0,0,-1 };
int vb[7] = { 0,-1,0,0,0 ,-1,0 };
int vc[7] = { 0,0,-1,0,-1,0,0 };
int ans1=-1;
int mys(int a,int b,int c)
{
	int aa = a, bb = b, cc = c;
	for (int j = 0; j < 7; j++)
	{
		a = aa, b = bb, c = cc;
		int count = 0;
		for (int i = j; a != -1 && b != -1 && c != -1; i++)
		{
			a += va[i];
			b += vb[i];
			c += vc[i];
			count++;
			if (i == 6)
				i = -1;
		}
		count--;
		ans1 = ans1 < count ? count : ans1;
	}
	return ans1;
}
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int aa, bb, cc;
	aa = a / 3, bb = b / 2, cc = c / 2;
	aa = aa > bb ? bb : aa;
	aa = aa > cc ? cc : aa;
	a -= aa * 3;
	b -= aa * 2;
	c -= aa * 2;
	if (aa > 0)
		mys(a + 3, b + 2, c + 2), aa -= 1;
	else
		mys(a, b, c);
	cout << ans1+aa*7 << endl;
	return 0;
}


#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a); i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl

using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 998244353;
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 101;
int cntbad = 0;
int cnt[26];
int arr[mxN];
int val[mxN];
int n;
string s;
vector<int> mins;
int sum = 0;
int main()
{
    //freopen("exercise.in", "r", stdin);
    //freopen("exercise.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>s;
    owo(i, 0, n) {
        arr[i] = s[i]-'a';
        cin>>val[i];
        sum+=val[i];
    }
    owo(i, 0, n/2) {
        if(arr[i]==arr[n-i-1]) {
            cnt[arr[i]]++;
            cntbad++;
        }
    }
    int lose = 0;
    int badnum = -1;
    int over = 0;
    owo(i, 0, n/2) {
        if(arr[i]==arr[n-i-1]) {
            //cout<<arr[i]<<" "<<val[i]<<" "<<val[n-i-1]<<"\n";
            if(2*cnt[arr[i]]>cntbad) {
                badnum = arr[i];
                over = 2*cnt[arr[i]]-cntbad;
            }
            lose+=min(val[i], val[n-i-1]);
        }
    }
    if(badnum==-1) {
        cout<<(sum-lose)<<"\n";
        return 0;
    }
    //cout<<badnum<<" "<<over<<"\n";
    owo(i, 0, n/2) {
        if(arr[i]!=arr[n-i-1]) {
            if(arr[i]!=badnum&&arr[n-i-1]!=badnum){
                mins.senpai(val[i]);
                mins.senpai(val[n-i-1]);
            }
        }else {
            if(arr[i]==badnum)continue;
            mins.senpai(max(val[i], val[n-i-1]));
        }
    }
    sort(mins.begin(), mins.end());
    owo(i, 0, over) {
        lose+=mins[i];
    }
    cout<<(sum-lose)<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int s,v1,t1,v2,t2,a,b;
int main()
{
	scanf("%d%d%d%d%d",&s,&v1,&v2,&t1,&t2);
	a=s*v1+t1*2; b=s*v2+t2*2;
	if(a<b) printf("First");
	if(a==b)printf("Friendship");
	if(a>b)printf("Second");
	return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
inline void Rd(int &res){
	char c;res=0;
	while(c=getchar(),c<'0');
	do{
		res=(res<<1)+(res<<3)+(c^48);
	}while(c=getchar(),c>='0');
}
const int N=32;
const int M=35;
const int P=(int)1e9+7;
int q;
int dp1[M][2][2][2],dp2[M][2][2][2],X[M],Y[M],K[M];
inline void Add(int &a,int b){
	a=(a+b)%P;
}
int solve(int x,int y,int k){
	if(x<0||y<0)return 0;
	memset(dp1,0,sizeof(dp1));
	memset(dp2,0,sizeof(dp2));
	for(int i=1;i<=N;i++){
		X[i]=(x&1),Y[i]=(y&1),K[i]=(k&1);
		x>>=1,y>>=1,k>>=1;
	}
	reverse(X+1,X+N+1),reverse(Y+1,Y+N+1),reverse(K+1,K+N+1);
	dp1[1][1][1][1]=1;
	for(int i=1;i<N;i++)
		for(int j=0;j<2;j++)
			for(int k=0;k<2;k++)
				for(int t=0;t<2;t++)
					for(int x=0;x<2;x++)
						for(int y=0;y<2;y++){
							if(!dp1[i][j][k][t])continue;
							int z=x^y;
							if(j&&(x>X[i+1]))continue;
							if(k&&(y>Y[i+1]))continue;
							if(t&&(z>K[i+1]))continue;
							Add(dp1[i+1][j&(x==X[i+1])][k&(y==Y[i+1])][t&(z==K[i+1])],dp1[i][j][k][t]);
							Add(dp2[i+1][j&(x==X[i+1])][k&(y==Y[i+1])][t&(z==K[i+1])],dp2[i][j][k][t]);
							Add(dp2[i+1][j&(x==X[i+1])][k&(y==Y[i+1])][t&(z==K[i+1])],dp1[i][j][k][t]*((ll)z<<(N-1-i))%P);
						}
	int res=0;
	for(int i=0;i<2;i++)
		for(int j=0;j<2;j++)
			for(int t=0;t<2;t++)
				Add(res,(dp1[N][i][j][t]+dp2[N][i][j][t])%P);
	return res;
}
int main(){
	Rd(q);
	while(q--){
		int x1,y1,x2,y2,k,ans=0;
		Rd(x1),Rd(y1),Rd(x2),Rd(y2),Rd(k);
		x1--,y1--,x2--,y2--,k--;
		ans=(ans+solve(x2,y2,k))%P;
		ans=(ans-solve(x1-1,y2,k)+P)%P;
		ans=(ans-solve(x2,y1-1,k)+P)%P;
		ans=(ans+solve(x1-1,y1-1,k))%P;
		printf("%d\n",ans);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define MAX 10000000
int a[MAX+10];

int main()
{

    for(int i=1;i*i<=MAX;i++)
    {
        int sq=i*i;
        for(int j=sq;j<=MAX;j+=sq)
        {
            a[j]=sq;
        }
    }

    long long y,n;
    cin>>y>>n;
    long long sum=0;
    for(long long i=0;i<n;i++)
    {
        sum+=(y+i)/a[y+i];

    }
    cout<<sum;
}