#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
//indexed set is using "int" here--------- use ll ...
// typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define rem 1000000007
#define PI 3.141592653589793238462643383279502

ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
int phi(int n)
{
    int result = n;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            while (n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if (n > 1)
        result -= result / n;
    return result;
}
int main()
{
    FAST;
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll a, b, c;
    cin >> a >> b >> c;
    ll val2 = power(b, c, 4);
    ve <ll> A(2),X(2),P(2);
    P[0]=2;
    P[1]=5;
    ll R[2][2];
    rep (i,0,2)
    {
        rep (j,0,2)
        {
            R[i][j]=modInverse(P[i],P[j]);
        }
    }
    A[0]=(a%2==0?0:1);
    A[1] = (a%5==0?0:power(a, val2, 5));
    ll k=2;
    for (int i = 0; i < k; ++i)
    {
        X[i] = A[i];
        for (int j = 0; j < i; ++j)
        {
            X[i] = R[j][i] * (X[i] - X[j]);

            X[i] = X[i] % P[i];
            if (X[i] < 0)
                X[i] += P[i];
        }
    }
    ll ans=(X[0])%10+(X[1]*P[0])%10;
    cout << (ans) % 10 << "\n";
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

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

#ifdef ARTHUR_LOCAL
	#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
	#define debug(x...)
#endif

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

ll p;

ll mod_exp(ll a, ll b)
{
	if(b==0LL) return 1LL;

	ll ans = mod_exp(a,ll(b/2LL));
	ans*=ans;
	ans%=p;

	if(b%2LL==1LL) ans*=a;
	ans%=p;

	return ans;
}

ll prop(ll a, ll b, ll c)
{
	p=4;
	ll expp = mod_exp(b, c);
	p=5;
	ll val = mod_exp(a, expp);
	if(val % 2LL == a % 2LL) return val;
	else return val+5;
}

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

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
		// ofstream cout("arcout.txt");
		// ifstream cin1("arcout.txt");
		// ifstream cin2("arcpyout.txt");
	#endif

	ll a,b,c;
	cin>>a>>b>>c;
	if(a%10 == 0){
		cout<<0<<endl;
		return 0;
	}
	if(a%5 == 0){
		cout<<5<<endl;
		return 0;
	}
	// EVEN CASE!!!
	a%=10LL;
	b%=4LL;
	p=4;
	ll fff=mod_exp(b,c);
	p=5;
	if(mod_exp(a,fff)%2LL == a%2LL) cout<<mod_exp(a,fff)<<endl;
	else cout<<5+mod_exp(a,fff)<<endl;
	return 0;

	// for(int i=0; i<10; i++){
	// 	for(int j=0; j<10; j++){
	// 		p=4;
	// 		cout<<i<<" "<<j<<" "<<mod_exp(i,j)<<endl;
	// 	}
	// }

	// // cout<<(10)*(4/5)*(1/2)<<endl;
	// // return 0;

	// // ll a,b,c;
	// // cin>>a>>b>>c;
	// // a%=10LL;
	// // b%=4LL;
	// // cout<<prop(a,b,c)<<endl;

	// for(int test=1; test<=10000; test++){
	// 	ll a,b,c;
	// 	// cin>>a>>b>>c;
	// 	a=randint(1000000000);
	// 	b=randint(1000000000);
	// 	c=randint(1000000000);
	// 	a%=10LL;
	// 	b%=4LL;
	// 	if(prop(a,b,c)<0LL || prop(a,b,c)>9) cout<<a<<" "<<b<<" "<<c<<endl;
	// }
}


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
inline void yes() { cout << "Yes" << ENDL; }
inline void no() { cout << "No" << ENDL; }

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

ll dp[1<<8][100010]={};

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,m;cin>>n>>m;
  V<ll> w(n),l(m),v(m);cin>>w;
  rep(i,0,m)cin>>l[i]>>v[i];

  ll wlim=LINF;rep(i,0,m)chmin(wlim,v[i]);
  rep(i,0,n)if(w[i]>wlim){
    cout<<-1<<ENDL;
    return 0;
  }

  rep(bit,0,1<<n){
    ll wei=0;
    rep(i,0,n)if(bit & (1<<i))wei+=w[i];

    rep(i,0,m){
      dp[bit][i+1]=dp[bit][i];
      if(v[i]<wei)chmax(dp[bit][i+1],l[i]);
    }
  }

  V<int> per(n);
  iota(all(per),0);
  ll ans=LINF;
  do{
    V<ll> di(n,0);
    rep(i,0,n){
      ll bit=(1<<per[i]);
      rep(j,i+1,n){
        bit |= (1<<per[j]);
        chmax(di[j],di[i]+dp[bit][m]);
      }
    }
    chmin(ans,di[n-1]);
  }while(next_permutation(all(per)));

  cout<<ans<<ENDL;
}
//! ( . _ . ) !
//CHECK overflow,vector_size,what to output?

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

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

    int n;
    long long C;
    cin >> n >> C;
    map<int, long long> mp;
    for (int i=0; i<n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        mp[a] += c;
        mp[b+1] -= c;
    }

    long long ret = 0, pref = 0;
    int ti = 0;
    for (auto &p : mp) {
        ret += (p.first - ti) * min(pref, C);
        ti = p.first;
        pref += p.second;
    }
    cout << ret << "\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxn 200005
