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

int main(){
  int N;
  cin >> N;
  int cnt = 0;
  int tmp1 = 0;
  int tmp2 = 0;
  int tmp3 = 0;
  while(tmp1 <= 10000){
    tmp1 += 6;
    if((tmp1 % 5 != 0)&&(tmp1 <= 10000)){
      cout << tmp1 << " ";
      cnt++;
      if(cnt == N) break;
    }
    tmp2 += 10;
    if((tmp2 % 3 != 0)&&(tmp2 <= 10000)){
      cout << tmp2 << " ";
      cnt++;
      if(cnt == N) break;
    }
    tmp3 += 15;
    if(tmp3 <= 10000){
      cout << tmp3 << " ";
      cnt++;
      if(cnt == N) break;
    }
  }
  cout << endl;
}

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> Pair;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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;}

struct SieveEratosthenes{
    vector<int> min_fact;

    SieveEratosthenes(int N){
        _build(N);
    }

    void _build(int N){
        min_fact.resize(N+1);
        for(int i=0; i<=N; i++) min_fact[i] = i;

        min_fact[0] = min_fact[1] = -1;

        for(int i=2; i*i<=N; i++){
            for(int j=i*i; j<=N; j+=i){
                if(i < min_fact[j])
                    min_fact[j] = i;
            }
        }
    }

    bool is_prime(int x){
        return min_fact[x] == x;
    }

    vector<pair<int,int>> factorize(int x){
        vector<pair<int,int>> ret;
        while(x>1){
            if(ret.empty() || ret.back().first != min_fact[x])
                ret.emplace_back(min_fact[x], 1);
            else
                ret.back().second++;

            x /= min_fact[x];
        }

        return ret;
    }
};

vector<long long> make_divisors(long long n){
    vector<long long> divisors;
    for(long long i=1; i*i<=n; i++){
        if(n%i == 0){
            divisors.push_back(i);
            if(i*i != n) divisors.push_back(n/i);
        }
    }
    // sort(divisors.begin(), divisors.end());
    return divisors;
}

int f(int x, int p){
    int ret = 0;
    while(x%p == 0){
        ret++;
        x /= p;
    }
    return ret;
}

void Main(){
    int N; cin >> N;
    if(N==3){
        cout << "84 105 10" << en;
        return;
    }
    VI cand;
    FOR(i,1,10001){
        int n2=f(i,2),n3=f(i,3),n5=f(i,5);
        int c = 0; if(n2==0) c++;
        if(n3==0) c++;
        if(n5==0) c++;

        if(c<=1) cand.push_back(i);
    }

    VI A;
    REP(i,N) A.push_back(cand[i]);
    REP(i,N) cout << A[i] << " \n"[i==N-1];
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    while(t--) Main();
    return 0;
}


// kid_kb //

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long int
#define lower(str) transform(str.begin(),str.end(),str.begin(),::tolower);
#define upper(str) transform(str.begin(),str.end(),str.begin(),::toupper);
#define mod 1000000007
#define SORT(vec) sort(vec.begin(),vec.end());
#define pb push_back
#define csb __builtin_popcount
#define msb(n) (ll)(log2(n))
#define DIG(n) floor(log10(n))+1
#define kb ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ptr(arr) for(auto i:arr)cout<<i<<" ";
#define ptr2(vec) for(auto i:vec){for(auto j: i){cout<<j<<" ";}cout<<endl;}
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,n,a) for (int i=n-1;i>=a;i--)
#define mem(a,val) memset(a,val,sizeof(a))
#define INF INT_MAX
#define inf INT_MIN

// cout<<fixed<<setprecision(8)<<endl;

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

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

ll fastpower(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=fastpower(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}

ll modInverse(ll a, ll m) { return fastpower(a, m-2, m); }

//----------------------------------------Let's Fight-----------------------------------------------------------------

void solve(){
    ll n;
    cin>>n;
    vector<ll>v(n);
    rep(i,0,n)cin>>v[i];

    ll ans=v[0];
    rep(i,1,n){
        ans=gcd(ans,v[i]);
    }
    cout<<ans<<endl;

}

int main()
{
    kb
//  clock_t tStart = clock();
    ll t;
    t=1;
//    cin>>t;
    while(t--){
        solve();
    }
 // printf("%.2fs time lga\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}

#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int a[200000],b[200000];
int main() {
    int i;
    int N;
    scanf("%d",&N);
    for (i = 0; i < N; i++) scanf("%d",&a[i]);
    for (i = 0; i < N; i++) scanf("%d",&b[i]);

    LLI c = 0;
    int maxa = 0;
    for (i = 0; i < N; i++) {
        maxa = max(maxa,a[i]);
        c = max(c,(LLI) b[i]*maxa);
        printf("%lld\n",c);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define rsort(a) {sort(all(a));reverse(all(a));}
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),(k))-v.begin())
#define ub(v,k) (upper_bound(all(v),(k))-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
vi u,k;
vi dijkstra(int from,vvp g){
    vi dis(g.size(),inf);
    dis[from]=0;
    SPQ(P) pq;
    pq.push(P(0,from));
    while(!pq.empty()){
        auto t=pq.top();pq.pop();
        if(t.fi!=dis[t.se])continue;
        for(auto x:g[t.se]){
            ll cost=t.fi;
            if(t.fi%u[x.se])cost+=u[x.se]-t.fi%u[x.se];
            cost+=k[x.se];
            if(chmin(dis[x.fi],cost))pq.push(P(dis[x.fi],x.fi));
        }
    }
    return dis;
}
int main(){
    ll n,x;cin>>n>>x;
    vi v(n);rep(i,n)cin>>v[i];
    ll ans=inf;
    REP(s,1,n+1){
        vvi dp(s,vi(n+1,-inf));dp[0][0]=0;
        rep(i,n){
            vvi ndp=dp;
            rep(j,s)rep(k,n)if(dp[j][k]!=-inf){
                ll nj=(j+v[i])%s;
                chmax(ndp[nj][k+1],dp[j][k]+v[i]);
            }
            dp=ndp;
        }
        ll k=dp[x%s][s];
        if(k!=-inf)chmin(ans,(x-k)/s);
    }
    out(ans);
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n; ll x;
    cin >> n >> x;
    vector<int> a(n);
    for (auto &&i : a) scanf("%d", &i);
    ll ans = INF<ll>;
    for (int i = 1; i <= n; ++i) {
        auto dp = make_v(i+1, i, -INF<ll>);
        dp[0][0] = 0;
        for (int j = 0; j < n; ++j) {
            for (int k = i-1; k >= 0; --k) {
                for (int l = 0; l < i; ++l) {
                    if(dp[k][l] != -INF<ll>) chmax(dp[k+1][(l+a[j])%i], dp[k][l]+a[j]);
                }
            }
        }
        if(dp[i][x%i] != -INF<ll>) ans = min(ans, (x-dp[i][x%i])/i);
    }
    cout << ans << "\n";
    return 0;
}


       /****************#####       بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم       #####********************

        *********************       Saidur  Rahman        *************************
        *********************       CityU--CSE--47        *************************

--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------*/

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

#define         endl                "\n"
#define         EPS                 1e-6
#define         F                   first
#define         sf                  scanf
#define         pf                  printf
#define         S                   second
#define         done                return 0
#define         MP                  make_pair
#define         pb                  push_back
#define         start               int main()
#define         PI                  acos(-1.0)
#define         NO                  cout<<"NO\n"
#define         No                  cout<<"No\n"
#define         no                  cout<<"no\n"
#define         YES                 cout<<"YES\n"
#define         Yes                 cout<<"Yes\n"
#define         yes                 cout<<"yes\n"
#define         sz(x)               int(x.size())
#define         all(a)              a.begin(),a.end()
#define         srt(x)              sort(x.begin(),x.end())
#define         clock_start         clock_t tStart = clock()
#define         MEM(a, b)           memset(a, (b), sizeof(a))
#define         dbg(x)              cout << (#x) << " = " << (x) << endl
#define         Fast                ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define         dbg2(x, y)          cout << #x << " = " << x << " " << #y << " = " << y << endl
#define         dbg3(x, y, z)       cout << #x << " = " << x << " " << #y << " = " << y << " " << #z << " = " << z << endl
#define         show_time           cout<<"\n\nTime Taken: "<<fixed<<setprecision(3)<<(double)(clock() - tStart) /  CLOCKS_PER_SEC<<"s"

                     /****** Template of some bit operations *****/

long long     SetBit    (long long n, long long X)    { return n | (1LL << X); }//X-1 tomo bit 0 hole 1 korbe, 1 hole unchange
long long     ClearBit  (long long n, long long X)    { return n & ~(1LL << X); }//X-1 tomo bit 1 hole 0 korbe, 0 hole unchange
long long     ToggleBit (long long n, long long X)    { return n ^ (1LL << X); }//X-1 tomo bit 1 hole 0 korbe r 0 hole 1
bool          CheckBit  (long long n, long long X)    { return (bool)(n & (1LL << X)); }//X-1 tomo bit 1 naki 0 bolbe

            ///////////////////////////////////////////////////////////////////////////
        ///////////////////////// DO NOT TOUCH BEFORE THIS LINE //////////////////////////
            //////////////////////////////////////////////////////////////////////////

typedef     long long   ll;
const       int MAX  = 1e5 + 5;
const       int MOD  = 1e9 + 7;
const       int INF  = 1e9;
const       ll LINF  = 1e18;

start
{
    Fast;

#ifndef ONLINE_JUDGE
    clock_start;
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    char c;
    map<char, int> m;
    for (int i = 0; i < 3;i++){
        cin >> c;
        m[c]++;
    }
    if(sz(m)==1)
        cout << "Won" << endl;
    else
        cout << "Lost" << endl;

#ifndef ONLINE_JUDGE
    show_time;
#endif

    done;
}

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = l; i < (int)(r); i++)
#define all(vec) vec.begin(), vec.end()
#define allr(vec) vec.rbegin(), vec.rend()
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;
}

using ll = long long;

using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vi = vector<int>;
using vll = vector<ll>;

int calc(int x) {
  int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  return res;
}

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

  string C;
  cin >> C;

  cout << (C[0]==C[1] && C[1]==C[2] ? "Won\n" : "Lost\n");

  return 0;
}


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

int main() {
	long long n,m,i,j,cur,res,mod=1000000007;
	cin >> n;
	vector<long long> fib(88);
	fib[0]=1; fib[1]=1;
	for(i=2; i<88; i++){
		fib[i]=fib[i-1]+fib[i-2];
		//cout << i << ' ' << fib[i] << endl;
	}
	cur=n; res=0;
	vector<long long> ans(0);
	for(i=87; i>=0; i--){
		if(cur>=fib[i]){
			ans.push_back(i);
			cur-=fib[i];
			res=max(res,i);
		}

	}
	//cout << res+1 << endl;
	j=0;
	vector<long long> ans2(0);
	for(i=res; i>0; i--){
		if(j<ans.size() && ans[j]==i){
			ans2.push_back(ans[j]%2+1);
			j++;
		}
		ans2.push_back(2-i%2+2);
	}
	cout << ans2.size() << endl;
	for(i=0; i<ans2.size(); i++){
		cout << ans2[i] << endl;
	}
	return 0;
}