int n;
ll a[maxn],sum[maxn];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]),sum[i]=sum[i-1]+a[i];

	ll summ=0,maxx=a[1];
	for(int i=1;i<=n;i++){
		summ+=sum[i-1];maxx=max(maxx,a[i]);
		ll ans=summ+i*maxx+sum[i];
		printf("%lld\n",ans);
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define p(x,y) pair<x,y>
#define oset(x) tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define scan(a) for(auto &it:a)cin>>it;
#define print(a) {for(auto it:a)cout<<it<<" ";cout<<endl;}
#define out(x) cout<<((x)?"YES":"NO")<<endl;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define int ll

void solve()
{
  int n;
  cin>>n;
  vector<pair<double,double>> a;
  rep(i,0,n)
  {
    double t,l,r;
    int t1,l1,r1;
    cin>>t1>>l1>>r1;
    t=t1;r=r1;l=l1;
    if(t==2)
        r-=0.4;
    else if(t==3)
        l+=0.4;
    else if(t==4)
        l+=0.4,r-=0.4;
    a.push_back(make_pair(l,r));
    // cout<<a[i].first<<" ";
  }
  int ans=0;
  rep(i,0,n)
  {
    if(a[i].first==-1)
        continue;
    double l1=a[i].first,r1=a[i].second,l2,r2;
    rep(j,i+1,n)
    {
        l2=a[j].first;r2=a[j].second;
        if(r1<l2||r2<l1)
            continue;
        ans++;
    }
  }
  cout<<ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t=1;
    //init();
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define all(a) (a).begin(), (a).end()
using pint = pair<ll, ll>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll seen[200200];
int n;
vector<vector<pint>> g(200200);

int main() {
    cin >> n;
    rep(i, 0, n - 1) {
        ll u, v, w;
        cin >> u >> v >> w;
        --u, --v;
        g[u].push_back({w, v});
        g[v].push_back({w, u});
    }
    rep(i, 0, n) seen[i] = -1;
    seen[0] = 0;
    queue<ll> q;
    q.push(0);
    while (!q.empty()) {
        int now = q.front();
        q.pop();
        for (auto p : g[now]) {
            ll next = p.second, w = p.first;
            if (seen[next] == -1) {
                seen[next] = seen[now] ^ w;
                q.push(next);
            }
        }
    }
    ll ans = 0;
    const ll mod = 1e9 + 7;
    rep(i, 0, 60) {
        ll cnt0 = 0, cnt1 = 0;
        rep(j, 0, n) {
            if (seen[j] & 1LL << i)
                cnt1++;
            else
                cnt0++;
        }
        // cout << i << " : " << cnt0 << cnt1 << "\n";
        ans = (ans + (1LL << i) % mod * cnt0 * cnt1 % mod) % mod;
    }
    cout << ans << "\n";
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 400010, mod = 1e9 + 7;

int e[N], ne[N], h[N], idx, w[N][61], n;
ll tar, d[N][2], res;

void add(int a, int b, long long c) {
	e[idx] = b, ne[idx] = h[a];
	for (int i = 0; i < 60; ++i) {
		if (c & 1) w[idx][i] = 1;
		c /= 2;
		if (!c) break;
	}
	h[a] = idx++;
}

void go(int x, int fa) {
	d[x][0] = d[x][1] = 0;
	for (int i = h[x]; i != -1; i = ne[i]) {
		if (fa == e[i]) continue;
		go(e[i], x);
		if (w[i][tar]) {
			d[x][0] += d[e[i]][1];
			d[x][1] += d[e[i]][0] + 1;
		} else {
			d[x][0] += d[e[i]][0] + 1;
			d[x][1] += d[e[i]][1];
		}
	}
	res += d[x][1];
	ll t = 0;
	for (int i = h[x]; i != -1; i = ne[i]) {
		if (fa == e[i]) continue;
		if (w[i][tar]) {
			res += (d[e[i]][0] + 1) * (d[x][0] - d[e[i]][1]);
		} else {
			res += d[e[i]][1] * (d[x][0] - d[e[i]][0] - 1);
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	memset(h, -1, sizeof h);
	for (int i = 1; i < n; ++i) {
		int a, b;
		ll w;
		cin >> a >> b >> w;
		add(a, b, w);
		add(b, a, w);
	}
	ll ans = 0;
	for (int i = 0; i < 60; ++i) {
		tar = i;
		res = 0;
		go(1, -1);
		ans = (ans + res % mod * ((1ll << i) % mod) % mod) % mod;
	}
	cout << ans << '\n';
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>
#include <bitset>
#include <chrono>

using namespace std;

typedef long long ll;

const int Inf = 1e9;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int t;
  cin >> t;
  string go = "atcoder";
  while (t--) {
    string s;
    cin >> s;
    int need = 0;
    int ans = Inf;
    for (int i = 0; i < (int)go.size(); ++i) {
      for (int j = i; j < (int)s.size(); ++j) {
        if (s[j] > go[i]) {
          ans = min(ans, need + j - i);
        }
      }
      int id = -1;
      for (int j = i; j < (int)s.size(); ++j) {
        if (s[j] == go[i]) {
          id = j;
          break;
        }
      }
      if (id == -1) break;
      s.erase(s.begin() + id);
      s.insert(s.begin() + i, go[i]);
      need += id - i;

      if (i == (int)go.size() - 1) {
        if (s.size() > go.size()) {
          ans = min(ans, need);
        }
      }
    }
    if (ans == Inf) {
      cout << "-1\n";
    } else {
      cout << ans << '\n';
    }
  }
}

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

void solve()
{
	string s;
	cin>>s;
	int n=s.length(),x=0;
	while(x<n && s[x]=='a')
		x++;
	cout<<(x==n?-1:s>"atcoder"?0:x-(s[x]>'t'))<<endl;
}

int main() {
	//freopen("t","r",stdin);
	int test;
	cin>>test;
	while(test--)
		solve();
    return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define LL long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int readint(){
	int x=0,y=1;char c=getchar();
	while((c<'0'||c>'9')&&c!='-')c=getchar();
	if(c=='-')y=-1,c=getchar();
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
	return x*y;
}
int n;
int a[2510];
int main(){
	cin>>n;
	if(n==3){
		puts("6 10 15");
//		2*2*3
//		2*2
//		3*2
	}else if(n==4){
		puts("84 60 105 70");
	}else{
		int a[3]={6,10,15};
		cout<<"6 10 15 ";
//		for(int i=4;i<=n;i++)cout<<4*i<<' ';
		int cnt=4;
		for(int i=16;i<=10000&&cnt<=n;i++){
			int cur=0;
			if(i%2==0)cur++;
			if(i%3==0)cur++;
			if(i%5==0)cur++;
			if(cur>=2)cnt++,cout<<i<<' ';
		}
		puts("");
	}
	return 0;
}

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	if (n < 0) {
		ll res = mod_pow(x, -n, m);
		return mod_pow(res, m - 2, m);
	}
	if (abs(x) >= m)x %= m;
	if (x < 0)x += m;
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
modint operator/=(modint& a, modint b) { a = a / b; return a; }
const int max_n = 1 << 1;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
modint combP(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[a - b];
}

void solve() {
	int n; cin >> n;
	vector<int> ans;
	ans.push_back(6);
	ans.push_back(10);
	ans.push_back(15);
	for (int i = 1; i <= 10000; i++) {
		if (i == 6 || i == 10 || i == 15)continue;
		if (i % 6 == 0 || i % 10 == 0 || i % 15 == 0)ans.push_back(i);
	}
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << ans[i];
	}
	cout << "\n";
	//cout << ans.size() << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}


#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)

using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int mod = 1000000007;
const int nil = -1;
int i, j, n, x, k, ans;
char c;

int main() {
    scanf(" %d %d", &n, &x);
    rep(0,n+1) {
        scanf("%c", &c);
        if (c == 'x') x = max(x-1, 0);
        else if (c == 'o') x++;
    }
    printf("%d\n", x);
}

#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

constexpr ll MOD = 1000000007;

#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
ostream &operator<<(ostream &o, const string &obj) {o << "\""; o << obj.c_str(); o << "\""; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}

#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif

template <typename... Ts>
std::istream& IN(Ts&... xs){ return (std::cin >> ... >> xs); }

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

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

    ll n,x;
    IN(n,x);

    string s;
    IN(s);

    rep(i,n){
        switch(s[i]){
        case 'o': x++; break;
        case 'x': x=max(0ll,x-1); break;
        }
    }

    cout << x << endl;

    return 0;
}


#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;
namespace defines{
    typedef long long ll;
    typedef pair<ll,ll> P;
    #define FOR(i,a,b) for(ll i = a ; i < b ; i++) // for i in range(a,b)
    #define REP(i,n) for(ll i = 0 ; i < n ; i++) // for i in range(b)
    #define FORD(i,a,b) for(ll i = a ; i > b ; i--) // for i in range(a,b,-1)
    #define ALL(x) x.begin(),x.end()
    template<class T> vector<T> make_vec(size_t a){return vector<T>(a);}
    template<class T, class... Ts> auto make_vec(size_t a, Ts... ts){ return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}
    template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){std::fill( (T*)array, (T*)(array+N), val );}

    /* for debug */
    #define DEBUG(x) dbg(#x,x)
    template<class T> void dbg(string name, T x){cerr<<name<<": "<<x<<"\n";}
    template<> void dbg<P>(string name, P x){cerr<<name<<": ("<<x.first<<","<<x.second<<")\n";}
    template<class T> void dbg(string name, vector<T> xl){cerr<<name<<": "; for(T x: xl) cerr<<x<<" "; cerr<<'\n';}
    template<> void dbg<P>(string name, vector<P> xl){cerr<<name<<": "; for(P x:xl){cerr<<"("<<x.first<<","<<x.second<<"), ";}cerr<<"\n";}
    template<class T> void dbg(string name, vector<vector<T>> xl){ cerr<<name<<": \n"; int ml=1;for(vector<T> row: xl){for(T x:row){stringstream sstm; sstm<<x; ml=max(ml,(int)sstm.str().size());}}; for(vector<T> row: xl){{for(T x:row) cerr<<std::right<<std::setw(ml+1)<<x;} cerr << '\n';}}
    template<class T> void dbg(string name, set<T> xl){cerr<<name<<": "; for(T x:xl)cerr<<x<<" ";cerr<<'\n';}
    template<class T> void dbg(string name, multiset<T> xl){cerr<<name<<": "; for(T x:xl)cerr<<x;cerr<<'\n';}
    template<class T> void dbg(string name, unordered_set<T> xl){cerr<<name<<": "; for(T x:xl)cerr<<x<<" ";cerr<<'\n';}
    template<class T> void dbg(string name, unordered_multiset<T> xl){cerr<<name<<": "; for(T x:xl)cerr<<x;cerr<<'\n';}
    template<class T, class U> void dbg(string name, map<T,U> xl){cerr<<name<<": \n"; for(auto &[k,v]:xl)cerr<<"  "<<k<<": "<<v<<'\n';}
    template<class T, class U> void dbg(string name, unordered_map<T,U> xl){cerr<<name<<": \n"; for(auto &[k,v]:xl)cerr<<"  "<<k<<": "<<v<<'\n';}
}
using namespace defines;

const int IINF = 1'001'001'001;
const ll INF = 1'001'001'001'001'001'001ll;
const int MOD = 1'000'000'007;
// const int MOD = 998244353;
// using mint = modint1000000007;
// using mint = modint998244353;

const ll max2=262145;
// const ll max2=1025;
bool comp[max2];
ll dp[max2];
ll n,m;
vector<unordered_set<ll>> gl(20);
const ll MAX=10000;

ll rec(ll state){
    if(dp[state]!=MAX) return dp[state];
    if(comp[state]) return 1;
    for(ll t=state ; t>0 ; t=(t-1)&state){
        if(t==state)continue;
        dp[state] = min(rec(t)+rec(t^state), dp[state]);
    }
    return dp[state];
}

void solve(){
    Fill(dp,MAX);
    cin>>n>>m;
    REP(i,m){
        ll a,b; cin >> a >> b;
        a-=1;b-=1;
        gl[a].insert(b);
        gl[b].insert(a);
    }
    ll p2=pow(2,n);
    REP(i,p2){
        vector<ll> vl;
        REP(j,n){
            if((i>>j)%2==1)vl.push_back(j);
        }
        bool ok=true;
        REP(j1, vl.size()){
            REP(j2, vl.size()){
                if(j1==j2)continue;
                if( gl[vl[j1]].find(vl[j2])==gl[vl[j1]].end() ) {
                    ok=false;
                    break;
                }
            }
        }
        comp[i]=ok;
    }
    cout<<rec(p2-1)<<endl;

    // vector<int> aaa(begin(dp),end(dp));
    // DEBUG(aaa);
    //     vector<int> aa(begin(comp),end(comp));
    // DEBUG(aa);
    // DEBUG(aa[65]);
}

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

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

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<
#define y1 bfrsoihgdfnm

#define INF (ll)1e18
#define mod 998244353
#define maxn 210

ll i, i1, j, k, k1, t, n, m, res, flag[10], a[maxn], b;
ll x1, y1, x, y, kn[maxn][maxn];
bool vis[maxn];
vector<ll> parent[maxn][maxn], rs[2];

ll bk(ll x, ll p) {
    if (p == 1) return (((x - a[i]) % 200) + 200) % 200;
    else return x;
}

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

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> a[i];
    }

    kn[0][0] = 1;
    for (i = 1; i <= n; i++) {
        for (j = 0; j <= 199; j++) {
            k = (j + a[i]) % 200;
            kn[i][k] += kn[i - 1][j];
            kn[i][k] = min((ll)2, kn[i][k]);
            if (kn[i - 1][j] > 0) parent[i][k].pb(1);

            k = j;
            kn[i][k] += kn[i - 1][j];
            kn[i][k] = min((ll)2, kn[i][k]);
            if (kn[i - 1][j] > 0) parent[i][k].pb(0);
        }
    }

    m = -1;
    for (j = 0; j <= 199; j++) {
        if (kn[n][j] == 2) {
            m = j; break;
        }
    }

    if (m == -1) {
        cout << "NO" << nl; return 0;
    }

    k = m; i = n;
    while (parent[i][k].size() == 1) {
        k = bk(k, parent[i][k][0]); i--;
    }

    x = bk(k, parent[i][k][0]); y = bk(k, parent[i][k][1]);
    if (parent[i][k][0] == 1) rs[0].pb(i);
    else rs[1].pb(i);
    i--;

    while (i >= 1) {
        x1 = parent[i][x][0]; y1 = parent[i][y][0];
        x = bk(x, x1); y = bk(y, y1);
        if (x1 == 1) rs[0].pb(i);
        if (y1 == 1) rs[1].pb(i);
        i--;
    }

    sort(rs[0].begin(), rs[0].end());
    sort(rs[1].begin(), rs[1].end());

    if ((ll)rs[0].size() + (ll)rs[1].size() == n) {
        if (rs[0].empty()) {
            rs[0].pb(rs[1].back()); rs[1].pop_back();
        } else if (rs[1].empty()) {
            rs[1].pb(rs[0].back()); rs[0].pop_back();
        }
    } else {
        for (auto u : rs[0]) vis[u] = true;
        for (auto u : rs[1]) vis[u] = true;
        for (i = 1; i <= n; i++) {
            if (!vis[i]) {
                k = i; break;
            }
        }
        if (rs[0].empty() || rs[1].empty()) {
            rs[0].pb(k); rs[1].pb(k);
        }
    }

    sort(rs[0].begin(), rs[0].end());
    sort(rs[1].begin(), rs[1].end());

    cout << "YES" << nl;
    cout << rs[0].size() << ' ';
    for (auto u : rs[0]) cout << u << ' ';
    cout << nl;
    cout << rs[1].size() << ' ';
    for (auto u : rs[1]) cout << u << ' ';

    return 0;
}


/********************************************************************
* @brief https://atcoder.jp/contests/abc145/tasks/abc145_c
* @date 2020/10/16
*********************************************************************/
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード
using namespace std;

//ループ
#define rep(i, n) for(int i = 0; i < (n); i++) //普通のループ
#define repr(i, n) for(int i = n; i >= 0; i--) //逆ループ

//型名省略
typedef long long ll;
//値
static const ll MX = 100005;
static const ll MX_ll = 1e18;
const double PI = acos(-1); //π

using namespace std;

//ソート
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int main(){
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i,n) b[i] = 0;
    rep(i,n){
        int tmp;
        cin >> tmp;
        tmp--;
        b[tmp]++;
    }
    int chk = 0;
    rep(i,n){
        if(b[i]!=1){
            chk=1;
            break;
        }
    }
    if(chk==1) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

using ll = long long;
using ld = long double;
const ld eps = 1e-8;
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define be(a) (a).begin(), (a).end()
// #define constexpr(...) (__VA_ARGS__)
// DEBUGING TEMPLETE ////////////////////////////////////////////////////////////////////////{{{
#define db(val) "["#val" = "<<(val)<<"] "
#define CONCAT_(x, y) x##y
#define CONCAT(x, y) CONCAT_(x, y)
#ifdef LOCAL_DEBUG
#   define clog cerr << flush << string(__db_level * 2, ' ')
#   define DB() debug_block CONCAT(dbbl, __LINE__)
    int __db_level = 0;
    struct debug_block {
        debug_block() { clog << "{" << endl; ++__db_level; }
        ~debug_block() { --__db_level; clog << "}" << endl; }
    };
#else
#   define clog if (0) cerr
#   define DB(...)
#endif

template<class U, class V> ostream& operator<<(ostream& out, const pair<U, V>& p) {
    return out << "(" << p.first << ", " << p.second << ")";
}

template<size_t i, class T> ostream& print_tuple_utils(ostream& out, const T& tup) {
    if constexpr(i == tuple_size<T>::value) return out << ")";
    else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup);
}

template<class ...U> ostream& operator<<(ostream& out, const tuple<U...>& tup) {
    return print_tuple_utils<0, tuple<U...>>(out, tup);
}

template<class Con, class = decltype(begin(declval<Con>()))>
typename enable_if<!is_same<Con, string>::value, ostream&>::type
operator<<(ostream& out, const Con& container) {
    out << "{";
    for (auto it = container.begin(); it != container.end(); ++it)
        out << (it == container.begin() ? "" : ", ") << *it;
    return out << "}";
}
// ACTUAL SOLUTION START HERE ////////////////////////////////////////////////////////////////}}}

int main(void) {
#ifdef LOCAL
    freopen("main.inp", "r", stdin);
    freopen("main.out", "w", stdout);
    freopen(".log", "w", stderr);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m; cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    vector<vector<int>> pos(n);
    rep(i, n) pos[a[i]].push_back(i);

    rep(ans, n) {
        int prev = -1;
        for (auto i: pos[ans]) {
            if (i - prev - 1 >= m) {
                cout << ans << '\n';
                return 0;
            }
            prev = i;
        }
        if (n - prev - 1 >= m) {
            cout << ans << '\n';
            return 0;
        }
    }
    cout << n;

    return 0;
}

// vim: foldmethod=marker


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

int ri(){
  int n;
  scanf("%d", &n);
  return n;
}

int main(){
  int h = ri();
  int w = ri();
  int x = ri() - 1;
  int y = ri() - 1;
  string s[h];
  for(auto &i : s) cin >> i;

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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,x,y;cin>>h>>w>>x>>y;
  --x,--y;
  vector<string> s(h);
  int ans=1;
  for(int i=0;i<h;i++)cin>>s[i];
  const int dx[]={-1,1,0,0};
  const int dy[]={0,0,-1,1};
  for(int i=0;i<4;i++){
    for(int j=1;j<200;j++){
      int nx=x+dx[i]*j,ny=y+dy[i]*j;
      if(nx<0 or nx>h-1 or ny<0 or ny>w-1)break;
      if(s[nx][ny]=='#')break;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
// using namespace atcoder;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

const ll MOD = 998244353;

int main() {
    ll n; cin >> n;
    ll a[n] = {};
    rep(i,n) cin >> a[i];
    sort(a,a+n);

    ll ans = 0;
    ll now = 0;
    rep(i,n){
        ans += now * a[i] % MOD;
        ans += a[i]*a[i];
        ans %= MOD;
        now = (now*2 + a[i]) % MOD;
    }

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

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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU

void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	off;
}
LL n,m;
VL arr;
VL brr;
map<int, VI> occ;
LL dp[1005][1005];
LL rec(LL ind, LL bind){
	if(ind == n || bind == m){
		return max(n - ind, m - bind);
	}
	if(dp[ind][bind] != -1)
		return dp[ind][bind];
	LL ans = 0;
	ans = rec(ind+1, bind+1) + (arr[ind] != brr[bind]);
	LL tt = 1 + min(rec(ind, bind+1), rec(ind+1, bind));
	return dp[ind][bind] = min(ans,tt);
}
int main(){
	IO();
	cin>>n>>m;
	arr.resize(n);brr.resize(m);
	rep(i,0,n){
		cin>>arr[i];
	}
	rep(i,0,m){
		cin>>brr[i];
		// occ[brr[i]].PB(i);
	}
	rep(i,0,1005){
		rep(j,0,1005){
			dp[i][j] = -1;
		}
	}
	cout<<rec(0, 0);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long cyanmond;
  cin >> cyanmond;
  vector<unsigned long long> cyankawaii(cyanmond);
for (unsigned long long mohumohu = 0; mohumohu < cyanmond; mohumohu++) {
  cin >> cyankawaii.at(mohumohu);
}
  vector<unsigned long long> cyan(cyanmond+1, 0);
        for (unsigned long long i = 0; i < cyanmond; ++i){cyan[i+1] = cyan[i] + cyankawaii[i];}
unsigned long long kawaiicyan = 0;
  unsigned long long cyankawaisugi = 0;
  for (unsigned long long i = 1; i <= cyanmond; i++) {
    kawaiicyan=max(kawaiicyan, cyankawaii.at(i - 1));
    cyankawaisugi = cyankawaisugi + cyan.at(i - 1);
    cout << kawaiicyan * i + cyankawaisugi + cyan.at(i) << endl;
}

}

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;

template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }

template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }

static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

// const i64 INF = 2e18;
const int INF = 2e9;
const __int128_t M = 998244353;
const int MXB = 20;
using bin = bitset<MXB + 1>;
const double EPS = 1e-8;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());

    int n;
    while (read(n)) {
        llvec a(n);
        read(a);

        auto sa = a;
        partial_sum(sa.begin(), sa.end(), sa.begin());

        auto ma = a;
        partial_sum(ma.begin(), ma.end(), ma.begin(), [](auto a, auto b) {
            return std::max(a, b);
        });

        i64 lv = 0;
        forn(i, n) {
            auto res = lv + sa[i] + (i + 1) * ma[i];
            std::cout << res << "\n";

            lv += sa[i];
        }
    }
}


#include <bits/stdc++.h>
#include <sys/time.h>
#pragma GCC optimize "O3,omit-frame-pointer,inline"
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

constexpr ll CYCLES_PER_SEC = 2800000000;
constexpr double TL = 1990;
double get_ms() { struct timeval t; gettimeofday(&t, NULL); return (double)t.tv_sec * 1000 + (double)t.tv_usec / 1000; }
constexpr int dh[4] = {-1, 0, 1, 0};
constexpr int dw[4] = {0, 1, 0, -1};
constexpr char MOVE[4] = {'U', 'R', 'D', 'L'};

uint32_t XorShift(void) {
	static uint32_t x = 123456789;
	static uint32_t y = 362436069;
	static uint32_t z = 521288629;
	static uint32_t w = 88675123;
	uint32_t t;

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

double Prob(void){
	double ret = (double)XorShift() / UINT_MAX;
	return ret;
}

namespace AHC004{
    int N, M;
    vector<string> S;
    void input(){
        cin >> N >> M;
        S.resize(M);
        REP(i,M) cin >> S[i];
    }

    void output(){
        REP(i,N) cout << string(N, 'A') << endl;
    }

    void main(){
        input();
        output();
    }
}

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

#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
// #define MOD (998244353)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pl(T x){cout << x << " ";}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){pl(a[i]);} pr(a.back());}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    double a, b, x, y; cin >> a >> b >> x >> y;
    double ans = a + (x-a)*b/(y+b);
    printf("%.20lf\n", ans);
    return 0;}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define all(v) v.begin( ), v.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