/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;
#define      mxx                 LLONG_MAX
#define      mnn                 LLONG_MIN
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      Ceil(x,y)           ((x+y-1)/y)
#define      sz(s)               (int)s.size()
#define      angle(x)            double(x * acos(-1) / 180.0)
#define      max_3(a,b,c)        max(a, max(b,c))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      all(v)              v.begin(),v.end()
#define      SORT(v)             sort(v.begin(),v.end())
#define      SRV(v)              sort(v.rbegin(),v.rend())
#define      REV(v)              reverse(v.begin(),v.end())
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      MP                  make_pair
#define      flash               cout.flush()
#define      InTheNameOfGod      ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
constexpr ll MOD = 998244353;
constexpr ll mod = 1e9  + 7;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cerr<<a<<endl;
#define bug2(a,b)  cerr<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cerr<<a<<" "<<b<<" "<<c<<endl;
/*----*/
const ll N=3e5+5;
vector<ll> adj[N];
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
ll nsum(ll num){return (num*(num+1))/2;}
void edge (ll u,ll v) {adj[u].PSB(v) ;adj[v].PSB(u);}
/*------------------START---------------------*/

/*-----*/
void solve(){
   ll n;
   string s;
   cin>>n;
   for(ll i=1;i<=38;i++){
    ll bal=power(3,i);
    ll baki=n-bal;
    ll k=1;
    while(1){
        ll dhon=power(5,k);
        if(dhon==baki){
            cout<<i<<' '<<k<<endl;
            return;
        }
        if(dhon>baki) break;
        k++;
    }
   }
   cout<<"-1"<<endl;

}
/*-----*/
int main(){
   InTheNameOfGod

   ll Test=1;
   //cin>>Test;
   while(Test--){
     solve();
    }
  loser;
}
///////   C O D I N G  I S  L I F E   ///////


#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#include <unordered_map>
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for(ll i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define spre cout<<fixed<<setprecision(10);
typedef long long int ll;
using namespace std;
// ll mod=67280421310721;
// ll mod=8589934592;
const ll mod=985661441;
ll INF=1e18;
ll po(ll a,ll b){
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
ll in[1000005];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("INPUT.txt", "r", stdin);
    freopen("OUTPUT.txt", "w", stdout);
    #endif
	ll test=1;
	// cin>>test;
	// spre
	while(test--)
	{
		long double a,b,w;
		cin>>a>>b>>w;
		w*=1000;
		int r=floor(w/a);
		int l=ceil(w/b);
		// cout<<l<<' '<<r;
		if(l>r)
		{
			cout<<"UNSATISFIABLE";
		}
		else
		{
			cout<<l<<' '<<r;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#define f(i,a,b) for(ll  i = a; i < (ll) b ; i++ )
#define af(i,a,b) for(ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll  i = a; i < (ll) b ; i+= k )
#define arep(i,a,b,k) for(ll i = a; i >= (ll) b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define sz(a) (ll) a.size()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller   ios::sync_with_stdio(false);cin.tie(0)

// policy-based

using namespace std;

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

const ll MAX = 2e5 + 20;
const ll mod = 998244353;
const ll inf = 1e13;

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

ll fac[MAX],inv_fac[MAX];

ll comb(ll n,ll k){
	return mul(fac[n],mul(inv_fac[n-k],inv_fac[k]));
}

ll bp(ll a,ll e){
	if(e == 0) return 1;
	if(e&1) return mul(bp(a,e-1),a)%mod;
	ll x = bp(a,e>>1);
	return (x*x)%mod;
}

int main(){
	fastio;
	fac[0] = inv_fac[0] = inv_fac[1] =  1;
	f(i,1,MAX) fac[i] = mul(fac[i-1],i);
	f(i,2,MAX) inv_fac[i] = mod - (mod/i) * inv_fac[mod%i] % mod;
	ll n,m,k;
	cin >> n >> m >> k;
	if(n == 1 && m == 1){
		cout << k << endl;
		return 0;
	}
	if(n == 1){
		cout << bp(k,m) << endl;
		return 0;
	}
	else if(m == 1){
		cout << bp(k,n) << endl;
		return 0;
	}
	ll ans = 0;
	f(i,1,k+1){
	//	cout << bp(i,n-1) << " " << bp(k-i+1,m) << endl;
		(ans += mul( (bp(i,n) - bp(i-1,n)+ mod)%mod,bp(k-i+1,m) ) )%=mod;
	}
	cout << ans << endl;
	return 0;
}


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

vector<ll> b,bb;

ll sm(int id){
  ll res = 0;
  rep(i,id/1000) res+=bb[i];
  for(int i=id/1000*1000;i<id;i++) res+=b[i];
  return res;
}

int main(){
  ll H,W,M;
  cin >> H >> W >> M;
  vector<pair<ll,ll>> XY(M);
  rep(i,M) {
    cin >> XY[i].first >> XY[i].second;
    XY[i].first--;
    XY[i].second--;
  }
  vector<vector<ll>> A(W);
  rep(i,M){
    A[XY[i].second].pb(XY[i].first);
  }
  rep(i,W) sort(all(A[i]));
  ll ans = 0;
  b.assign(W,0);
  bb.assign((W+999)/1000,0);
  rep(i,W){
    if(A[i].empty()){
      ans += H;
    }
    else if(A[i][0]!=0){
      ans += A[i][0];
    }
    else break;
    //cout << ans << endl;
  }
  vector<vector<ll>> B(H);
  rep(i,M){
    B[XY[i].first].pb(XY[i].second);
  }
  rep(i,H) sort(all(B[i]));
  rep(i,H){
    if(!B[i].empty() && B[i][0]==0) break;
    ll x=W;
    if(!B[i].empty()) x=B[i][0];
    //cout << "x:"<<x << endl;
    rep(j,sz(B[i])){
      int k=B[i][j];
      if(b[k]==0){
        b[k]++;
        bb[k/1000]++;
      }
    }
    if(i==0){
      if(B[i].empty()){}
      else{
        int k=B[i][0];
        for(int kk=k;kk<W;kk++){
          if(b[kk]==0){
            b[kk]++;
            bb[kk/1000]++;
          }
        }
      }
    }
    ans += (sm(x));
    //cout << ans << endl;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fir first
#define sec second
#define pii pair<int, int>
#define pll pair<ll, ll>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
using namespace std;
int dx[4]={0, 1, 0, -1}, dy[4]={1, 0, -1 , 0};
const int mxN=200010;
const int mxM=1000010;
const ll MOD=1000000007;
const ll INF=100000000000001;
int H, W, M;
int X[mxN], Y[mxN];
vector <int> seg[4*mxN];
ll ans;
void init(int idx, int s, int e)
{
    if(s==e)
    {
        seg[idx].push_back(Y[s]);
        return;
    }
    int mid=(s+e)/2;
    init(2*idx, s, mid);
    init(2*idx+1, mid+1, e);
    int lcur=0, rcur=0;
    while(lcur!=mid-s+1 && rcur!=e-mid)
    {
        if(seg[2*idx][lcur]<seg[2*idx+1][rcur])
        {
            seg[idx].push_back(seg[2*idx][lcur]);
            lcur++;
        }
        else
        {
            seg[idx].push_back(seg[2*idx+1][rcur]);
            rcur++;
        }
    }
    while(lcur!=mid-s+1)
    {
        seg[idx].push_back(seg[2*idx][lcur]);
        lcur++;
    }
    while(rcur!=e-mid)
    {
        seg[idx].push_back(seg[2*idx+1][rcur]);
        rcur++;
    }
}
int solv(int idx, int s, int e, int str, int fin, int val)
{
    if(e<str || fin<s)  return 0;
    if(str<=s && e<=fin)
    {
        int sma = lower_bound(seg[idx].begin(), seg[idx].end(), val)-seg[idx].begin();
        return e-s+1-sma;
    }
    int mid=(s+e)/2;
    return solv(2*idx, s, mid, str, fin, val)+solv(2*idx+1, mid+1, e, str, fin, val);
}
int main()
{
    gibon
    cin >> H >> W >> M;
    for(int i=0;i<H;i++)    X[i]=W;
    for(int i=0;i<W;i++)    Y[i]=H;
    for(int i=0;i<M;i++)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        X[a]=min(X[a], b);
        Y[b]=min(Y[b], a);
    }
    int minx=X[0], miny=Y[0];
    for(int i=0;i<Y[0];i++) ans+=X[i];
    for(int i=0;i<X[0];i++) ans+=Y[i];
    init(1, 0, X[0]-1);
    for(int i=0;i<Y[0];i++)
    {
        ans-=solv(1, 0, X[0]-1, 0, X[i]-1, i+1);
    }
    cout << ans;
}


#include<iostream>
#include<math.h>
#include<string>
#include<sstream>
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
int main()
{
	int n;

	cin>>n;

	double value=n*1.08;

	if(floor(value)<206)
	{
		cout<<"Yay!"<<"\n";
	}
	else if(floor(value)>206)
	{
		cout<<":("<<"\n";
	}
	else if(floor(value)==206){
		cout<<"so-so"<<"\n";
	}

}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
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;
}
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 T>
istream& operator>>(istream& is, vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << ' ';
    }
    return os;
}
int main() {
    int n;
    cin >> n;
    n *= 108;
    n /= 100;
    cout << (n < 206 ? "Yay!\n" : n == 206 ? "so-so\n" : ":(\n");
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,a[3]={-1,-1,-1};
	cin>>x>>y;
	a[x]++;
	a[y]++;
	if(x==y)
	{
		cout<<x;
		return 0;
	}
	for(int i=0;i<3;i++)
	{
		if(a[i]==-1) cout<<i;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
template <class T = ll> using P = pair<T,T>;
template <class T = ll> using V = vector<T>;
template <class T = ll> using VV = V<V<T>>;
#define rep(i,n) for(int i=0; i<(n);++i)
#define repp(i, l, r) for(int i = (l); i < (r); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()

int main()
{
    V<int> a(3);
    rep(i,3) cin >> a[i];
    sort(a.begin(), a.end());
    if(a[1] - a[0] == a[2] - a[1]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

using ll = long long int;
struct Sum {
  ll a;
  ll b;
  ll s;
};

int main() {
  int n;
  cin >> n;
  vector<Sum> s(n);
  ll sumA = 0, sumT = 0;
  for(int i=0; i<n; i++) {
    ll a, b;
    cin >> a >> b;
    sumA += a;
    sumT += b;
    s[i] = Sum{a, b, 2*a + b};
  }
  sort(s.begin(), s.end(), [](Sum a, Sum b) {
    return (a.s == b.s) ? (a.a > b.a) : (a.s > b.s);
  });

  ll ptA = sumA, ptT = 0;
  ll cnt = 0;
  for(auto x : s) {
    ptT += x.s - x.a;
    ptA -= x.a;
    cnt++;
    if(ptT > ptA) break;
  }
  cout << cnt << endl;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n;
    cin >> n;

    ll aoki=0,takahashi=0;
    vector<ll> a(n),b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
        aoki+=a[i];
    }
    vector<ll> c(n);
    rep(i,n) c[i]=2*a[i]+b[i];
    sort(all(c),greater<>());

    int ans=0;
    while(aoki>=takahashi){
        takahashi+=c[ans];
        ans++;
    }
    cout << ans << endl;

    return 0;
}


/**
*    author:
*    created: 15.11.2020 00:24:55
**/

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int INF = 1001001001;
const int di[] = {-1,0,1,0}, dj[] = {0,-1,0,1};
typedef vector<int> vi;
typedef vector<vi> vvi;

#define rep(i,n) for(int i = 0; i < (n); i++)
#define repn(i,n) for(int i = 1; i <= (n); i++)
#define pb push_back
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

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;
}

const double PI = acos(-1);
const int mod = 1000000007;
class mint {
  long long x;
  public:
  mint(long long x=0) : x((x%mod+mod)%mod) {}
  mint operator-() const {
    return mint(-x);
  }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const  mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint& a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint& a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint& a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint& a) const {
    mint res(*this);
    return res/=a;
  }

  friend ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
  }
};
#pragma endregion

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int> (n,0));
  rep(i,n){
    rep(j,n){
      char c;
      cin >> c;
      if(c == '1') a[i][j] = 1;
    }
  }
  rep(i,n) a[i][i] = 1;
  rep(k,n)rep(i,n)rep(j,n) a[i][j] |= a[i][k] & a[k][j];
  double ans = 0;
  rep(i,n){
    int cnt = 0;
    rep(j,n) cnt += a[j][i];
    ans += double(1)/double(cnt);
  }
  cout << fixed << setprecision(10);
  cout << ans << "\n";
  return 0;
}

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

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=600005;
const int INF=0x3f3f3f3f;//1061109567
/*--------------------------------------------------------------------*/
inline int read()
{
	int f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
char st[105];
int dist[105][105];
signed main()
{
	int n=read();
	memset(dist,INF,sizeof dist);
	for (int i=1;i<=n;i++) dist[i][i]=0;
	for (int i=1;i<=n;i++)
	{
		scanf("%s",st+1);
		for (int j=1;j<=n;j++)
			if (st[j]=='1') dist[i][j]=1;
	}
	for (int k=1;k<=n;k++)
		for (int i=1;i<=n;i++)
			for (int j=1;j<=n;j++) upmin(dist[i][j],dist[i][k]+dist[k][j]);
	lod ans=0;
	for (int i=1;i<=n;i++)
	{
		int cnt=0;
		for (int j=1;j<=n;j++)
			if (dist[j][i]!=INF) cnt++;
		ans+=(lod)1/cnt;
	}
	printf("%.12Lf\n",ans);
	return 0;
}


#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e18+7
#define lim (lld)1e9+7
#define MAX2 (lld)2e5+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const lld mod=lim;

lld power(lld x, lld y, lld p)
{   lld res = 1;     x = x % p; if (x == 0) return 0;

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

lld extend_gcd(lld a, lld b, lld& x, lld& y) {
    if (b == 0) { x = 1;y = 0;return a;}
    lld x1, y1;
    lld d = extend_gcd(b, a % b, x1, y1);
    x = y1; y = x1 - y1 * (a / b);return d;	}

lld modinv(lld a, lld p)
{return power(a,p-2,p);}

lld rowNum[]={-1,0,0,1};
lld colNum[]={0,-1,1,0};

int main()
{
	fastio
	string s;
	cin>>s;
	reverse(s.begin(), s.end());
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='6')
			s[i]='9';
		else if(s[i]=='9')
			s[i] = '6';
	}

	cout<<s<<endl;
}

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

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

    double ret = 0;

    for (int i = 1; i <= n - 1; i++) {
        ret += (1.0 * n / i);
    }

    printf("%.12lf", ret);
}