#define rrep(i, n) for(int i=(n); i>=0; i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

/*
辞書順でK番目のものを答えよ、という問題と同様の解き方で解く（あってた）
どうやってsumごとの組み合わせ数を数えるか⇒DP+いもす法（わからなかった）
Nが変動して貪欲できないのでDPという発想が自然かもしれない
*/

ll dp[4][3010101];
int main(){
    ll N, K; cin >> N >> K;

    dp[0][0] = 1;
    rep(cnt, 3){
        rep(sum, 2010101){ //何故2*1e6なのか？ -> dp[2][sum]の最大値が200000だから
            //imos法
            dp[cnt+1][sum+1] += dp[cnt][sum];
            dp[cnt+1][sum+N+1] -= dp[cnt][sum];
        }
        rept(sum, 1, 3010101){
            dp[cnt+1][sum] += dp[cnt+1][sum-1];
        }
    }

    ll cu = 0;
    //総和を確定させる
    int sum = -1; //3つの数の総和。最大1e6*3
    for(int i=3; i<3010101; i++){
        if(K <= cu + dp[3][i]){//グループの範囲内かどうか
            sum = i;
            break;
        }
        cu += dp[3][i];
    }

    rep(i, sum) K -= dp[3][i]; //総和未満のグループ合計値を引く

    cu = 1;
    int ans_a = -1;
    //aを全探索
    rept(a, 1, N+1){
        if(K < cu + dp[2][sum - a]){ //dp[2][sum-a]:aを固定してb,cを選んだときの総和の場合の数
            ans_a = a;
            break;
        }
        cu += dp[2][sum-a];
    }

    rept(i, 1, ans_a) K -= dp[2][sum - i];

    cu = 1;
    int ans_b = -1;
    //bを全探索
    rept(b, 1, N+1){
        if(K < cu + dp[1][sum - ans_a - b]){
            ans_b = b;
            break;
        }
        cu += dp[1][sum - ans_a - b];
    }

    int ans_c = sum - ans_a - ans_b;
    cout << ans_a << " " << ans_b << " " << ans_c << ln;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pb push_back
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define SF S.F
#define SS S.S

const int N=3000006, inf=1e6, P=1e9+7;
int n,m,w,d,k,x,y,q,fac[N],inv[N],ans;
vector<int> v;

inline ll C(int n, int m) {
	if (n < 0 || m > n) return 0;
	return fac[n] * inv[m] % P * inv[n-m] % P;
}

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

	inv[0] = fac[0] = inv[1] = fac[1] = 1;
	for (int i = 2;i <= N-6; i++)
		inv[i] = (P - P / i) * inv[P % i] % P;
	for (int i = 2;i <= N-6; i++)
		fac[i] = fac[i-1] * i % P, inv[i] = inv[i-1] * inv[i] % P;

    cin>>n>>m>>k;
    if(n>m+k)return !(cout<<0);
    cout<<(C(n+m, n)-C(n+m, n-(k+1))+P)%P;

}