int main() {
    solve();

    return 0;
}


//Common Header Simple over C++11
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define memset0(x) memset((x),0,sizeof(x));
//#define endl '\n'
#define count2(x) __builtin_popcount(x)
#define countleadingzero(x) __builtin_clz(x)
#define dd(x) cerr << #x << " = " << x << ' ';
#define de(x) cerr << #x << " = " << x << endl;
//inline char nc() {
//  static char buf[1000000], *p = buf, *q = buf;
//  return p == q && (q = (p = buf) + fread(buf, 1, 1000000, stdin), p == q)
//             ? EOF
//             : *p++;
//}
inline ll rd(){//LLONG_MIN LMAX=9,223,372,036,854,775,807
    ll s=0,w=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0' && ch<='9')s=s*10+ch-'0',ch=getchar();
    return s*w;
}
const int N=3e5+1;
const int maxn=2e5+1;
int tot;
struct seg{
	int root,ls,rs;
	long long val;
}tre[maxn*100];
inline void insert(int &now,int l,int r,int x,int val){//单点插入
	if(!now) now=++tot;
	tre[now].val+=val;
	if(l==r) return ;
	const int mid=(l+r-1)/2;//因为可能修改负数位置的值，求mid时不能用(cl+cr)/2而要用(cl+cr-1)/2
	if(x<=mid)insert(tre[now].ls,l,mid,x,val);
	else insert(tre[now].rs,mid+1,r,x,val);
}
int L=-1e6,R=1e6;
inline long long ask(int l,int r,int& now,int cl=L,int cr=R){//区间询问
    if(!now) now=++tot;
	if(cl>r||cr<l)    return 0;
    else if(cl>=l&&cr<=r)    return tre[now].val;
    else{
        int mid=(cl+cr-1)/2;
        return ask(l,r,tre[now].ls,cl,mid)
		+ask(l,r,tre[now].rs,mid+1,cr);
    }
}
inline void ins(int v){//单点插入
	insert(tre[1].root,L,R,v,1); //根节点插入 值域L-R +1
}
inline void remove(int v){//单点删除
	insert(tre[1].root,L,R,v,-1);//根节点插入 值域L-R +1
}
inline long long countless(int v){//查小于v的有多少个
	return ask(L,v-1,tre[1].root);//计数[L,v-1]的桶
}
inline long long countgreat(int v){//查大于v的有多少个
	return ask(v+1,R,tre[1].root);//计数[v+1,R]的桶
}
inline int Rank(int v){//查数是第几大
	return countless(v)+1;//计数[L,v-1]的桶+1
}
inline int kth(int &now,int l,int r,int k){//查第k大的数
	if(l==r) return l;
	int mid=(l+r-1)/2;
	if(tre[tre[now].ls].val>=k){
		return kth(tre[now].ls,l,mid,k);
	}
	else{
		return kth(tre[now].rs,mid+1,r,k-tre[tre[now].ls].val);
	}
}
inline int pre(int v){//前驱
	int t=countless(v);
	return kth(tre[1].root,L,R,t);
}
inline int suc(int v){//后继
	int t=tre[1].val-countgreat(v)+1;
	return kth(tre[1].root,L,R,t);
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n;
	cin>>n;
	deque<int>dq;
	for(int i=1;i<=n;++i){
		int fafa;
		cin>>fafa;
		dq.push_back(fafa+1);
	}
	vector<ll>ans;
	ll now=0;
	for(int i=n-1;i>=0;--i){
		now+=countless(dq[i]);
		ins(dq[i]);
	}
	ans.push_back(now);
	for(int i=1;i<n;++i){
		int FR=dq.front();
		dq.pop_front();
		now-=countless(FR);
		dq.push_back(FR);
		now+=countgreat(FR);
		ans.pb(now);
	}
	for(auto i:ans)cout<<i<<'\n';
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update> ;

#define ll long long
#define PI 3.14159265
ll mod = 1000000007;
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll n;
    cin >> n;
    ll arr[n];
    for(int i = 0; i < n; i++)  {
        cin >> arr[i];
    }
    ordered_set<int> st;
    ll ans = 0;
    for(int i = 0; i < n; i++)  {
        ans += arr[i];
        if(st.size() > 0)   {
            ans -= st.order_of_key(arr[i]);
        }
        st.insert(arr[i]);
    }
    cout << ans << "\n";
    for(int i = 0; i < n-1; i++)    {
        ans -= arr[i];
        ans += n-1 - arr[i];
        cout << ans << "\n";
    }

}


#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
//#include <set>
using namespace std;
typedef long long LONG;

LONG gcd(LONG x, LONG y) {
    if(x % y == 0) {
        return y;
    } else {
        return gcd(y, x % y);
        //x%y==0でないときはユーグリットの互除法を使って再帰的に関数を呼び出す。
    }
}
void print(vector<int>A){
    for(size_t i=0;i<A.size();i++){
        if(A[i]==1){
            cout<<'(';
        }else{
            cout<<')';
        }
    }
}

bool comp1(pair<int,int> lhs, pair<int,int>rhs) {
    return lhs.first<rhs.first;
}

bool comp2(pair<string,int> lhs, pair<string,int>rhs) {
    return lhs.second<rhs.second;
}
void solve(int min,int max,vector<int>&A,int B){
    if(min+1==max){
        cout<<std::min(A[max]-B,B-A[min])<<endl;
        return;
    }
    int a=(min+max)/2;
    if(A[a]<B){
        solve(a,max,A,B);
    }else{
        solve(min,a,A,B);
    }

}
LONG pow2(LONG a,LONG b){
    LONG res=1;
    for(int i=0;i<b;i++){
        res=res*a;
    }
    return a;
}

void solve1(vector<bool>&A,vector<LONG>&C,int pos,vector<vector<pair<int,LONG>>>&path){
    for(int i=0;i<path[pos].size();i++){
        if(!A[path[pos][i].first]){
            A[path[pos][i].first]=true;
            C[path[pos][i].first]=C[pos]^path[pos][i].second;
            solve1(A,C,path[pos][i].first,path);
        }
    }
}

const LONG mod=1000000007;
int main() {
    LONG N;
    cin>>N;
    LONG result=0x1000000000000000;
    LONG pos=1;
    for(int i=0;i<63;i++){
        LONG a=N/pos;
        LONG c=N%pos;

        if(a+i+c<result){
            result=a+i+c;
        }

        pos=pos<<1;

    }
    cout<<result<<endl;

    return 0;

}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

int main() {
	ios_base::sync_with_stdio(false);
	ll n;
	cin >> n;
	ll bRes = n + 1;
	ford(wyk, 61, 0) {
		ll pot = 1LL << wyk;
		if (n >= pot) {
			ll a = n / pot;
			ll c = n - (a * pot);
			bRes = min(bRes, a + wyk + c);
		}
	}
	cout << bRes << endl;
}


#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define rep(i,n) repi(i,0,n)
#define repi(i,a,n) for(ll i=a;i<(ll)n;++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
void YN(bool a) { cout << (a ? "Yes" : "No") << endl; }
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; }
void show(){ cout << endl; }
template <class Head, class... Tail>
void show(Head&& head, Tail&&... tail){ cout << head << " "; show(std::forward<Tail>(tail)...); }
template<class T> inline void showall(T& a) { for(auto v:a) cout<<v<<" "; cout<<endl; }

void solve()
{
  ll t;
  cin >> t;
  rep(ti, t)
  {
    ll l, r;
    cin >> l >> r;

    ll ans = 0;
    if (r < l * 2) ans = 0;
    else if (r == l * 2) ans = 1;
    else {
      r -= (l - 1) * 2 + 1;
      ans = (r) * (r + 1) / 2;
    }
    show(ans);
  }
}

int main()
{
  fastio;
  solve();

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int t;
long long ans;
long long l,r;
int main()
{
	cin>>t;
	for(int o=1;o<=t;o++)
	{
		cin>>l>>r;
		if(r<2*l)
		{
			printf("0\n");
			continue;
		}
		ans=(r-l+1ll)*(r-2ll*l+1ll);
		ans-=r*(r-2ll*l+1ll)/2ll;
		cout<<ans<<endl;
	}
	return 0;
}


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

#define watch(x)           cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val)         memset(d,val,sizeof(d))
#define setp(x)             cout<<fixed<<setprecision(x)
#define loop(i,a,b)         for(int i=(a);i<(b);i++)
#define hunt(i,a,b)         for(int i=(a);i<=(b);i++)
#define lp(i,a,b)           for(int i = a; i >= b; i--)
#define rep(i,n)            for(int i = 0; i < n; i++)
#define int                 long long int
#define boost    ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb                  push_back
#define f                   first
#define s                   second
#define pqueue              priority_queue
#define fbo                 find_by_order
#define ook                 order_of_key
#define ll                  long long
#define ii                  pair<ll,ll>
#define vi                  vector<ll>
#define vii                 vector<ii>
#define ld                  long double
#define rd(n)              cin >> n
#define out(n)             cout << n <<endl
#define all(x)            begin(x),end(x)
void YES(){cout<<"YES\n";} void NO(){cout<<"NO\n";}
ll Bexp(ll a,int b){ ll ret=1; for (;b;a=a*a,b>>=1) if (b&1) ret=ret*a; return ret; }
ll gcd(ll A , ll B)
{
	if(B == 0)return A;
	return gcd(B , A%B);
}
ll min(ll a , ll b){return a > b ? b : a;}
ll max(ll a , ll b){return a > b ? a : b;}
#define MOD 1000000007

// count of required AP
int CountArithmaticProgressions(int sum, int d)
{
    // store the 2*sum in another variable
    int S = 2 * sum;

    // Declare the answer variable
    int answer = 0;

    // Iterate over the factors

    for (int i = 1; i <= sqrt(S); i++) {
        // Check if i is a factor or not
        if (S % i == 0) {

            if (((S / i) - d * i + d) % 2 == 0)
                answer++;

            if ((d * i - (S / i)  + d) % 2 == 0)
                answer++;
        }
    }

    // Return the answer
    return answer;
}

signed main()
{
   boost

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

	int n = 1 , N;

	rd(N);

	int sum  = 2*N;

	/*
       n*(n+2*a-1) = 2*N
         a = (2*N/i - i + 1)/2
         n is a factor of 2*N
         also (2*N/n) is also a factor of 2*N

         2*N/2*N/i   - 2*N/i + 1

         i - 2*N/i + 1.

 	 */

	// check for the factors ..

	out(CountArithmaticProgressions(N , 1));

}

#include<bits/stdc++.h>
#define re register
using namespace std;
#define int long long
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int a,b,c;
signed main(){
	a=read()*2;
	for(re int i=1;i<=sqrt(a);++i){
		if(a%i==0&&((i&1)!=((a/i)&1)))b+=2;
	}
	printf("%lld",b);
}


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

#include <bits/stdc++.h>

using namespace std;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007
#define PI acos(-1)

template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
using max_heap = priority_queue<T>;

template <typename... T>
void read(T &... args) {
    ((cin >> args), ...);
}

template <typename... T>
void write(T &&... args) {
    ((cout << args), ...);
}

template <typename T>
void readContainer(T &t) {
    for (auto &e : t) read(e);
}

template <typename T>
void writeContainer(T &t) {
    for (const auto &e : t) write(e, " ");
    write("\n");
}

void solve(int tc) {
    int h, w, n, m, ai, bi, ci, di;
    read(h, w, n, m);
    vector<vector<int>> arr(h, vector<int>(w, 0));
    // 0 -> empty
    // 1 -> bulb
    // 2 -> block
    for (int i = 0; i < n; i++) {
        cin >> ai >> bi;
        ai--;
        bi--;
        arr[ai][bi] = 1;
    }
    for (int i = 0; i < m; i++) {
        cin >> ci >> di;
        ci--;
        di--;
        arr[ci][di] = 2;
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (arr[i][j] == 1) {
                // top
                int x = i - 1, y = j;
                while (x >= 0 && arr[x][y] != 2 && arr[x][y] != 1) {
                    arr[x][y] = 3;
                    x--;
                }
                // left
                x = i, y = j - 1;
                while (y >= 0 && arr[x][y] != 2 && arr[x][y] != 1) {
                    arr[x][y] = 3;
                    y--;
                }
                // bottom
                x = i + 1, y = j;
                while (x < h && arr[x][y] != 2 && arr[x][y] != 1) {
                    arr[x][y] = 3;
                    x++;
                }
                // right
                x = i, y = j + 1;
                while (y < w && arr[x][y] != 2 && arr[x][y] != 1) {
                    arr[x][y] = 3;
                    y++;
                }
            }
        }
    }
    int ans = 0;
    for (const auto &row : arr) {
        for (const auto &ele : row) {
            if (ele == 3 || ele == 1) ans++;
        }
    }
    write(ans);
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    int tc = 1;
    // read(tc);
    for (int curr = 1; curr <= tc; curr++) solve(curr);
    return 0;
}

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const ll mod= 998244353;
long double PI = acosl(-1);
const ll infl = 1e17+100;
const int inf = 1e9+100;
const int nmax = 1500+5;
//const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;

int g[nmax][nmax];
bool ans[nmax][nmax];
int H,W,N,M;

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

    cin>>H>>W>>N>>M;
    for(int k=0; k<N; k++){
        int i,j;
        cin>>i>>j;
        g[i][j]=1;
    }
    for(int k=0; k<M; k++){
        int i,j;
        cin>>i>>j;
        g[i][j]=2;
    }
    for(int i=1; i<=H; i++){
        bool ase = false;
        for(int j=1; j<=W; j++){
            if(g[i][j]==2) ase = false;
            if(g[i][j]==1) ase = true;
            if(ase) ans[i][j] = true;
        }
    }
    for(int i=1; i<=H; i++){
        bool ase = false;
        for(int j=W; j>=1; j--){
            if(g[i][j]==2) ase = false;
            if(g[i][j]==1) ase = true;
            if(ase) ans[i][j] = true;
        }
    }
    for(int j=1; j<=W; j++){
        bool ase = false;
        for(int i=1; i<=H; i++){
            if(g[i][j]==2) ase = false;
            if(g[i][j]==1) ase = true;
            if(ase) ans[i][j] = true;
        }
    }
    for(int j=1; j<=W; j++){
        bool ase = false;
        for(int i=H; i>=1; i--){
            if(g[i][j]==2) ase = false;
            if(g[i][j]==1) ase = true;
            if(ase) ans[i][j] = true;
        }
    }

    int cnt = 0;
    for(int i=1; i<=H; i++) for(int j=1; j<=W; j++) if(ans[i][j]) cnt++;
    cout<<cnt<<endl;
}
/*
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++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;}

int main(){
	int n;
	cin >> n;
	vector<pair<ll,ll>> a(n);
	REP(i,n) cin >> a[i].first >> a[i].second;
	vector<vector<ll>> place(n+1);
	REP(i,n){
		place[a[i].second].push_back(a[i].first);
	}
	vector<pair<ll,ll>> ans(n+1);

	REP(i,n+1){
		if(place[i].size() <= 1) continue;
		sort(place[i].begin(), place[i].end());
	}

	pair<ll,ll> prevp = {0,0};
	ans[0] = {0,0};
	FOR(i,1,n+1){
		if(place[i].size() == 0){
			ans[i] = ans[i-1];
			continue;
		}

		ll length = abs(place[i].front()-place[i].back());
		ans[i].first = ans[i-1].first + abs(place[i].back()-prevp.first) + length;
		chmin(ans[i].first,  ans[i-1].second + abs(place[i].back()-prevp.second) + length);

		ans[i].second = ans[i-1].first + abs(place[i].front()-prevp.first) + length;
		chmin(ans[i].second,  ans[i-1].second + abs(place[i].front()-prevp.second) + length);

		prevp.first = place[i].front();
		prevp.second = place[i].back();
	}

	ll res = ans[n].first + abs(prevp.first);
	chmin(res, ans[n].second+abs(prevp.second));

	cout << res << endl;
	return 0;
}


/*
   Snippets :-
   1. Binomial (nCr) - nCr Modulo
   2. (x^y)mod m - power
   3. gcd & lcm - gcd
   4. Djisktra - Djikstra
   5. Priority Queue - priority
   6. Disjoint Set Union - dsu
   7. Compare Sort [sort pair with customisation] - compare
*/
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define mod 1000000007
# define con continue
# define ret return
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// unordered_map<long long, int, custom_hash> safe_map;
/*
   #include <ext/pb_ds/assoc_container.hpp>
   #include <ext/pb_ds/tree_policy.hpp>
   using namespace __gnu_pbds;
   #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
   // find_by_order() - Returns an iterator to the k-th largest element (counting from zero)
   // order_of_key()  - The number of items in a set that are strictly smaller than our item
*/
void func()
{
   #ifndef ONLINE_JUDGE
   freopen("in.txt", "r", stdin);
   freopen("out.txt", "w", stdout);
   #endif
   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int32_t  main()
{
   ll t;
    t=1;
   // cin>>t;
   while(t--)
   {
     ll n,k;
     cin>>n>>k;
     ll sum=0;
     for(ll i=1;i<=n;i++)
     {
      for(ll j=1;j<=k;j++)
      {
        sum+=(i*100+j);
      }
     }
     cout<<sum;
   }
}

#include<bits/stdc++.h>
#include <sstream>  // for string streams
using namespace std;

int main()
{
	long long N,K;
	cin>>N>>K;

	for(int b=0;b<K;b++)
	{

	ostringstream str1;

	str1<<N;

	string converted=str1.str();

	int len_num=converted.size();

	int a[len_num];
	int i=0;

	while(N!=0)
	{

			a[i]=N%10;
			N=N/10;
			i++;
	}

	sort(a,a+i);

	long long g_2=0;  //g2
	long long g_1=0;   //g1

	for(int j=0;j<i;j++)
	{
		if(a[j]!=0)
		g_1=g_1*10+a[j];

		g_2=g_2*10+a[i-1-j];
	}
	long long f_x=g_2-g_1;

	N=f_x;

	}

	cout<<N<<endl;

}


//

#include <iostream>

using namespace std;

int main() {
  short N; cin >> N;

  short ans = 1.08f * N;

  if (ans < 206)
    cout << "Yay!\n";
  else if (ans == 206)
    cout << "so-so\n";
  else
    cout << ":(\n";

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  cout<<(a+99)/100;
  return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

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

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] && s[0] == s[2]) P("Won");
  else P("Lost");
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void){
    char a,b,c;
    cin>>a>>b>>c;
    if (a==b&&b==c&&a==c) {
        cout<<"Won"<<endl;
    } else {
        cout<<"Lost"<<endl;
    }
}