/*

 ALLAH IS ALMIGHTY              ******BISMILLAHIR RAHMANIR RAHIM.******              ALLAH IS ALMIGHTY
                                    ```````````````````````````````
                                        AUTHOR: ANISUR RAHAMAN
                                            BSMRSTU(SHIICT)
                                                ID:017

                            ............LET's START OUR JOURNEY.............

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

#define I_O                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

//~~~~~~~~~~~~ Sort Form Of Long~~~~~~~~~~~//
#define ll long long int
#define lls int64_t
#define ld long double
#define db double
#define ull unsigned long long int

//~~~~~~~~~~~~~~Pair~~~~~~~~~~~~~~~~~~//
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<db, db>
#define psi pair<string, int>
#define vi vector<int>
#define vl vector<ll>
#define vd vector<db>
#define vs vector<string>
#define vb vector<bool>
#define vpi vector<pii>
#define vpl vector<pll>
#define vpd vector<pdd>
#define vpsi vector<psi>

//~~~~~~~~~~~~~~Vector~~~~~~~~~~~~~~~~~//
#define pb push_back
#define pf push_front
#define MP make_pair
#define in insert
#define ff first
#define ss second
#define al(v) v.begin(), v.end()
#define alr(v) v.rbegin(), v.rend()
#define srt(v) sort(al(v))
#define srtr(v) sort(al(v), greater<int>());
#define len(x) ((ll)(x).length())
#define sz(x) ((ll)(x).size())
#define rev(v) reverse(al(v))
#define btcnt(n) __builtin_popcount(n)
#define acl(v, n) accumulate(al(v), n)
#define eb emplace_back
#define lb(v, kk) lower_bound(al(v), kk)
#define ub(v, kk) upper_bound(al(v), kk)
#define tpu(str) transform(al(str), str.begin(), ::toupper)
#define tpl(str) transform(al(str), str.begin(), ::tolower)
#define cignr cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define mxv(v) *max_element(al(v))
#define mnv(v) *min_element(al(v))

const int MOD = 1e9 + 7;
const ll INF = 2e18;
const int mxn = 2e9 + 9;
const int mxd = 2e5 + 5;
const int mxa = 1e5 + 5;

//~~~~~~~~~~~~~~~~~~Function~~~~~~~~~~~~~~~~~~~~//
lls gcd(lls a, lls b)
{
    if (b == 0LL)
        return a;
    return gcd(b, a % b);
}

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

//~~~~~~~~~~~~~~~Loops and Short~~~~~~~~~~~~~~~~//

#define PI acos(-1)
#define Cn continue
#define Br break
#define off return 0
#define N '\n'
#define WT(somthing)     \
    auto az = something; \
    cout << az << N;
#define WTS(something) cout << something << N;
#define rep(i, n) for (lls i = 0; (lls)i < n; i++)
#define repn(i, a, b) for (lls i = (lls)(a); i < (lls)(b); i++)
#define repr(i, a, b) for (lls i = (lls)(a)-1; i >= (lls)(b); i--)
#define test_case() int T; T = 1; while (T--)

using namespace std;

lls maxll(lls x, lls y) { return x > y ? x : y; }
lls minll(lls x, lls y) { return x < y ? x : y; }
// ===================================~~~~~~ SOLUTION STARTS HERE ~~~~~~=================================== //

//int a, b, c, d, e, res = 0, ans = 0, prod = 1, n, m, cnt = 0, k, l, r, s, t, x, y, f, i, j, p;

void Run_Case()
{
    int n;
    cin >> n;
    vi a(n), b(n), c(n);
    rep (i, n) cin >> a[i];
    rep (i, n) cin >> b[i];
    rep (i, n) cin >> c[i];
    vi va;
    map <int, int> ma, mb;
    rep (i, n) {
        ma[b[c[i] - 1]]++;
    }

    ull cnt = 0;
    rep (i, n) {
        if (ma[a[i]]) cnt += ma[a[i]];
    }
    cout << cnt << N;
}

int main()
{
    I_O
    test_case()
    {
        Run_Case();
    }

    off;
}

#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const int N=5e5+10;
int c[N];
vector<ll>p[N];
ll min1(ll a,ll b)
{
	if(a<b) return a;
	else return b;
}
ll lb(ll x)
{
	return x&(-x);
}
void add(int x,int d) {for(;x<N;x+=lb(x))c[x]+=d;}
int geti(ll x)
{
	int r=0;
	for(;x;x-=lb(x))
	r+=c[x];
	return r;
}
void sset(int x)
{
	if(geti(x)-geti(x-1)==0)
	add(x,1);
}
void reset(int x)
{
	if(geti(x)-geti(x-1)==1)
	add(x,-1);
 }
 //单点修改 就是变得能走还是不能走
int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
    ll x, y, mx = n + 1, my = m + 1;
    for(ll i=1;i<=k;i++)
    {
    	cin>>x>>y;
    	p[x].push_back(y);
    	if(x==1) my=min1(y,my);
    	if(y==1) mx=min1(x,mx);
	}
	for(ll i=1;i<=mx;i++) sort(p[i].begin(),p[i].end());
// cout<<endl<<"mx="<<mx<<' '<<"my="<<my<<endl;
    for(ll i=1;i<=m;i++) sset(i);
    for(ll y=my;y<=m;y++) reset(y);

    ll ans = 0;
  if(!p[1].empty())
  {
  ans+=p[1][0]-1;
  //cout<<' '<<ans<<' '<<endl;
  }
  else ans+=m;
//cout<<endl;
  //cout<<ans<<endl ;
    for(ll x=2;x<=n;x++)
    {
        for (ll y: p[x]) reset(y);
        if (x < mx) {
            if (p[x].empty()) {
                ans += m;
                //这一行都可以走
    //         cout<<x<<' '<<ans<<endl;
            }
			 else {
                ans += p[x][0] - 1;
      //         cout<<x<<' '<<ans<<endl;
                ans += geti(m)-geti(p[x][0]);
        //     cout<<x<<' '<<ans<<endl;
            }
        }
		//上面的都没问题
		//reset的位置都能存到下一个
		else {
			if(p[1].empty())
            ans += geti(m);
            else ans+=geti(p[1][0]-1);
          // cout<<x<<' '<<ans<<endl;
        }

    }
 cout<<ans;
 return 0;
}


#include<bits//stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
const int MAX = 510000;
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
int main(){
    int n;string s;cin>>n>>s;
    stack<char> st;
    rep(i,n){
        st.push(s[i]);string t;
        if(st.size()>=3){
            rep(j,3){
                t.push_back(st.top());st.pop();
            }if(t!="xof"){
                rep(i,3) st.push(t[2-i]);
            }
        }
    }cout << st.size()<<endl;
}

#include <bits/stdc++.h>
using namespace std;
main() {
  int H, W;
  cin >> H >> W;
  assert(2<=H && H<=100);
  assert(2<=W && W<=100);
  vector<string> S(H);
  for(string& s: S) cin >> s;
  int ans{};
  for(string s: S)
    for(int j{}; j < W-1; j++)
      if(s.substr(j,2) == "..") ans++;
  assert(0 <= ans && ans <= H*(W-1));
  for(int j{}; j < W; j++)
    for(int i{}; i < H-1; i++)
      if(S[i][j]=='.' && S[i+1][j]=='.')
        ans++;
  assert(0 <= ans && ans <= H*(W-1)+(H-1)*W);
  cout << ans;
}


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

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

#define fef(i,a,b) for(ll i=a;i<=b;i++)
#define rer(i,a,b) for(ll i=b;i>=a;i--)
#define wew while(true)
#define FILE_IN "D.inp"
#define FILE_OUT "D.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD (ll(1000000007))
#define INF (ll(1000000007))
#define MAXN 300011
#define x first
#define y second
#define pii pair<int,int>
#define piii pair<int,pii>
#define pb push_back
#define endl "\n"
template<typename T> tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> order_set;
typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> order_trie;
typedef long long ll;
class DisjointSet{ public:
    vector<int> parent;
    DisjointSet(int n): parent(n) { for(int i=0; i<n; i++) parent[i] = i; }
    void join(int a, int b) { parent[find(b)] = find(a); }
    int find(int a){ return a == parent[a] ? a : parent[a] = find(parent[a]); }
    bool check(int a, int b){ return find(a) == find(b); }
};

//---------END-------//
template<typename T>
    void read(T &X){
        X=0;
        char c;
        int sign=1;
        c=getchar();
        if (c=='-') sign=-1;else X=X*10+c-'0';
        while ((c=getchar()) && ('0'<=c) && (c<='9'))
            X=X*10+c-'0';
    }
ll N,x,M,H,T;
vector<ll> A;
int main(){
    //ofile;
    cin >> N;
    for (ll i=1;i*i<=N;i++) if (N%i==0){
        A.pb(i);
        if (N/i!=i) A.pb(N/i);
    }
    sort(A.begin(),A.end());
    for (ll i:A) cout << i << endl;

}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	string x;
	getline(cin,x);
	int v=0,i=0;
	while(v!=1&&i<x.size())
	{
		if(x[i]=='.')
			v=1;
		i++;
	}

	if(v==1)
		for(int j=0;j<i-1;j++)
			cout<<x[j];
	else
		for(int j=0;j<x.size();j++)
			cout<<x[j];
	return 0;
}


//缓缓飘落的枫叶像思念，我点燃烛火温暖岁末的秋天。
//堆排序找top k;
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;
const ll N=2e6;
int a[5];
int main()
{

    cin>>a[1]>>a[2]>>a[3];
    sort(a+1,a+4);
    if(a[3]-a[2]==a[2]-a[1])cout<<"Yes";
    else
    cout<<"No";

}

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

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

	vector<int> a(3);
	int sum = 0;
	for (int&x : a) cin >> x, sum += x;
	sort(a.begin(), a.end());
	if (sum % 3 != 0 || sum/3 != a[1]) cout << "No";
	else cout << "Yes";

	return 0;
}


//====================Template==================
#include <bits/stdc++.h>
// #include <boost/lexical_cast.hpp> // for lexical_cast()
using namespace std;

#define endl            '\n'
#define ll              long long int
#define ld              long double
#define mod             1000000007
#define pb              push_back
#define ff              first
#define ss              second
#define inf             1e18
#define mid(l, r)       (l+(r-l)/2)
#define loop(i, a, b)   for(int i=(a); i<b; i++)
#define loopr(i, a, b)  for(int i=(a); i>b; i--)

#define sz(a)           int((a).size())
#define all(c)          c.begin(), c.end()
#define allr(c)         c.rbegin(), c.rend()

#define tr(container, it) \
    for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) \
    (container.find(element) != container.end())
#define vpresent(container, element) \
        (find(all(container),element) != container.end())

#define print(dp, n); \
    loop(i, 0, n){cerr << dp[i] << " ";}cerr << endl;
#define print2(dp, a, n, b, m); \
    loop(i, a, n){loop(j, b, m){cerr << dp[i][j] << " ";}cerr << endl;}
#define countetbits(i)\
    __builtin_popcount(i)

typedef vector< long long int > vl;
typedef vector< int > vi;
typedef vector< string > vs;
typedef vector< double > vd;

typedef vector< vi > vvi;
typedef vector< vl > vvl;

typedef pair< ll,ll > pll;
typedef pair< int, int> pii;

//sieve of eratosthenes
vector<int> smallest_factor;
vector<bool> prime;
vector<int> primes;
const int P_MAX = int(1e5) + 5;
void sieve(int maximum) {
    maximum = max(maximum, 1);
    smallest_factor.assign(maximum + 1, 0);
    prime.assign(maximum + 1, true);
    prime[0] = prime[1] = false;
    primes = {};
    for (int p = 2; p <= maximum; p++)
        if (prime[p]) {
            smallest_factor[p] = p;
            primes.push_back(p);
            for (int64_t i = int64_t(p) * p; i <= maximum; i += p)
                if (prime[i]) {
                    prime[i] = false;
                    smallest_factor[i] = p;
                }
        }
}

// __gcd(m, n)
ll gcd(ll a, ll b)
{
    while (true)
    {
        if (a == 0) return b;
        b %= a;
        if (b == 0) return a;
        a %= b;
    }
}
ll lcm(ll a, ll b)
{
    ll temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

template <class A, class B>
auto findMin(A a, B b) -> decltype(a < b ? a : b)
{
    return (a < b) ? a : b;
}
//Type Inference refers to automatic deduction of the data type of an expression in a programming language.
//Auto lets you declare a variable with particular type whereas decltype lets you extract the type from the variable so decltype is sort of an operator that evaluates the type of passed expression.

void file_i_o(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("cerr.txt", "w", stderr);
#endif
}
// lexical_cast() converts a int into string
//   string stri = boost::lexical_cast<string>(i_val);

//===========================Template Ends==================================

ll modd = 1000000009;
ll n, k, q;
ll dp[100005];

void run_case(){
    cin >> n;
    ll rem = n%100;
    cout << 100-rem << endl;
}

int main(){
    clock_t begin = clock();
    // sieve(P_MAX);
    file_i_o();
    int tests = 1;
    // int tests;
    // cin >> tests;

    while(tests-- > 0)
        run_case();

    #ifndef ONLINE_JUDGE
    clock_t end = clock();
        cout << "\n\nExecuted In: " << double(end - begin) /CLOCKS_PER_SEC << " seconds" << endl;
    #endif
    return 0;
}

//Debug
//1. input for test
//2. look for type conversion, char to int
//3. look for declaration of large arrays.

#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%100 == 0)
	{
		if(n>=100 || n==0)
		cout<<"100";
		else
		cout<<"0";
	}
	else
	{
		cout<<100-(n%100);
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (n); i++)

tuple<ll, ll, ll> extgcd(ll a, ll b) {
    if(b == 0) return {a, 1, 0};
    auto [g, x, y] = extgcd(b, a%b);
    return {g, y, x-a/b*y};
}

void solve() {
    ll n, s, k;
    cin >> n >> s >> k;
    auto [g, x, y] = extgcd(k, n);
    if(s%g != 0) {
        cout << -1 << endl;
        return;
    }
    n /= g;
    s /= g;
    k /= g;
    ll ans = ((x*-s)%n+n)%n;
    cout << ans << endl;
}

int main() {
    int t;
    cin >> t;
    rep(i,t) solve();
    return 0;
}

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

inline ll read()
{
	ll f=1,x=0;char s=getchar();
	while(s<'0'||s>'9')
	{
		if(s=='-') f=-1;
		s=getchar();
	}
	while(s>='0'&&s<='9')
	{
		x=x*10+s-48;
		s=getchar();
	}
	return f*x;
}

ll exgcd(ll a,ll b,ll &x,ll &y)
{
	if(!b)
	{
		x=1,y=0;
		return a;
	}
	ll ans=exgcd(b,a%b,y,x);
	y-=a/b*x;
	return ans;
}

int main()
{
	int T=read();
	while(T--)
	{
		ll n=read(),s=read(),k=read();
		s=n-s;
		ll x,y;
		ll GCD=exgcd(n,k,x,y);
		if(s%GCD!=0) puts("-1");
		else
		{
			ll res=s/GCD;
			y*=res;
			y=(y%(n/GCD)+(n/GCD))%(n/GCD);
			printf("%lld\n",y);
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define inf (ll)1e18
#define end1 " "
#define ld long double
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define sf(x) sizeof(x)
#define print_double(d, n) cout<<fixed<<setprecision(n)<<d<<end1;

bool dcmp(int x, int y) {
    return x > y;
}

bool acmp(int x, int y) {
    return x < y;
}

bool afcmp(pair<int, int> a, pair<int, int> b) {
    return a.first < b.first;
}

bool dfcmp(pair<int, int> a, pair<int, int> b) {
    return a.first > b.first;
}

bool ascmp(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

bool dscmp(pair<int, int> a, pair<int, int> b) {
    return a.second > b.second;
}

int aabs(int a) {
    return a < 0 ? -a : a;
}

int tmax(int a, int b, int c) {
    return max(max(a, b), c);
}

int tmin(int a, int b, int c) {
    return min(min(a, b), c);
}

bool in_range(int x, int l, int r) {
    return x >= l && x <= r;
}

inline char to_char(int c) {
    if (c >= 10) return c - 10 + 'A';
    return c + '0';
}

bool is_prime(int val) {
    if (val == 2) {
        return true;
    }
    if (val % 2 == 0) {
        return false;
    }
    for (int i = 3; i * i <= val; i += 2) {
        if (val % i == 0) {
            return false;
        }
    }
    return true;
}

int gcd(int a, int b) {
    if (a == 0)
        return b;
    if (b == 0)
        return a;
    if (a == b)
        return a;
    if (a > b)
        return gcd(a - b, b);
    return gcd(a, b - a);
}

string tobase(int num, int base) {
    string ret;
    int div = base;
    while (div < num) {
        div *= base;
    }

    for (div /= base;;) {
        ret += to_char(num / div);
        num = num % div;
        if (div < 2) {
            break;
        }
        div /= base;
    }
    return ret;
}

const int maxN = 3005;
bool finished = false;
int N;
ll a[maxN], pre[maxN], mem[maxN][maxN], idx[maxN][maxN], dp[maxN][maxN], mod = (int) 1e9 + 7;

void reset() {
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        cin >> a[i];
        pre[i] = pre[i - 1] + a[i];
    }
}

void solve(void) {
    reset();
    if (finished) {
        return;
    }
    memset(idx, -1, sf(idx));
    memset(mem, -1, sf(mem));
    for (int i = 0; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            idx[i][j] = mem[j][pre[i] % j]+1;
            mem[j][pre[i] % j] = i;
        }
    }

    dp[0][0] = 1;
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            if (idx[i][j] != 0) {
                dp[i][j] = (dp[idx[i][j]-1][j] + dp[idx[i][j]-1][j - 1]) % mod;
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += dp[N][i];
        ans %= mod;
    }
    cout << ans << endl;
}

void open_file() {
    freopen("pump.in", "r", stdin);
    freopen("pump.out", "w", stdout);
}

int main(void) {
    int T = 1;
    // open_file();
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

#include <iostream>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<string>
#include <cstring>
#include<queue>
#include<set>
#include<stack>
#define MAX_N 100050
#define INF 999999
using namespace std;
typedef long long ll;
ll cnt[300050];
ll a[300050];
ll n;
ll sum;

int  main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int x = 0;
		cin >> x;

		cnt[x+200]++;

	}
	for(int i=-200;i<=200;i++)
		for (int j = -200; j <= 200; j++)
		{
			sum += cnt[i + 200] * cnt[j + 200] * (i - j) * (i - j) ;
		}
	cout << sum / 2;;
}


#include <bits/stdc++.h>
using namespace std;
// BEGIN LIB
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
#define print_grid(x) for(auto &r:x){for(auto &c:r)cout<<c<<" ";cout<<endl;}cout<<endl;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<vector<ll>> grid;
typedef pair<ll, ll> pll;
// END LIB

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

    ll a, b, c; cin>>a>>b>>c;
    c = c%2==1? 1:2;
    ll ta, tb;
    if(c==1){
        ta=a;
        tb=b;
    } else {
        ta = a*a;
        tb = b*b;
    }
    if(ta==tb)  cout << "=" << endl;
    if(ta>tb)  cout << ">" << endl;
    if(ta<tb)  cout << "<" << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,c,b,i;
    cin>>a>>b>>c;
    if(c==1)
    {
        if(a>=b)
        {
            cout<<"Takahashi"<<endl;
            return 0;
        }
        else if(a<b)
        {
            cout<<"Aoki"<<endl;
        }
    }
    else
    {
        if(a<=b)
        {
            cout<<"Aoki"<<endl;
            return 0;
        }
        else cout<<"Takahashi"<<endl;
    }

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define setbits(n) __builtin_popcountll(n)
#define mkunique(a) sort(a.begin(),a.end()); a.resize(unique(a.begin(),a.end())-a.begin());
#define print(s) for(ll u: s) cout<<u<<" "; cout<<"\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;

ll n;

pair<ll,ll> check(vector<ll> fin){
    ll x=0, y=0;
    for(ll i=0;i<fin.size();i++){
        if(fin[i]==1) x++;
        if(fin[i]==2) y++;
        if(fin[i]==3) x=(x+y);
        if(fin[i]==4) y=(x+y);
        //cout<<x<<" "<<y<<"\n";
    }
    return {x,y};
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll TT=clock();

    vector<ll> f(100);
    f[0]=0; f[1]=1;
    for(ll i=2;i<90;i++)
        f[i]=f[i-1]+f[i-2];
    cin>>n;
    ll cur = n;
    vector<ll> ans;
    while(cur){
        auto it = --upper_bound(f.begin(),f.end(),cur);
        ans.pb(it-f.begin());
        cur = cur - *it;
    }
    //print(ans);
    ll mx = ans[0];
    set<ll> s;
    for(ll i=0;i<ans.size();i++){
        ans[i] = mx - ans[i];
        ans[i]++;
        s.insert(ans[i]);
    }
    assert(s.size()==ans.size());
    //print(ans);
    vector<ll> fin;
    ll j=0;
    for(ll i=1;i<mx;i++){
        if(j<ans.size() && ans[j]==i){
            if(i%2) fin.pb(2);
            else fin.pb(1);
            j++;
        }
        if(i%2) fin.pb(3);
        else fin.pb(4);
    }
    pair<ll,ll> v = check(fin);
    bool rev = false;
    if(v.ss == n) rev = true;
    for(ll &u: fin){
        if(rev){
            if(u==1) u=2;
            else if(u==2) u=1;
            else if(u==3) u=4;
            else u=3;
        }
    }
    assert(check(fin).ff == n);
    cout<<fin.size()<<"\n";
    for(ll u: fin)
        cout<<u<<" ";

    cerr<<"\n\nTIME: "<<(long double)(clock()-TT)/CLOCKS_PER_SEC<<" sec\n";
    TT = clock();
    return 0;
}

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

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define done(x) {cout << x << endl;return;}
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;
uniform_int_distribution<int> rng(1,1e9);

//DEBUG FUNCTIONS START
#define cerr cout
void __print(int x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = "; _print(x)
#else
#define deb(x...)
#endif
// DEBUG FUNCTIONS END

const int N = 2e6+5;

void solve(){

	int n;
	cin>>n;
	vi a(n+1), pos(n+1), pre(n+1);
	int mx = 0, ans = 0;
	fr(i,1,n){
		cin>>a[i];
		pre[i] = pre[i-1] + a[i];
		maxi(mx, pre[i]);
		maxi(ans, pos[i-1] + mx);
		pos[i] = pos[i-1] + pre[i];
	}
	cout << ans;

}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

int powm(int a, int b){
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

int divide(int a, int b) {
    return (a % mod) * powm(b % mod, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


#line 1 "/home/siro53/kyo-pro/compro_library/template/template.cpp"
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define FOR(i, a, b) for(int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------
#line 1 "/home/siro53/kyo-pro/compro_library/util/get_time.hpp"
inline double get_time() {
    const double ticks_per_sec = 2500000000;
    uint32_t lo, hi;
    asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
    return (((uint64_t)hi << 32) | lo) / ticks_per_sec;
}

#line 1 "/home/siro53/kyo-pro/compro_library/util/randint.hpp"
struct random_number_generator {
    mt19937 mt;
    random_number_generator():mt(chrono::steady_clock::now().time_since_epoch().count()) {}
    int operator()(int a, int b) {
        uniform_int_distribution<int> dist(a, b - 1);
        return dist(mt);
    }
    int operator()(int b) {
        return (*this)(0, b);
    }
};
#line 4 "main.cpp"

struct P{
    int x, y;
    P(){}
    P(int x, int y):x(x), y(y) {}
};

struct Ad {
    P p1, p2;
    Ad(){}
    Ad(int a, int b, int c, int d):p1(a, b), p2(c, d) {}
    Ad(P p1, P p2):p1(p1), p2(p2) {}
};

random_number_generator rng;
int N;
int x[200], y[200], r[200];
Ad ad[200];

void input() {
    cin >> N;
    REP(i, N) cin >> x[i] >> y[i] >> r[i];
}

void output() {
    REP(i, N) {
        cout << ad[i].p1.x << " " << ad[i].p1.y << " " << ad[i].p2.x << " " << ad[i].p2.y << "\n";
    }
}

void solve() {
    REP(i, N) {
        ad[i] = Ad(x[i], y[i], x[i]+1, y[i]+1);
    }
}

int main() {
    input();
    solve();
    output();
}

#include <bits/stdc++.h>
using namespace std;
#define REP(a,b) for(long long a = 0;a < b;++a)
using ld = long double;
unsigned long xor128() {
  static unsigned long x=time(NULL), y=362436069, z=521288629, w=88675123;
  unsigned long t=(x^(x<<11));
  x=y; y=z; z=w;
  return ( w=(w^(w>>19))^(t^(t>>8)) );
}

typedef struct Sponsor{
    int x;
    int y;
    int area;
} Sponsor;
typedef struct AD{
    int x;
    int y;
    int dx;
    int dy;
    Sponsor sponsor;
} AD;

inline bool check_intersect(AD a,AD b){
    bool ans = (min(a.x,b.x) <= max(a.x,b.x) and max(a.x,b.x) < min(a.x+a.dx,b.x + b.dx));
    ans &= (min(a.y,b.y) <= max(a.y,b.y) and max(a.y,b.y) < min(a.y+a.dy,b.y + b.dy));
    return ans;
}
bool validate(vector<AD> inputs){
    for(int i = 0;i < inputs.size();++i){
        if(inputs[i].x + inputs[i].dx > 10000 or inputs[i].y + inputs[i].dy > 10000) return false;
        for(int q = i+1;q < inputs.size();++q){
            if(check_intersect(inputs[i],inputs[q]) == true) return false;
        }
    }
    return true;
}
ld scoring(vector<AD> inputs,ld border){
    ld ans = 0;
    for(int i = 0;i < inputs.size();++i){
        if(inputs[i].x <= inputs[i].sponsor.x and inputs[i].sponsor.x < inputs[i].x + inputs[i].dx
            and inputs[i].y <= inputs[i].sponsor.y and inputs[i].sponsor.y < inputs[i].y + inputs[i].dy){
                ld real_area = inputs[i].dx * inputs[i].dy;
                ld expected_area = inputs[i].sponsor.area;
                ans += 1.0L - abs(border - pow(1 - min(real_area,expected_area)/max(real_area,expected_area),2.0));
            }else return -1;
    }
    ans /= (ld)inputs.size();
    return ans;
}

int main(){
    int n;
    cin >> n;
    vector<AD> inputs;
    REP(i,n){
        int a,b,c;
        cin >> a >> b >> c;
        inputs.push_back(AD{a,b,1,1,Sponsor{a,b,c}});
    }
    ld now_score = scoring(inputs,0);
    for(int i = 0;i < 3000000;++i){
        int target = xor128() % inputs.size();
        AD tmp = inputs[target];
        int dir = xor128() % 6;
        int step = xor128() % 200 - 100;
        if(i % 20000 != 0){
            if(dir == 0){
                inputs[target].dx += step;
            }else if(dir == 1){
                inputs[target].dy += step;
            }else if(dir == 2){
                inputs[target].x -= step;
                inputs[target].dx += step;
            }else if(dir == 3){
                inputs[target].y -= step;
                inputs[target].dy += step;
            }else if(dir == 4){
                inputs[target].x += step;
            }else if(dir == 5){
                inputs[target].y += step;
            }
        }
        bool ok = true;
        for(int q = 0;q < inputs.size();++q){
            if(q != target and check_intersect(inputs[q],inputs[target]) == true){
                ok = false;
            }
        }
        if(inputs[target].dx <= 0 or inputs[target].dy <= 0 or inputs[target].x < 0 or inputs[target].y < 0) ok = false;
        if(inputs[target].x + inputs[target].dx > 10000 or inputs[target].y + inputs[target].dy > 10000) ok = false;
        ld score = 0;
        int hoge = (ld)(3000000.0 - i) / 300000.0;
        ld prob = hoge / 10.0;
        prob *= prob;
        score = scoring(inputs,prob) + (1.00L - prob);
        if(ok and score >= now_score){
            now_score = score;
        }else{
            inputs[target] = tmp;
        }
    }
    for(int i = 0;i < n;++i){
        cout << inputs[i].x << " " << inputs[i].y << " " << inputs[i].x + inputs[i].dx << " " << inputs[i].y + inputs[i].dy << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  int ans = 0;
  for(int l = 0;l < n;l++){
    int x = a[l];
    for(int r = l;r < n;r++){
      x = min(x,a[r]);
      ans = max(ans,x*(r-l+1));
    }
  }
  cout << ans << endl;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using vt = vector<T>;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define EACH(x, a) for (auto& x: a)
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))
const double pi = 4 * atan(1);
using ll = long long;
using pll = pair<ll, ll>;

mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

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

template<class ForwardIterator> void print_vec(ForwardIterator first,
		ForwardIterator last, string sep = " ", string end = "\n") {
	bool ft = true;
	while (first != last) {
		if (!ft) {cout << sep;} else {ft = false;}
		cout << (*first);
		++first;
	}
	cout << end;
}

template<typename T1, typename T2>
std::ostream& operator<<(std::ostream &o, const pair<T1, T2> &p) {
	return o << p.F << " " << p.S;
}

inline ll floorDiv(ll x, ll y) {
	ll d = x / y;
	ll r = x % y;
	return r ? (d - ((x < 0) ^ (y < 0))) : d;
}

ll ceilDiv(ll x, ll y) {
	return -floorDiv(-x, y);
}

ll bin_search(ll lo, ll hi, function<bool(ll)> predicate) {
	int sign = lo <= hi ? 1 : -1;
	lo *= sign;
	hi *= sign;
	hi++;
	while (lo < hi) {
		ll mid = lo + floorDiv(hi-lo, 2);
		if (!predicate(sign * mid)) {
			lo = mid + 1;
		} else {
			hi = mid;
		}
	}
	return sign * lo;
}
const ll MOD = 1000000007;
const int MAXN = 10005;

int n;
ll num[MAXN];

//Max histogram area from geeksforgeeks
//https://www.geeksforgeeks.org/largest-rectangle-under-histogram/
ll getMaxArea() {

    stack<ll> s;

    ll max_area = 0;
    int tp;
    ll area_with_top;

    int i = 0;
    while (i < n)
    {

        if (s.empty() || num[s.top()] <= num[i])
            s.push(i++);

        else
        {
            tp = s.top();
            s.pop();

            area_with_top = num[tp] * (s.empty() ? i :
                                   i - s.top() - 1);

            if (max_area < area_with_top)
                max_area = area_with_top;
        }
    }

    while (s.empty() == false)
    {
        tp = s.top();
        s.pop();
        area_with_top = num[tp] * (s.empty() ? i :
                                i - s.top() - 1);

        if (max_area < area_with_top)
            max_area = area_with_top;
    }

    return max_area;
}

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

	cin >> n;

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

	cout << getMaxArea() << "\n";

}


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

int main(){
  int N, X;
  char S;
  int cnt;

  cin>>N>>X;
  cnt = X;

  for (int i=0; i<N; i++){
    cin>>S;
    if (S == 'o') cnt += 1;
    else{
      if (cnt>0) cnt -= 1;
    }
  }
  cout << cnt << endl;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>
#include<string>
#include<bitset>

using namespace std;

#define rep(i,N) for(ll i=0;i<N;i++) //0から

typedef long long ll;

ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    //a>=b
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

ll modexp(ll x, ll a, ll m){ //x^a mod m
    ll ret = 1;
    while (a > 0) {
        if (a & 1) ret = ret * x % m;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x = x * x % m;
        a >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

ll modinv(ll a, ll m){ //a^{-1} mod m
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
    }
    u=(u+m)%m;
    return u;
}

ll nCr(ll n, ll r) {
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

double pi=3.14159265358979323846;

//next_purmitation!!!!!!!!!!!!!
//https://atcoder.jp/contests/abc198/tasks/abc198_d
//cout<<fixed<<setprecision(18);
int main(){
    ll n;
    cin>>n;
    ll ans=1;
    for(ll i=1;i<=11;i++){
        ans*=n-i;
        ans/=i;
    }
    cout<<ans<<endl;

    return 0;
}


#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int MOD2 = 998'244'353;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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

int main(){
    long double A, B; std::cin >> A >> B;
    std::cout << std::fixed << std::setprecision(10) << (A - B) / A * 100 << std::endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pc cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
int mod = 1000000000 + 7;
bool cmp(const pair<int,int> &a,const pair<int,int> &b)
{
       return max(a.second,a.first)<max(b.second,b.first);
}
int Q(int l,int r){
    cout<<"? "<<l<<" "<<r<<endl;
    int sum;
    cin>>sum;
    return sum;
}
void solve()
{
    int i, j, m,k;
    int n;
    cin>>n;
    cout<<(n+100-1)/100<<endl;

}

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    while (t--)
    {
        // int k,n,i,j,m;
        //  cin>>n;
        solve();
    }
    pc;
    return 0;
}


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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int MOD=998244353;

signed main(void)
{
	IOS;
	int n,k; cin>>n>>k;
	int vv[2*n+1]={};
	for(int i = 2; i <= 2*n; i++) {
		int lo=max(1ll,i-n);
		int hi = i-lo;
		vv[i] = hi-lo+1;
	}
	// for(int i = 2; i<=2*n; i++)
	// 	cout<<vv[i]<<" ";
	// cout<<endl;
	int ans=0;
	for(int i = 2; i <= 2*n; i++) {
		int s = i-k;
		if(s<2 || s > 2*n)
			continue;
		ans += vv[s]*vv[i];
		// ans %= MOD;
	}
	cout<<ans<<endl;
	return 0;
}

#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/rational.hpp>

// using bigint = boost::multiprecision::cpp_int;
// using fraction = boost::rational<bigint>;
using namespace std;

#define pb push_back
#define eb emplace_back
#define unused [[maybe_unused]]
#define tempT template<class T>
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl
#define ans_exit(x) { cout << x << endl; exit(0); }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (ll i = (ll)(n); i < (ll)(m); i++)

using ll   unused = long long;
using ld   unused = long double;
using vl   unused = vector<ll>;
using vvl  unused = vector<vl>;
using vvvl unused = vector<vvl>;
using lp   unused = pair<ll, ll>;
using lmap unused = map<int, int>;

unused constexpr ll MOD = 1e9 + 7;
unused constexpr ll INF = 1 << 30;
unused constexpr ll LINF = 1LL << 62;
unused constexpr int DX[8] = {0, 1, 0,-1, 1, 1,-1,-1};
unused constexpr int DY[8] = {1, 0,-1, 0, 1,-1, 1,-1};
unused inline bool bit(ll b, ll i) { return b & (1LL << i); }
unused inline ll ceiv(ll a, ll b) { return (a + b - 1) / b; }
unused inline ll mod(ll a, ll m = MOD) { return (a % m + m) % m; }
unused inline ll floordiv(ll a, ll b) { return a / b - (a < 0 && a % b); }
unused inline ll ceildiv(ll a, ll b) { return floordiv(a + b - 1, b); }
tempT unused inline bool in_range(T a, T x, T b) { return a <= x && x < b; }
unused inline bool in_range(ll x, ll b) { return in_range(0LL, x, b); }
tempT unused bool chmin(T &a, T b) { if(a > b) {a = b; return 1;} return 0; }
tempT unused bool chmax(T &a, T b) { if(a < b) {a = b; return 1;} return 0; }

int main() {
    ll n, m;
    cin >> n >> m;

    vl a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];

    vvl dp(n+1, vl(m+1, LINF));

    rep(i, n + 1) dp[i][0] = i;
    rep(j, m + 1) dp[0][j] = j;

    rep(i, n) {
        rep(j, m) {
            if(a[i] == b[j]) {
                chmin(dp[i+1][j+1], dp[i][j]);
            } else {
                chmin(dp[i+1][j+1], min(dp[i+1][j], dp[i][j+1]) + 1);
                chmin(dp[i+1][j+1], dp[i][j] + 1);
            }
        }
    }

    cout << dp[n][m] << endl;
}


// ABC180-E
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <typename T>
T TSP(int s, vector<vector<pair<int, T>>>& G, const T INF = 1e9) {
    int V = G.size();
    vector<vector<T>> dp(1 << V, vector<T>(V, INF));
    dp[0][s] = 0;
    for (int bit = 0; bit < 1 << V; bit++) {
        for (int v = 0; v < V; v++) {
            for (auto p : G[v]) {
                int to = p.first, dist = p.second;
                if (bit & 1 << to) continue;
                dp[bit | 1 << to][to] =
                    min(dp[bit | 1 << to][to], dp[bit][v] + dist);
            }
        }
    }
    return dp[(1 << V) - 1][s];
}

signed main() {
    int n;
    cin >> n;
    int x[n], y[n], z[n];
    rep(i, n) {
        cin >> x[i] >> y[i] >> z[i];
    }
    vector<vector<pair<int, ll>>> G(n);
    rep(i, n) {
        rep(j, n) {
            G[i].emplace_back(
                j, abs(x[i] - x[j]) + abs(y[i] - y[j]) + max(0, z[j] - z[i]));
        }
    }
    cout << TSP(0, G, LINF) << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define io ios::sync_with_stdio(false); cin.tie(0)

void print_vec(const vector<int>& vec) {
    int n = vec.size();
    rep(i, n) {
        cout << vec[i];
        if (i != n-1) cout << " ";
    }
    cout << endl;
}

int main()
{
    io;
    int n; cin >> n;
    vector<int> a(n), b(n);
    vector<vector<int>> c(n, vector<int>(n, 0));
    rep(i, n) rep(j, n) {
        cin >> c[i][j];
    }

    b = c[0];
    a[0] = 0;
    bool flag = true;

    for (int i = 1; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            int diff = c[i][0] - c[0][0];
            if (c[i][j] - c[0][j] != diff) {
                flag = false;
                break;
            }
            a[i] = diff;
        }
    }

    int mn = *min_element(a.begin(), a.end());
    if (mn < 0) {
        rep(i, n) {
            a[i] -= mn;
            b[i] += mn;
            if (b[i] < 0) {
                flag = false;
                break;
            }
        }
    }

    if (flag) {
        cout << "Yes" << endl;
        print_vec(a);
        print_vec(b);
    } else cout << "No" << endl;

    return 0;
}


#include<algorithm>
#include<cstdio>
using namespace std;
int n,m;
int main()
{
  scanf("%d",&n);
  printf("6 10 15 ");m=3;
  for (int i=16;i<=10000&&m<n;i++){
    int cnt=0;
    if (i%2==0)cnt++;
    if (i%3==0)cnt++;
    if (i%5==0)cnt++;
    if (cnt>=2){m++;printf("%d ",i);}
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T,class U>
inline bool chmax(T &a,U b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}
template<class T,class U>
inline bool chmin(T &a,U b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}
constexpr int INF=1000000000;
constexpr ll llINF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
/*
vector<vector<ll>>C,sC;
void init_comb(int n,int m){
    C.resize(n+1,vector<ll>(m+1,0));
    sC.resize(n+1,vector<ll>(m+1,0));
    C[0][0]=1;
    for(int i=1;i<=n;i++){
        C[i][0]=1;
        for(int j=1;j<=m;j++){
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    rep(i,n+1){
        rep(j,m){
            sC[i][j+1]=(sC[i][j]+C[i][j])%mod;
        }
    }
}*/
ll gcd(ll a,ll b){
    while(a%b){
        a%=b;
        swap(a,b);
    }
    return b;
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>primes;
void init_prime(int n){
    primes.push_back(2);
    for(int i=3;i<=n;i+=2){
        bool f=true;
        for(int j:primes){
            if(j*j>i)break;
            if(i%j==0){
                f=false;
                break;
            }
        }
        if(f)primes.push_back(i);
    }
}
ll modpow(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1){
            res*=a;
            res%=mod;
        }
        a*=a;
        a%=mod;
        b>>=1;
    }
    return res;
}
vector<ll>inv,fact,factinv;
void init_fact(int n){
    inv.resize(n+1);
    fact.resize(n+1);
    factinv.resize(n+1);
    inv[0]=0;
    inv[1]=1;
    fact[0]=1;
    factinv[0]=1;
    for(ll i=1;i<=n;i++){
        if(i>=2)inv[i]=mod-((mod/i)*inv[mod%i]%mod);
        fact[i]=(fact[i-1]*i)%mod;
        factinv[i]=factinv[i-1]*inv[i]%mod;
    }
}
ll _inv(ll a,ll m=mod){
    //gcd(a,m) must be 1
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b;swap(a,b);
        u-=t*v;swap(u,v);
    }
    u%=m;
    if(u<0)u+=m;
    return u;
}
ll comb(int a,int b){
    if(a<b)return 0;
    if(a<0)return 0;
    return fact[a]*factinv[a-b]%mod*factinv[b]%mod;
}
ll multicomb(int a,int b){
    return comb(a+b-1,b);
}
void solve(){
    int n;
    cin>>n;
    if(n==3){
        cout<<"6 10 15"<<endl;
        return;
    }
    vector<int>v{6,10,12,15,18,20,24,30};
    rep(i,n){
        cout<<(i/8)*30+v[i%8]<<" ";
    }
    cout<<endl;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <tuple>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <map>
#include <numeric>
#include <cassert>
#include <string>
#include <list>

using ull = unsigned long long;
using ll = long long;

#define REP(i, n) for(ll i=0;i<(ll)n;i++)
#define REPab(i,a,b)for(ll i=(ll)a;i<(ll)b;i++)
constexpr bool bitp(ull bits, ull pos) { return bits & (1ULL << pos); }
constexpr ll mod(ll val, ll m) { return (val >= 0) ? (val % m) : (val % m + m); }
template <class T> void chmin(T& a, T b) { a = std::min(a, b); }
template <class T> void chmax(T& a, T b) { a = std::max(a, b); }
ll extgcd(const ll a, const ll b, ll& x, ll& y) {ll d = a;if (b != 0) { d = extgcd(b, a % b, y, x);y -= (a / b) * x;} else { x = 1; y = 0; } return d;}

int main() {
    ll N, M;
    std::cin >> N >> M;
    std::vector<std::vector<ll>> edges(N);
    REP(i, M) {
        ll a, b;
        std::cin >> a >> b;
        edges[a - 1].push_back(b - 1);
    }
    ll sum = 0;
    REP(i, N) {
        std::vector<bool> visited(N, false);
        const auto search = [&](auto&& search, ll node) -> void {
            for (const auto& edge : edges[node]) {
                if (!visited[edge]) {
                    visited[edge] = true;
                    sum++;
                    search(search, edge);
                }
            }
        };
        visited[i] = true;
        sum++;
        search(search, i);
    }
    std::cout << sum << std::endl;
}

#include <bits/stdc++.h>
using namespace std;
const int MAXN=2000;
vector<vector<int>> g;
bool temp[MAXN];
void dfs(int v){
	if(temp[v]) return;
	temp[v]=1;
	for(auto vv:g[v]) dfs(vv);
	return;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int n,m;
	cin>>n>>m;
	g.resize(n);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		g[a-1].push_back(b-1);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++) temp[j]=0;
		dfs(i);
		for(int j=0;j<n;j++)
		if(temp[j]) ans++;
	}
	cout<<ans;
	return 0;
}