#include <bits/stdc++.h>
#define ll long long int
#define db double
#define pb push_back
#define mpr make_pair
#define andl "\n"
#define f first
#define s second
#define mset(x,y) memset(x,y,sizeof(x))
#define fr(i,n) for(long long int i=0;i<n;i++)
#define trace(it,x) for(auto it = (x).begin(); it != (x).end(); it++)
#define mod 1000000007
#define fastio ios::sync_with_stdio (false); cin.tie (0); cout.tie (0);
#define runtime cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
using namespace std;

// convert number to string to_string(x);
// convert string to number stoi();

// ll mulmod(ll x,ll y)
// {
//     return ((x%mod)*(y%mod))%mod;
// }

// ll binpow(ll x, ll y)
// {
//     ll z = 1;
//     while(y > 0)
//     {
//         if(y % 2 == 1)
//             z = mulmod(z, x);
//         x = mulmod(x, x);
//         y /= 2;
//     }
//     return z;
// }

// ll ncr(ll n,ll r)
// {
//     return mulmod(fact[n],binpow(mulmod(fact[n-r],fact[r]),mod-2));
// }

// ll pwr(ll n,ll m)
// {
//   if(n==1 || m==0)
//     return 1;

//   ll x=pwr(n,m/2);
//   if(m%2==0)
//     return x*x;
//   else
//     return n*x*x;
// }

// ll pwr(ll n,ll m,ll b)
// {
//   if(n==1 || m==0)
//     return 1;

//   ll x=pwr(n,m/2,b);
//   if(m%2==0)
//     return ((x%b)*(x%b))%b;
//   else
//     return ((n%b)*(((x%b)*(x%b))%b))%b;
// }

void solve()
{
  ll nbag,nbox,q;
  cin >> nbag >> nbox >> q;

  vector<pair<ll,ll>>bag,box;

  ll w,v;

  fr(i,nbag)
  {
    cin >> w >> v;
    bag.pb({v,w});
  }

  fr(i,nbox)
  {
    cin >> w ;
    box.pb({w,i});
  }

  ll l,r,ans;
  ll a[nbox];

  sort(bag.rbegin(),bag.rend());
  sort(box.begin(),box.end());

  fr(i,q)
  {
    cin >> l >> r;

    ans=0;

    fr(i,nbox)
    a[i]=0;

    fr(j,nbag)
    {
      fr(k,nbox)
      {
        if(box[k].s<l-1 || box[k].s>=r)
        {
          if(a[box[k].s]==0)
          {
            if(box[k].f>=bag[j].s)
            {
              a[box[k].s]=1;
              ans+=bag[j].f;
              break;
            }
          }
        }
      }
    }

    cout << ans << andl;
  }

  return ;
}

int main()
{
  fastio

  ll t=1;
  // cin >> t;

  while(t--)
    solve();

  runtime
}

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

int main() {
	int n,m,q;
	cin>>n>>m>>q;
	vector<pair<int,int>>v;
	vector<pair<int,int>>w;
	int a,b;
	for(int i=0;i<n;i++){
	    cin>>a>>b;
	    v.push_back(make_pair(b,a));
	    w.push_back(make_pair(b,a));
	}
	sort(v.rbegin(),v.rend());
	sort(w.rbegin(),w.rend());
	int arr[m];
	for(int i=0;i<m;i++){
	    cin>>arr[i];
	}
	//sort(arr,arr+m);
	int l,r;
	for(int i=1;i<=q;i++){
	    cin>>l>>r;
	    l--;
	    r--;
	    vector<int>vv;
	    for(int j=0;j<m;j++){
	        if(j>=l && j<=r){
	            continue;
	        }
	        vv.push_back(arr[j]);
	    }
	    sort(vv.begin(),vv.end());
	    for(int j=0;j<vv.size();j++){
	       // cout<<"#"<<vv[j]<<"\n";
	    }
	    vector<int>::iterator lower;
	    long long ans=0;
	    for(int j=0;j<v.size();j++){
	        if(v[j].first!=-1){
	            int r=v[j].second;
	       lower=lower_bound(vv.begin(),vv.end(),r);
	       if((lower - vv.begin() + 1)<=vv.size()){
	           ans=ans+v[j].first;
	           v[j].first=-1;
	           vv[lower-vv.begin()]=-1;
	           sort(vv.begin(),vv.end());
	       }
	        }
	    }
	    cout<<ans<<"\n";
	    for(int j=0;j<n;j++){
	        if(v[j].first==-1){
	            v[j].first=w[j].first;
	        }
	    }
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const
#define fr first
#define se second
//#define ls (now<<1)
//#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define Mid ((l + r) / 2)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 1e6 + 1;
cs ll inf = 1e17 + 1;
cs int M = 1e9 + 7;
cs double eps = 1e-7;
cs int mod = 998244353;
inline int read() { int x; scanf("%lld", &x); return x; }

int fir[ff], nex[ff], to[ff], tot, va[ff];
void add(int x, int y, ll z) { nex[++tot] = fir[x]; fir[x] = tot; to[tot] = y; va[tot] = z; }
void ade(int x, int y, ll z) { add(x, y, z); add(y, x, z); }

int n, s, a[ff], Ans;
int gcd(int x, int y) { return(y ? gcd(y, x % y) : x); }
void init()
{
	cin >> n;
	rep(i, 1, n) cin >> a[i], Ans = gcd(Ans, a[i]);
	cout << Ans;
}
signed main()
{
	int Ts = 1;
//	cin >> Ts;
	while(Ts--)
		init();
}
/*
3 2 9
1 2 0
2 3 0
2 1 2
1 3
1 2
2 1 1
1 3
1 2
2 2 1 2
1 3
1 2
*/

#include<bits/stdc++.h>
#define ll long long
#define inf 0x7fffffff
#define infll 0x7fffffffffffffff
#define clr(c) memset(c,0,sizeof(c))
using namespace std;
int mod=998244353;
const int M=2e5+10;
const int N=1e6+10;
inline ll read(){
    ll b=1,sum=0; char c=getchar();
    while(!isdigit(c)){if(c=='-') b=-1; c=getchar();}
    while(isdigit(c)){sum=sum*10+c-'0'; c=getchar();}
    return b*sum;
}
int T,n,m,k;
int ans;
ll a[N];
ll gcd(ll x, ll y) {
	return y?gcd(y,x%y):x;
}
bool cmp(int x,int y){ return x<y; }
int main()
{
    int i,j;
	n=read();
	for(i=1;i<=n;i++) {
		a[i]=read();
	}
	ll x=a[1];
	for(i=2;i<=n;i++){
		x=gcd(x,a[i]);
	}
	printf("%lld",x);
    return 0;
}


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

#define int long long
#define fl(i,n) for(int i=0;i<n;i++)
#define v(i) vector<int>
#define um unordered_map<int,int>
#define pb push_back
#define pr pair<int,int>
#define NO cout<<"NO";
#define all(a) a.begin(),a.end()
#define YES cout<<"YES";
#define sortn(a) sort(a.begin(),a.end())
#define sortc(a,cp) sort(a.begin(),a.end(),cp)
#define pq priority_queue<int>
#define vvi vector<v(i)>
#define reverse(a) reverse(a.begin(),a.end())
#define mp make_pair
/* lcm(a,b) , _gcd(a,b) , swap(a,b) , sort(a.begin(),a.end()) , *max_element(a.begin(),a.end()) , *min_element(a.begin(),a.end()) */
/* _builtin_popcount(x): This function is used to count the number of one’s */
/*__builtin_clz(x): This function is used to count the leading zeros of the integer. */
/* string s.find("ks")==string::npos if not found */
/*__builtin_ctz(x): This function is used to count the trailing zeros of the given integer */
/* cout<<fixed<<setprecision(8)   ,  round(1.589) -> 2 , trunc(1.590) -> 1 , ceil(x) , floor(x) */

void SieveOfEratosthenes(int n)
{

    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {

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

}
int power(int x, int y, int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y / 2, m) % m;
    p = (p * p) % m;

    return (y % 2 == 0) ? p : (x * p) % m;
}

/* inverse of y is power(y,p-2,p) */

void print(v(i) a){
fl(i,a.size())
cout<<a[i]<<" ";
cout<<"\n";
}
int gcd( int a, int b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

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

bool cmp(int a,int b){ return a>b;}

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin>>n;
    v(i) a(n);
    int s=0;
    fl(i,n) cin>>a[i],s+=a[i];
    sortn(a);
    int ans=0,m=998244353;
    int p=0;
    for(int i=n-1;i>=0;i--){
        ans=(ans+a[i]*p)%m;
        p*=2;
        p+=a[i];
        p=p%m;
        ans=(ans+m)%m;
    }
    fl(i,n) {
        ans=(ans+a[i]*a[i])%m;
        ans=(ans+m)%m;
    }
    cout<<ans;

}

#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 998244353
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define autoitr(x,it) for(auto it = x.rbegin(); it != x.rend(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

ll powa(ll a, ll b, ll c)
{
    a%=c;
    if(a<0)
	a+=c;
    ll res = 1;
    while(b>0)
    {
        if(b&1)
            res*=a, res%=c;
        a*=a, a%=c;
        b>>=1;
    }
    return res;
}

ll norm(ll a)
{
    a%=mod;
    if(a<0)
        a+=mod;
    return a;
}

ll add(ll a, ll b)
{
    a = norm(a);
    b = norm(b);
    return norm(a+b);
}

ll mul(ll a, ll b)
{
    a = norm(a);
    b = norm(b);
    return norm(a*b);
}

ll sub(ll a, ll b)
{
    a = norm(a);
    b = norm(b);
    return norm(a-b);
}

ll divi(ll a, ll b)
{
    b = powa(b,mod-2,mod);
    return mul(a,b);
}

int main()
{
  FAST/**/

      ll n;
      cin>>n;

      ll arr[n];
      rep(n)
            cin>>arr[i];
      map<ll,ll> ma;
      rep(n)
            ma[arr[i]]++;
      vector<pii> v;
      autoit(ma,it)
            v.pb(*it);
      ll siz = v.size();
      ll pref[siz];
      pref[0] = mul(powa(2,v[0].ss,mod) - 1, v[0].ff);
      for(ll i=1;i<siz;i++){
            pref[i] = divi(pref[i-1], (powa(2, v[i-1].ss, mod) - 1)*v[i-1].ff);
            pref[i] = mul(pref[i], (powa(2, v[i].ss, mod) - 1)*v[i].ff);
            pref[i] = mul(pref[i], powa(2, v[i-1].ss, mod));
            //cout<<pref[i]<<'\n';
      }
      for(ll i=1;i<siz;i++)
            pref[i] = (pref[i-1] + pref[i])%mod;
      ll mul1 = 1;
      ll ans = 0;
      for(ll i=1;i<siz;i++)
      {
          mul1 = (mul1 * powa(2, v[i-1].ss, mod))%mod;
          ll diff = (pref[siz-1] - pref[i-1] + mod)%mod;
          ll temp = (diff*powa(mul1,mod-2,mod))%mod;
          temp = (temp*v[i-1].ff)%mod;
          temp = mul(temp, powa(2, v[i-1].ss, mod) - 1);
          ans = (ans + temp)%mod;
      }

     // cout<<"init = "<<ans<<'\n';

      for(ll i=0;i<siz;i++)
      {
          ll temp = sub(powa(2, v[i].ss, mod), 1);
          temp = mul(mul(v[i].ff, v[i].ff), temp);
          ans = add(ans, temp);
      }

      cout<<ans<<'\n';

  return 0;
}


#include<bits/stdc++.h>
#define fio             ios_base::sync_with_stdio(0);cin.tie(NULL);
#define ll              long long
#define ld              long double
#define tc              int t; cin>>t; while(t--)
using namespace std;

const int MAX=1e5+1;
const int mod=1e9+7;

int main(){
    fio
    int n,m,tmp=0,res=0;
    cin>>n>>m;
    vector<int>ans;
    int a[m];
    for(int i=0;i<m;i++){
        cin>>a[i];
    }
    sort(a,a+m);
    for(int i=0;i<m;i++){
        int dist=a[i]-tmp-1;
        if(dist>0)
            ans.push_back(dist);
        tmp=a[i];
    }
    if(n!=tmp)
        ans.push_back(n-tmp);
    sort(ans.begin(),ans.end());
    if(ans.size()>0){
        tmp=ans[0];
        for(auto x: ans){
            res+=ceil((ld)x/tmp);
        }
    }
    cout<<res<<endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define Mod 1000000007
#define Infinity (ll)1e18
#define Append(a) push_back(a)
#define Pair(a,b) make_pair(a,b)
#define Clear(a) for(ll &x : a){x=0;}
#define Point(x) std::fixed<<setprecision(15)<<x
#define SetBits(x) __builtin_popcount(x);
#define GoogleOutput(i,x) cout<<"Case #"<<i<<": "<<x<<'\n'
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int SubtreeSizes(vector<int>g[],vector<int>&dp,int u){
  if(g[u].empty()){
    return dp[u]= 1;
  }
  dp[u] = 1;
  for(int &v : g[u]){
    dp[u]+=SubtreeSizes(g,dp,v);
  }
  return dp[u];
}

int MaxCostToLeaf(vector<int>g[],vector<int>&cost,int u,vector<int>&dp){
   if(g[u].empty()){
     return dp[u] = cost[u];
   }
   dp[u] = cost[u];
   for(int &v : g[u]){
     dp[u] = max(dp[u],cost[u]+MaxCostToLeaf(g,cost,v,dp));
   }
   return dp[u];
}

int MaxCostSubset(vector<int>g[],vector<vector<int>>&dp,vector<int>&cost,int u){
  if(g[u].empty()){
    dp[u][0] =0;
    dp[u][1] = cost[u];
    return max(dp[u][0],dp[u][1]);
  }

  dp[u][1] = cost[u];
  for(int &v : g[u]){
    dp[u][1] +=MaxCostSubset(g,dp,cost,v);
  }

  return max(dp[u][0],dp[u][1]);
}

void Quicktest(){
   int n;
   cin>>n;
   int m = n-1;
   vector<int>g[n+1];
   vector<int>cost(n+1,0);
   vector<vector<int>>dp(n+1,vector<int>(2,0));
   for(int i=1;i<=n;i++){
     cin>>cost[i];
   }
   while(m--){
     int x,y;
     cin>>x>>y;
     g[x].emplace_back(y);
   }

}

int main(){
  FastIO;
  ll n,w;
  cin>>n>>w;
  cout<<(n/w);
  return 0;
}


#include<bits/stdc++.h>

using namespace std;

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pt;
typedef pair<ll,ll> pll;

#define vint vector<int>
#define vll vector<long long>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define F(i,n) for(int i = 0;i<n;i++)
#define Fr(i,l,r) for(int i = l;i <= r;i++)
#define rF(i,n) for(int i = n-1;i>=0;i--)
#define Max 1000001
#define intinf 2147483647
#define longlonginf 9223372036854775807
#define MOD 998244353
#define MOD2 1000000007
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(arr) arr.begin(),arr.end()
//#define sort(vec) sort(vec.begin(),vec.end())
//#define reverse(vec) reverse(vec.begin(),vec.end())

ll Lpow(ll a,ll b)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b%2)
            ans = (ans*a);
        a = (a*a);
        b = b/2;
    }
    return ans;
}

ll Lpow(ll a,ll b,ll M)
{
	ll ans = 1;
	while(b > 0)
	{
		if(b%2)
			ans = (ans*a)%M;
		a = (a*a)%M;
		b = b/2;
	}
	return ans;
}

struct P {
    int64_t x;
    int64_t y;
    int64_t z;
};

int64_t dist(const P& lhs, const P& rhs)
{
    return abs(lhs.x - rhs.x) + abs(lhs.y - rhs.y) + max((int64_t)0, rhs.z - lhs.z);
}

int64_t state[1 << 16][16];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(20);

    int n; cin >> n;
    vector<P> ps(n);
    for (auto& p : ps) {
        cin >> p.x >> p.y >> p.z;
    }
    n--;

    Fr(i, 1, (1 << n)-1)
	{
        Fr(j, 0, n-1)
		{
            if (i & (1 << j))
			{
                int pre = i - (1 << j);
                if (pre == 0)
				{
                    state[i][j] = dist(ps[0], ps[j + 1]);
                }
                else
				{
                    int64_t cv = INT64_MAX / 1024;
                    Fr(k, 0, n-1)
					{
                        if (pre & (1 << k))
						{
                            cv = min(cv, state[pre][k] + dist(ps[k + 1], ps[j + 1]));
                        }
                    }
                    state[i][j] = cv;
                }
            }
        }
    }

    int64_t ans = INT64_MAX;
    Fr(i, 0, n-1)
	{
        int64_t c = state[(1 << n) - 1][i] + dist(ps[i + 1], ps[0]);
        ans = min(ans, c);
    }
    cout << ans << endl;

    return 0;
}

//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353

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

ll dp[18][1 << 18] = {};

int main() {
	ll ans = 0;
	ll tmp = 0;
	int n; cin >> n;
	ll x[n+1], y[n+1], z[n+1];
	REP(i, n) cin >> x[i] >> y[i] >> z[i];
	x[n] = x[0]; y[n] = y[0]; z[n] = z[0];
	int full = 0; REP(i, n) full += 1 << i;
	REP(bit, 1 << (n+1)){
		REP(j, n+1){
			dp[j][bit] = INF;
		}
	}
	dp[0][0] = 0;
	REP1(i, n-1){
		dp[i][1 << (i-1)] =
			dp[0][0] + abs(x[0] - x[i]) + abs(y[0] - y[i]) + max((ll)0, z[i] - z[0])
		;
		//cout << dp[0][0] + abs(x[0] - x[i]) + abs(y[0] - y[i]) + max((ll)0, z[i] - z[0]) << endl;
	}
	//cout << dp[1][1] << endl;
	REP(bit, 1 << (n+1)){
		REP(j, n+1){
			if(!(bit & (1<<(j-1))) ) continue;
			ll cost = dp[j][bit], here = j;
			//cout << cost << " " << here << " " << bitset<18>(bit) << endl;
			REP1(i, n){
				dp[i][bit | (1 << (i-1) )] = min( dp[i][bit | (1 << (i-1))],
					cost + abs(x[here] - x[i]) + abs(y[here] - y[i]) + max((ll)0, z[i] - z[here])
				);
			}
		}
	}
	cout << dp[n][full] << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	ll r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	cout << [&]() -> ll {
		if (r1 == r2 && c1 == c2) return 0;
		if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2) return 1;
		if (abs(r2 - r1) + abs(c2 - c1) <= 3) return 1;
		if ((r2 + c2) % 2 == (r1 + c1) % 2) return 2;

		FOR(dx, -2, 3) FOR(dy, -2, 3) {
			ll x = r2 + dx, y = c2 + dy;
			if (r1 + c1 == x + y || r1 - c1 == x - y) return 2;
			if (abs(x - r1) + abs(y - c1) <= 3) return 2;
		}
		return 3;
	}() << endl;
	return 0;
}

#include <bits/stdc++.h>

#include <iostream>
using namespace std;

int main() {
    long long r1, c1, r2, c2;
    cin >> r1 >> c1;
    cin >> r2 >> c2;

    if (r1 == r2 && c1 == c2) {
        // その場にいる
        cout << 0 << endl;
        return 0;
    } else if (abs(r1 - r2) + abs(c1 - c2) <= 3) {
        // ３マス以内にいる
        cout << 1 << endl;
        return 0;
    } else if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2) {
        // 対角線にいる
        cout << 1 << endl;
        return 0;
    } else if ((r2 - r1 + c2 - c1) % 2 == 0) {
        // 対角線にはいないが、市松模様で同じ色のところにいる
        cout << 2 << endl;
        return 0;
    } else if (abs(r1 - r2) + abs(c1 - c2) <= 6) {
        cout << 2 << endl;
        return 0;
    } else {
        // ゴールから対角に降りてきて、r2 == r1の位置に持ってくる
        // その位置に１手で行けるなら、答えは２手
        // ただし、4マス離れていても大丈夫
        long long diff = r2 - r1;
        if (-4 <= (c2 - diff - c1) && (c2 - diff - c1) <= 4) {
            cout << 2 << endl;
        } else if (-4 <= (c2 + diff - c1) && (c2 + diff - c1) <= 4) {
            cout << 2 << endl;
        } else {
            cout << 3 << endl;
        }

        return 0;
    }

    return 0;
}


//
// Created by yamunaku on 2020/10/31.
//

#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    ll a, b, c;
    cin >> a >> b >> c;
    a = a * (a + 1) / 2 % MOD;
    b = b * (b + 1) / 2 % MOD;
    c = c * (c + 1) / 2 % MOD;
    cout << a * b % MOD * c % MOD << endl;
    return 0;
}

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
const double PI = 3.14159265358979;
#define ALL(x) x.begin(),x.end()

int main(){
    const ll MOD = 998244353;
    vector<ll> n(3);
    for(int i = 0; i < 3; i++) cin >> n[i];

    ll ans = 1;
    for(int i = 0; i < 3; i++){
        ans *= (n[i] * (n[i]+1)) /2 %MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}


#include <iostream>
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long
#define int long long
#define pre(a,b) cout<<fixed<<setprecision(a)<<b<<"\n";//a for precision b for answer
//#define mp make_pair
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define pb push_back

#define min(a,b) (a<b?a:b)
#define forn(n) for(ll i=0;i<n;i++)
#define ff first
#define ss second
#define MAX 1e18;
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound
#define vmin *min_element
#define vmax *max_element
#define pii pair<int,int>
const int mod = 1e9 + 7;
const int N=1e6+1;
const int N2 = 1e5+1;
#define pi 3.141592653589793238

using namespace std;

int fun (vector<int>&v)
{
    int mini = INT_MAX;
    int n = v.size();
    int s =0;
    vector<int>ans(n);

    //ans.push_back(0);
for(int i=0; i<v.size(); i++)
{

       mini = min(v[i],mini);
        s+= v[i];

        ans[i] = s*mini ;

   if(ans[i]<v[i]*v[i])
   {
   	ans[i] = v[i]*v[i];
   	mini = v[i];
   	s = v[i];
   }

}

int ams =0;
for(int i=0; i<v.size(); i++)
{
    ams = max(ams,ans[i]);
}
//for(int x:ans) cout<<x<<" ";

    return ams;
 }

void solve()
{
int n;
cin>>n;
string s1;
string s2;
string s3;

cin>>s1>>s2>>s3;

for(int i=0; i<n; i++)
cout<<'0';

for(int i=0; i<n; i++)
cout<<'1';

cout<<'0';

}
signed  main()
{
IOS;

//generatefibo(80);
//memset(dp,-1,sizeof(dp));
//  freopen("input.txt","r",stdin);
//  freopen("new.txt","w",stdout);
 int t = 1;
cin>>t;

 while(t--)
 {
    IOS;
     solve();
     cout<<endl;
 }

 }

//cccccccccccccccccccccccccccccccccccccccc

/* header file */
#include <bits/stdc++.h>
/* config */
namespace config {
__attribute__((constructor)) void _setup_ () noexcept {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout << std::fixed << std::setprecision(10);
}
} // namespace setup
/* iostream */
template<class Tp> std::istream &operator>> (std::istream &is, std::vector<Tp> &v) noexcept { for (Tp &x : v) is >> x; return is; }
template<class Tp> std::ostream &operator<< (std::ostream &os, const std::vector<Tp> &v) noexcept { std::cerr << '['; for (size_t i = 0; i < size(v); i++) { os << v[i]; if (i + 1 != size(v)) os << ' '; } std::cerr << ']'; return os; }
/* chmin / chmax */
template<class Tp, class Compare = std::greater<Tp>> constexpr bool chmin (Tp &a, const Tp &b, Compare comp = Compare{}) noexcept { if (comp(a, b)) { a = b; return true; } return false; }
template<class Tp, class Compare = std::less<Tp>> constexpr bool chmax (Tp &a, const Tp &b, Compare comp = Compare{}) noexcept { return chmin<Tp, Compare>(a, b, comp); }
/* zero judgement */
template<class Tp, Tp ZERO = Tp(0)> constexpr bool zero (const Tp &x) noexcept { return x == ZERO; }
template<class Tp, Tp ZERO = Tp(0), class... Args> constexpr bool zero (const Tp &x, const Args& ...args) noexcept { return zero(x) and zero(args...); }
/* python-like min / max */
template<class... Args> constexpr auto min (const Args&... args) noexcept { return std::min(std::initializer_list<std::common_type_t<Args...>>{args...}); }
template<class... Args> constexpr auto max (const Args&... args) noexcept { return std::max(std::initializer_list<std::common_type_t<Args...>>{args...}); }
/* python-like standard input */
template<class... Args> void input (Args&... args) noexcept { (std::cin >> ... >> args); }
/* python-like standard output */
void print () noexcept { std::cout << '\n'; }
template<class Tp, class... Args> void print (const Tp &first, const Args&... args) noexcept { std::cout << first; (std::cout << ... << (std::cout << ' ', args)); std::cout << '\n'; }
template<class Tp> void drop (const Tp &x) noexcept { std::cout << x << '\n'; std::exit(0); }
/* error output */
void error () noexcept { std::cerr << '\n'; }
template<class Tp, class... Args> void error (const Tp &first, const Args&... args) noexcept { std::cerr << first; (std::cout << ... << (std::cerr << ' ', args)); std::cerr << '\n'; }
template<class Tp> void dumpout (const Tp &x) noexcept { std::cerr << x << '\n'; std::exit(0); }
/* infinity class */
struct { template<class Tp> constexpr operator Tp() noexcept { return std::numeric_limits<Tp>::max() / 2; } constexpr auto operator- () noexcept; } infty;
struct { template<class Tp> constexpr operator Tp() noexcept { return std::numeric_limits<Tp>::lowest() / 2; } constexpr auto operator- () noexcept; } negative_infty;
constexpr auto decltype(infty)::operator- () noexcept { return negative_infty; }
constexpr auto decltype(negative_infty)::operator- () noexcept { return infty; }
/* alias */
template<class Tp> using matrix = std::vector<std::vector<Tp>>;
using i32 = std::int_fast32_t;
using u32 = std::uint_fast32_t;
using i64 = std::int_fast64_t;
using u64 = std::uint_fast64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

/*----------------------------------------------------------------------< template >----------------------------------------------------------------------*/

int main() {
	int t;
	input(t);
	while (t--) {
		usize n;
		std::string a, b, c;
		input(n, a, b, c);
		print(std::string(n, '0') + std::string(n, '1') + "0");
	}
	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  int x, y;
  cin >> x >> y;

  if(abs(x - y) < 3){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

//Radhe Radhe
#include<bits/stdc++.h>
#define FASTIO_  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define en '\n'
#define itr(i,n)    for(ll i=0; i<n; i++)
#define itr_ab(i,a,b)    for(ll i=a; i<=b; i++)
#define itrV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define precise cout.precision(7);
#define Dont_Quit int main(void)
#define Avada_Kedavra return 0;
#define yes cout<<"Yes"<<'\n'
#define no cout<<"No"<<'\n'
using namespace std;

Dont_Quit
{
    FASTIO_
    ll  tc,n,i;
    string s,t;
    tc=1;
    bool ok=1;
    while(tc--)
    {
        ll x,y;
        cin>>x>>y;
        if(abs(x-y)>2)
            no;
        else
            yes;

    }

    Avada_Kedavra
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Graph vector<vector<ll>>
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
#define inf 1000000321
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main(){
    ll N,C;
    ll ans = 0;
    cin >> N;
    cin >> C;
    vector<ll> a(N),b(N),c(N);
    vector<pair<ll,ll>> kiroku;

    for(int i = 0;i < N;i++){
        cin >> a[i] >> b[i] >> c[i];
        kiroku.push_back(make_pair(a[i],c[i]));
        kiroku.push_back(make_pair(b[i]+1,-c[i]));
    }
    sort(all(kiroku));
    ll checked = -1;
    ll now = 0;
    for(int i = 0;i < kiroku.size();i++){
      if(checked !=-1 && now > C){
        ans += C * (kiroku[i].first - checked);
      }
      else if(checked != -1){
        ans += now * (kiroku[i].first -checked);
      }
      now += kiroku[i].second;
      checked = kiroku[i].first;
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double dd;
#define tst int tttt;cin>>tttt;for(int TTTT=1;TTTT<=tttt;TTTT++)
#define nl cout<<"\n";
#define forn(a,b) for(int ii=a;ii<b;ii++)
const ll MOD1=1e9+7;
const ll MOD2=998244353;
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define vi vector<int>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define hhh cout<<"here"<<endl;

ll mod=MOD1;
ll po(ll x,ll y) {ll res=1;while(y>0){if(y&1)res=(res*x);x=(x*x);y>>=1;}return res;}
ll gcd(int a, int b){if(a<b) swap(a,b);if(b==0) return a;return gcd(a%b,b);}

void solve(){
    ll sx,sy,gx,gy;cin>>sx>>sy>>gx>>gy;
    double x=(sx*gy+gx*sy)*1.0/(sy+gy);
    cout<<setprecision(12)<<x;
}
int main(){
    // fastio
    // ++*(int*)0;// crash
    // freopen("out.txt","r",stdin);freopen("outt.txt","w",stdout);
    // preprocess();
    // tst
    {
        solve();nl;
    }
}
/*

u & (v-u//2)

sy*1.0/(x-sx) == gy/(gx-x)
*/


#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <deque>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <cassert>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = int64_t;
#define rep(i, a) for (int i = 0; i < (int)(a); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define repr(i, a) for (int i = (int)((a) - 1); i >= 0; --i)
template <class T> class V1 : public vector<T> { public: V1(size_t n1, T init = T()) : vector<T>(n1, init) {} };
template <class T> class V2 : public vector<V1<T>> { public: V2(size_t n1, size_t n2, T init = T()) : vector<V1<T>>(n1, V1<T>(n2, init)) {} };
template <class T> class V3 : public vector<V2<T>> { public: V3(size_t n1, size_t n2, size_t n3, T init = T()) : vector<V2<T>>(n1, V2<T>(n2, n3, init)) {} };
template <class T> class V4 : public vector<V3<T>> { public: V4(size_t n1, size_t n2, size_t n3, size_t n4, T init = T()) : vector<V3<T>>(n1, V3<T>(n2, n3, n4, init)) {} };
template <class T> class V5 : public vector<V4<T>> { public: V5(size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, T init = T()) : vector<V4<T>>(n1, V4<T>(n2, n3, n4, n5, init)) {} };
template <class T> vector<T> GetV1(istream& in, size_t N) { vector<T> ret; ret.reserve(N); rep(i, N) { T a; in >> a; ret.emplace_back(a); } return ret; }
struct dstream { ofstream fout; dstream(const char* fname) : fout(fname) {} };
template <typename T> dstream& operator << (dstream& lhs, const T& rhs) { lhs.fout << rhs; cout << rhs; return lhs; }

int main()
{
#ifdef ENV_LOCAL
	ifstream fin("input.txt");
	dstream dout("output.txt");
	auto& in = fin;
	auto& out = dout;
#else
	auto& in = cin;
	auto& out = cout; out << "";
#endif

	int a, b, c, d;
	in >> a >> b >> c >> d;
	cout << b - c;

	return 0;
}

#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define _roverload(_a1,_a2,_a3,name,...) name
    #define _rep(i,n) repi(i,0,n)
    #define repi(i,a,b) for(int i=int(a);i<int(b);++i)
    #define rep(...) _roverload(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
    #define _rrep(i,n) rrepi(i,0,n)
    #define rrepi(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);--i)
    #define rrep(...) _roverload(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define bit(n) (1LL<<(n))
    template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T> inline bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
    void print() {cout << '\n';}
    template<class T> void print(const vector<T> &v)
    {bool f=false; for(const auto &e: v){if(f)cout << ' '; cout << e; f=true;} cout << '\n';}
    template<class... T> void print(const T&... args)
    {bool f=false; for(const auto &e: {args...}){if(f)cout << ' '; cout << e; f=true;} cout << '\n';}
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main(){
    string s; cin >> s;
    reverse(all(s));
    rep(i,s.length()){
        if(s[i] == '6') s[i] = '9';
        else if(s[i] == '9') s[i] = '6';
    }
    print(s);
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

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

  int dp[n+1][m+1];
  rep(i,n+1) rep(j,m+1) dp[i][j] = INF;
  dp[0][0] = 0;
  rep(i,n+1){
    rep(j,m+1){
      if(i<n) dp[i+1][j] = min(dp[i+1][j], dp[i][j]+1);
      if(j<m) dp[i][j+1] = min(dp[i][j+1], dp[i][j]+1);
      if(i>=n || j>=m) continue;
      int co = (a[i] == b[j]) ? 0 : 1;
      dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+co);
    }
  }
  cout << dp[n][m] << endl;
  return 0;
}

#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, h, w, a, b, ansa = -1, ansb = -1;
  scanf("%lld%lld", &h, &w);
  ll uf[h + w], r[h + w];
  char s[w + 10];
  bool f[h + w];
  for(i = 0; i < h + w; ++i) uf[i] = i, r[i] = 0, f[i] = false;
  uf[h] = uf[h + w - 1] = uf[h - 1] = 0, r[0] = 1;
  for(i = 0; i < h; ++i) {
    scanf("%s", s);
    for(j = 0; j < w; ++j) if(s[j] == '#') {
      a = i, b = h + j;
      while(a != uf[a]) a = uf[a];
      while(b != uf[b]) b = uf[b];
      if(r[a] < r[b]) k = a, a = b, b = k;
      uf[b] = a;
      if(r[a] == r[b]) ++r[a];
    }
  }
  for(i = 0; i < h; ++i) {
    a = i;
    while(a != uf[a]) a = uf[a];
    uf[a] = a;
    f[a] = true;
  }
  for(i = 0; i < h + w; ++i) {
    if(f[i]) ansa++;
    f[i] = false;
  }
  for(i = h; i < h + w; ++i) {
    a = i;
    while(a != uf[a]) a = uf[a];
    uf[a] = a;
    f[a] = true;
  }
  for(i = 0; i < h + w; ++i) if(f[i]) ansb++;
  printf("%lld", ansa < ansb ? ansa : ansb);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll            long long int
#define ull           unsigned long long
#define ld            long double
#define sor(c)        sort((c).begin(),(c).end())
#define rsor(c)       sort((c).rbegin(),(c).rend())
#define rev(c)        reverse((c).begin(),(c).end())
#define FOR(n,i)      for(ll i=0;i<n;i++)
#define mout(a,i)     for(auto i : a){ cout<<i<<" ";}
#define FORM(i,mp)    for(auto i : mp)
#define fin(s)        freopen( s, "r", stdin );
#define fout(s)       freopen( s, "w", stdout );
#define strToInt(a)   atoi(a.c_str())
using namespace std;
void Oli(){
     int a;
     cin>>a;
     int ans = 0;
     for(int i = 1;i<=a;i++){
        for(int j = 1;j<=a;j++){
            for(int l = 1;l <= a;l++){
                if(l * j * i > a){
                    break;
                }
                ans++;
            }
            if(i * j > a) break;
        }
     }
     cout<<ans;
}
int main()
{
    int t = 1;
    //cin>>t;
    while(t--) Oli();
}

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int SIZEN = 100010;
typedef long long LL;
int K;

int main(){
    LL ans = 0;
    scanf("%d",&K);
    for(int i = 1;i <= K;i++){
        for(int j = 1;j*i <= K;j++){
            for(int k = 1;i*j*k <= K;k++)ans++;
        }
    }
    printf("%lld\n",ans);
}


#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1e9
typedef long long ll;
typedef long double ld;

map<ll, ll> makeMap(vector<ll> v);

int main(){
  ll n;
  cin>>n;
  vector<ll> a(n), b(n), c(n);
  REP(i,n)cin>>a[i];
  REP(i,n)cin>>b[i];
  REP(i,n)cin>>c[i];
  map<ll, ll> A, C;
  A = makeMap(a);
  C = makeMap(c);
  map<ll, set<ll>> B;
  REP(i,n){
    if(B.count(b[i]) > 0)B.at(b[i]).insert(i);
    else B.insert({b[i], {i}});
  }
  ll ans = 0;
  for(auto ap: A){
    ll anum = ap.first;
    if(B.count(anum) > 0){
      set<ll> s = B.at(anum);
      for(auto itr: s){
        if(C.count(itr + 1) > 0)ans += ap.second * C.at(itr + 1);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

map<ll,ll> makeMap(vector<ll> v){
  ll n = v.size();
  map<ll, ll> mp;
  REP(i,n){
    if(mp.count(v[i]) > 0)mp.at(v[i])++;
    else mp.insert(make_pair(v[i], 1));
  }
  return mp;
}

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

template <typename T>
struct Edge
{
    int to;
    T cost;
};

template <typename T>
struct WeightedGraph
{
    int n;
    std::vector<std::vector<Edge<T>>> g;

    WeightedGraph(){}

    WeightedGraph(int n) : n(n){
        g.resize(n);
    }

    void add_edge(int from, int to, T cost){
        g[from].push_back((Edge<T>){to, cost});
    }
};

template <typename T>
std::vector<T> dijkstra(WeightedGraph<T> &g, int s){
    int n = g.n;
    std::vector<T> d(n);
    fill(d.begin(), d.end(), -1);
    std::priority_queue<std::pair<T, int>, std::vector<std::pair<T, int>>, std::greater<std::pair<T, int>>> que;
    d[s] = 0;
    que.push(std::pair<T, int>(0, s));
    while(que.size()){
        std::pair<T, int> p = que.top();
        que.pop();
        int u = p.second;
        if(d[u] < p.first) continue;
        for(Edge<T> &e : g.g[u]){
            int v = e.to;
            if(d[v] == -1 || d[v] > d[u] + e.cost){
                d[v] = d[u] + e.cost;
                que.push(std::pair<T, int>(d[v], v));
            }
        }
    }
    return d;
}

int main()
{
    int r, c;
    cin >> r >> c;
    WeightedGraph<int> g(r * c * 2);
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c - 1; j++){
            int a;
            cin >> a;
            int u = i * c + j, v = i * c + j + 1;
            g.add_edge(u, v, a);
            g.add_edge(v, u, a);
        }
    }
    for(int i = 0; i < r - 1; i++){
        for(int j = 0; j < c; j++){
            int b;
            cin >> b;
            int u = i * c + j, v = (i + 1) * c + j;
            g.add_edge(u, v, b);
        }
    }
    for(int i = 1; i < r; i++){
        for(int j = 0; j < c - 1; j++){
            int u = i * c + j, v = (i - 1) * c + j;
            g.add_edge(u, v + r * c, 2);
            g.add_edge(u + r * c, v + r * c, 1);
        }
    }
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            int u = i * c + j;
            g.add_edge(u + r * c, u, 0);
        }
    }
    vector<int> d = dijkstra(g, 0);
    cout << d[r * c - 1] << endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>

int main()
{
	int N;
	std::cin >> N;
	std::vector<std::string>S(N);
	for (std::string& s : S)
		std::cin >> s;
	std::unordered_set<std::string>h(S.begin(), S.end());
	for (std::string &s:S)
		if (h.count('!' + s))
		{
			std::cout << s << '\n';
			return 0;
		}
	std::cout << "satisfiable" << '\n';
}

#include <bits/stdc++.h>
using namespace std;
//#define FOR_CODEFORCES
//#define MOD 998244353LL

#if 1 //テンプレ折り畳み//テンプレ折り畳み//テンプレ折り畳み

#ifdef _DEBUG
#define debug() if(true)
#define dout cout
#define dvout(v) __vout(v)
#define dvvout(v) __vvout(v)
#else
#define debug() if (false)
#define dout if (false)cout
#define dvout(v) if (false)vout(v)
#define dvout(v) if(false)__vout(v)
#define dvvout(v) if(false)__vvout(v)
#endif

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)//rep
#define repi(i, n1, n) for(int i=n1, i##_len=(n); i<i##_len; ++i)//rep
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)//自然数rep
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)

#define _Yes {cout<<"Yes"<<endl; return;}//出力
#define _No {cout<<"No"<<endl;return;}
#define _ans {cout<<ans<<endl;return;}
#define _endout(s) {cout<<(s)<<endl;return;}

#define vec(v, n) vector<int> v(n, 0);//配列
#define vecll(v, n) vector<ll> v(n, 0);
#define vecvec(v, n, m) vector<vector<int>> v(n, vector<int>(m));
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
#define vin(v) for (auto &i : (v)) cin >> i; //配列入力
#define vvin(v) for(auto&i:(v))for(auto&j:i)cin>>j;
#define __vout(v) for(auto&i:(v)){cout<<i<<' ';}cout<<"\n";
#define __vvout(v) for(auto&i:(v)){for(auto&j:i){cout<<j<<' ';}cout<<"\n";}cout<<"\n";

#ifndef MOD
#define MOD 1000000007LL//mod用定数 (ll)(1e9+7)
#endif
#define mod(n) ( ((ll)n) % MOD)
#define modp(n, p) ( ((ll)n) % (ll)(p))
#define modx(A,B) mod(mod(A)*mod(B))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define next asdnext
#define prev asdprev
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"

void test();

#endif //テンプレ折り畳み

//	LLONG_MAX 9.2*1e18	9223372036854775807LL = (2^63)-1
//	INT_MAX 2.1*1e9 2147483647 = (2^31)-1
//	O(1e8) 1.2sec

void Main()
{
	int N;
	cin>>N;
	vector<string> S(N);
	map<string, int> m;
	rep(i,N){
		cin>>S[i];
		m[S[i]]=1;
	}

	rep(i,N){
		if(m.count("!"+S[i]))_endout(S[i])
	}

	_endout("satisfiable");
}

void test(){
}
int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(20);
#ifdef FOR_CODEFORCES
	int t = 0;
	cin >> t;
	rep(i, t) Main();
#else
	Main();
#endif
	return 0;
}