#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define FOR(i, m, n) for (ll i(m); i < n; i++)
#define DWN(i, m, n) for (ll i(m); i >= n; i--)
#define REP(i, n) FOR(i, 0, n)
#define DW(i, n) DWN(i, n, 0)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
#define D(n) DW(i, n)
#define DD(n) DW(j, n)
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using vtll = vector<tll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
void add_edge(gr&g,ll x, ll y){ g[x].pb(y);g[y].pb(x); }
void add_edge(wgr&g,ll x, ll y, ll z){ g[x].eb(y,z);g[y].eb(x,z); }
template<typename T,typename U>
ostream& operator<<(ostream& os, const pair<T,U>& p) {
    cerr << ' ' <<  p.x << ',' << p.y; return os; }
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for(auto x: v) os << ' ' <<  x; return os; }
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
    for(auto x: v) os << ' ' <<  x; return os; }
template<typename T,typename U>
ostream& operator<<(ostream& os, const map<T,U>& v) {
    for(auto x: v) os << ' ' <<  x; return os; }
struct d_ {
    template<typename T> d_& operator,(const T& x) {
        cerr << ' ' <<  x; return *this;}
} d_t;
#define dbg(args ...) { d_t,"|",__LINE__,"|",":",args,"\n"; }
#define deb(X ...) dbg(#X, "=", X);
#define EPS (1e-10)
#define INF (1LL<<61)
#define YES(x) cout << (x ? "YES" : "NO") << endl;
#define CL(A,I) (memset(A,I,sizeof(A)))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

const ll MOD = 1e9+7;
ll mod(ll a, ll b = MOD) {
  return ((a%b)+b)%b;
}
ll extended_euclid(ll a, ll b, ll &x, ll &y) {
    if (a == 0) { x=0; y=1; return b;}
    ll x1,y1;
    ll d = extended_euclid(b%a, a, x1, y1);
    x = y1-(b/a)*x1; y = x1;
    return d;
}
ll mod_inverse(ll a, ll m=MOD) {
  ll x, y;
  ll d = extended_euclid(a, m, x, y);
  if (d > 1) return -1;
  return mod(x, m);
}
ll mod_power(ll a, ll p, ll m=MOD) {
    ll res = mod(1,m), x=mod(a,m);
    while ( p ) {
        if ( p & 1 ) res = ( res * x ) % m;
        x = ( x * x ) % m; p >>= 1;
    }
    return res;
}
struct Mt {
    ll x = 0;
    Mt(){}
    Mt(ll y):x(mod(y)){}
    bool operator==(Mt &y){return x==y.x;}
    Mt operator+(Mt y){return mod(x+y.x);}
    Mt operator-(){return mod(-x);}
    Mt operator-(Mt y){return mod(x-y.x);}
    Mt operator*(Mt y){return mod(x*y.x);}
    Mt operator/(Mt y){return mod(x*mod_inverse(y.x));}
    Mt operator^(ll y){return mod_power(x, y);}
    Mt operator+=(Mt y){return x=(*this+y).x;}
    Mt operator-=(Mt y){return x=(*this-y).x;}
    Mt operator*=(Mt y){return x=(*this*y).x;}
    Mt operator/=(Mt y){return x=(*this/y).x;}
    Mt operator^=(ll y){return x=(*this^y).x;}
};
ostream& operator<<(ostream& os, const Mt&m){
    os << m.x; return os;
}

const ll N = 3e3+7;
ll n;
ll a[N];
ll sm[N];
Mt dp[N][N];
// dp(i,j): how many ways to partition a[0:i] into j blocks
//  = sum(dp(k,j-1) if sum(a[k:i])%j == 0
//  = 1 if j==1
Mt m[N];
// m[x] = sum of dp[k][j-1] s.t. sm[i]%j == x and k<i

int main(void) {
    ios_base::sync_with_stdio(false);
    cin >> n;
    F(n) cin >> a[i];
    F(n) sm[i] = a[i] + (i?sm[i-1]:0);
    F(n) dp[i][1] = 1;
    FOR(j,2,n+1) {
        CL(m,0);
        F(n) {
            dp[i][j] = m[sm[i]%j];
            m[sm[i]%j] += dp[i][j-1];
        }
    }
    Mt ret = 0;
    FOR(j,1,n+1) ret += dp[n-1][j];
    cout << ret << endl;
    return 0;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin() , (x).end()

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else
#define debug(...)
#endif

const int max_n = 1e5 + 9;
const int inf = 1e9;
const int mod = 1e9 + 7;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	int n;
    cin >> n;
    vll a(n);
    for(int i = 0 ; i < n ; i++) {
        cin >> a[i];
    }

    ll sum = 1;
    ll dp[n][n+1];
    memset(dp , 0 , sizeof(dp));
    for(int i = 0 ; i < n ; i++) {
        dp[i][1] = 1;
    }

    for(int j = 2 ; j <= n ; j++) {
        int b[n] , dp1[n];
        memset(dp1, 0 , sizeof(dp1));
        for(int i = 0 ; i < n ; i++) {
            b[i] = a[i] % j;
        }
        int curr_rem = 0;
        for(int i = 0 ; i < n ; i++) {
            curr_rem += b[i];
            curr_rem %= j;
            dp[i][j] = dp1[curr_rem];
            dp1[curr_rem] += dp[i][j-1];
            dp1[curr_rem] %= mod;
        }
        sum += dp[n-1][j];
        sum %= mod;
    }

    cout << sum << "\n";
}
signed main(){
	int t = 1;
	// cin >> t;
	for(int i = 1 ; i <= t ; i++){
		solve();
	}
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
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; }
using ll = long long;
using pii = pair<int, int>;

int k, n, m;
vector<int> a;

bool isOK(ll x){
    vector<ll> l(k), r(k);
    ll ls = 0, rs = 0;
    rep(i,k){
        l[i] = (((ll)m*a[i] - x) + n - 1) / n;
        r[i] = ((ll)m*a[i] + x) / n;
        // if(l[i]>r[i]) return false;
        l[i] = max(l[i], 0ll);
        r[i] = min(r[i], (ll)m);
        ls += l[i];
        rs += r[i];
    }
    if (ls <= m && m <= rs) return true;
    return false;
}

void output(ll x){
    vector<ll> l(k), r(k);
    ll tot = 0;
    rep(i,k){
        l[i] = (((ll)m*a[i] - x) + n - 1) / n;
        r[i] = ((ll)m*a[i] + x) / n;
        tot += l[i];
    }
    rep(i,k){
        ll nb=l[i];
        if(tot < m){
            while(nb<r[i] && tot<m){
                nb++;
                tot++;
            }
        }
        cout << nb << " ";
    }
    cout << endl;
}

int main(){
    // int k, n, m;
    cin >> k >> n >> m;
    // vector<int> a(k);
    a.resize(k);
    rep (i,k) cin >> a[i];

    ll l=-1, r=(ll)n*m+1;
    while(l+1 < r){
        ll c = (l+r) / 2;
        if(isOK(c)) r = c;
        else l = c;
    }
    output(r);
}

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

int main(){
  long long k, n, m, bsum = 0;
  cin >> k >> n >> m;
  vector<long long> a(k), b(k);
  for(int i = 0; i < k; ++i){cin >> a[i];}

  for(int i = 0; i < k; ++i){b[i] = (m*a[i])/n; bsum += b[i];}
  vector<pair<long long, long long>> minsearch(k);
  for(long long i = 0; i < k; ++i){minsearch[i] = make_pair(n*b[i] - m*a[i], i);}
  sort(minsearch.begin(), minsearch.end());

  for(long long i = 0; i < m - bsum; ++i){
    b[minsearch[i].second] += 1;
  }

  for(int i = 0; i < k; ++i){cout << b[i] << " ";}cout << endl;
}


#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

#define A_MAX 1000000000000000000

int main(){
  ll N,K;
  cin >> N >> K;
  map<ll,ll> A;

  ll a,b;
  for(int i=0;i<N;++i){
    cin >> a >> b;
    --a;
    A[a]+=b;
  }

  ll now=0;
  for(auto p: A){
    ll index=p.first;
    ll k=p.second;
    if(K<=index){
      cout << K << endl;
      return 0;
    }
    K+=k;
  }

  cout << K << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define fi first
#define se second
const int maxn=2e5+5;
struct fri
{
	ll pos,val;
}f[maxn];
int n;
ll k;
bool cmp(fri aa,fri bb)
{
	return aa.pos<bb.pos;
}
int main()
{

	scanf("%d%lld",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld%lld",&f[i].pos,&f[i].val);
	sort(f+1,f+n+1,cmp);
	ll now=0;
	for(int i=1;i<=n;i++)
	{
		if(now+k>=f[i].pos)
		{
			k-=f[i].pos-now;
			now=f[i].pos;
			k+=f[i].val;
		}
		else break;
	}
	now+=k;
	printf("%lld",now);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define en      '\n'
#define endl    '\n'
#define ll      long long int
#define pb      push_back
#define append  push_back
#define all(v)  (v).begin(),(v).end()
#define FOR(i,a,b,k) for(int i=a; k>0?i<b:i>b; i+=k)
#define fori(a) for(int i=0; i<a; i++)
#define forj(a) for(int j=0; j<a; j++)
#define fork(a) for(int k=0; k<a; k++)
#define MOD     1000000007
#define MAX     1000005
#define mset(a,s,k) memset(a,k,s*sizeof(a[0]))
#define ff first
#define ss second
#define __ <<" "<<

ll pow_(ll a,ll e,ll m=MOD){ll r=1;while(e){if(e&1)r=r*a%m;a=a*a%m;e>>=1;}return r;}
int inv(ll a) {return pow_(a,MOD-2,MOD);}int add(ll a, ll b){return (a+b+MOD)%MOD;} int mul(ll a, ll b)
{return (MOD+a*b%MOD)%MOD;}int di(ll a, ll b){return mul(a,inv(b));}ll  ceil(ll a,ll b){return a/b+(a%b!=0);}
void print(vector<int>a){fori(a.size())cout<<a[i]<<" ";cout<<en;}void print(ll a,ll b,char k='\n'){cout<<a<<" "<<b<<k;}
void print(vector<int> *a,int n){fori(n)print(a[i]);}void print(int *a,int n){fori(n)cout<<a[i]<<" "; cout<<en;}

#define vi vector<int>
#define tp pair<ll,ll>

int arr[MAX]; ll N,K;
ll get(ll x){
    // cout<<x<<en;
    if(x>N) return 2*N-x+1;
    return x-1;
}
// 4-> 5+3 4+4 3+5
int solve(){
    cin>>N>>K;
    ll R=0;
    fori(2*N+1){
        if(i==0) continue;
        ll X=K+i;
        if(X<=0 || X>2*N) continue;
        R+=get(X)*get(i);
    }
    cout<<R;
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
        // cout<<solve()<<en;
        // cout<<(solve()?"Yes":"No")<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
int a, b;
cin >> a >> b;
int a2=a/100+a%100/10+a%10;
int b2=b/100+b%100/10+b%10;
    if(a2>=b2){
        cout << a2;
    }
    else{
        cout << b2;
    }
return 0;
}


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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  int n;
  cin >> n;
  vector<int> v(2*n);
  for(int i = 0; i < 2*n; ++i){
    cin >> v[i];
  }
  multiset<int> s;
  int l = 0;
  int r = 2*n -1;
  i64  ans = 0;
  while(l<r){
    s.insert(v[l]);
    s.insert(v[r]);
    auto it = prev(s.end());
    ans += *it;
    s.erase(it);
    l += 1;
    r -= 1;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>

const int N = 200000;

int v[2*N + 5], n;

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

	long long sum = 0;
	std::priority_queue<int>que;
	for(int i=n;i>=1;i--) {
		que.push(v[n - i + 1]), que.push(v[n + i]);
		sum += que.top(), que.pop();
	}
	printf("%lld\n", sum);
}


#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define mod 1000000007
#define pi 3.14159265358979
#define  PRE(x,p) cout<<setprecision(x)<<p;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl "\n"
#define high INT_MAX
#define low INT_MIN
#define ll long long int

using namespace std;

void showa(ll a[],ll n){ for(ll i=1;i<=n;i++) cout<<a[i]<<' ';  cout<<endl;  }
void showv(vector<ll>v){ for(ll i=0;i<v.size();i++) cout<<v[i]<<' '; cout<<endl;}

void solve()
{
   ll n;
   cin>>n;
   ll p=1;
   ll b=0;
   ll ans=high;
   while(p<=n)
   {
     ll a=n/p;
     ll c=n%p;
     p=p*2;

     ans=min(ans,a+b+c);
     b++;
   }
   cout<<ans;

}
int main()
{
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

ll t=1;
// cin>>t;
for(ll test=1;test<=t;test++)
{
    // cout<<"CASE #"<<test<<": ";
    solve();
}

return 0;
}

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

int main() {
long long int N;
cin>>N;
long long int a;
long long int b;
long long int c;
long long int z;
vector<long long int> vec(1000);
if(N==1){cout<<1<<endl;}
else {
for(long long int i=0;std::pow(2,i)<N;i++)
{z=std::pow(2,i);
 a=N/z;
 b=i;
 c=N%z;
vec.at(i)=a+b+c;
};

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

for(long long int x=0;x<1000;x++)
{
if(vec.at(x)!=0){cout<<vec.at(x)<<endl;
                break;}

}

}

}


#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<long long>>;
const long long INF = 1LL <<60;
const long long Mo=1000000007;

vector<long long> seen;
void dfs(const Graph &G, int v, long long cnt) {
  seen[v] = cnt;	//判定だけならcntをboolに
  // v から行ける各頂点 next_v について
  for (auto next_v : G[v]) {
    if (seen[next_v]>=0) continue; // next_v が探索済だったらスルー
    dfs(G, next_v, cnt); // 再帰的に探索
  }
}

long long gcn(long long x,long long y){
  if(x%y==0){
    return y;
  }
  else{
    return gcn(y,x%y);
  }
}

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main(void){
  long long tmp=0;
  long long i,j,k,t;
  double sx,sy,gx,gy;
  double res;

  cin>>sx>>sy>>gx>>gy;
  res=sx+(gx-sx)*sy/(sy+gy);

  cout<<setprecision(15)<<res<<endl;
  //cout<<res<<endl;

  return 0;
}

/*
Graph G(n);
seen.assign(n,-1);
for(i=0; i<m; i++) {
  cin>>tmp1>>tmp2;
  tmp1--;
  tmp2--;
  G[tmp1].push_back(tmp2);
  G[tmp2].push_back(tmp1);
}
*/

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

int main() {
    int sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;
    if(sx == gx) {
        cout << sx << endl;
    }
    else {
        printf("%lf", sx - sy * ((double)(sx - gx) / (double)(sy + gy)));
    }
}


    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const ll INF=1e18;
    const int mod=1e9+7;

    struct edge{
      int to;
      ll w,k;
      edge(int to,ll w,ll k):to(to),w(w),k(k){}
    };
    using Graph=vector<vector<edge>>;

    ll n,m,x,y;

    void dijkstra(int s,Graph G,vector<ll>& dist){
      dist.resize(n,INF);
      dist[s]=0;
      priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>>q;
      q.push({dist[s],s});
      while(!q.empty()){
        int v=q.top().second;
        ll d=q.top().first;
        q.pop();
        if(d>dist[v]){continue;}
        for(auto e:G[v]){
          if(chmin(dist[e.to],dist[v]+e.w)){
            q.push({dist[e.to],e.to});
          }
        }
      }
    }
    int main() {
      cin>>n>>m>>x>>y;
      x--;y--;
      Graph G(n);
      rep(i,m){
        ll a,b,t,k,c;cin>>a>>b>>t>>c;
        a--;b--;
        G[a].push_back(edge(b,t,c));
        G[b].push_back(edge(a,t,c));
      }
      vector<ll>dist(n,INF);
      dist[x]=0;
      priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>>q;
      q.push({0ll,x});
      while(!q.empty()){
        int v=q.top().second,d=q.top().first;q.pop();
        if(d>dist[v]){continue;}
        for(auto e:G[v]){
          ll cost=(e.k-dist[v]%e.k)%e.k+e.w;
          if(chmin(dist[e.to],dist[v]+cost)){q.push({dist[e.to],e.to});}
        }
      }
      cout<<(dist[y]==INF?-1:dist[y])<<endl;
      return 0;
    }

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
int A;
int B;
long long K;
long long c[61][61];
int main(){
  int WYIGIcGE, ao_dF3pO, i;
  for(i=(0);i<(61);i++){
    c[i][0] = 1;
  }
  for(i=(1);i<(61);i++){
    int j;
    for(j=(1);j<(61);j++){
      c[i][j] = c[i-1][j-1] + c[i-1][j];
    }
  }
  rd(A);
  rd(B);
  rd(K);K += (-1);
  while(A && B){
    if(K < c[A+B-1][A-1]){
      wt_L('a');
      A--;
    }
    else{
      K -= c[A+B-1][A-1];
      wt_L('b');
      B--;
    }
  }
  for(WYIGIcGE=(0);WYIGIcGE<(A);WYIGIcGE++){
    wt_L('a');
  }
  for(ao_dF3pO=(0);ao_dF3pO<(B);ao_dF3pO++){
    wt_L('b');
  }
  wt_L("");
  wt_L('\n');
  return 0;
}
// cLay version 20210524-1

// --- original code ---
// int A, B; ll K;
// ll c[61][61];
// {
//   rep(i,61) c[i][0] = 1;
//   rep(i,1,61) rep(j,1,61) c[i][j] = c[i-1][j-1] + c[i-1][j];
//   rd(A,B,K--);
//   while(A && B){
//     if(K < c[A+B-1][A-1]){
//       wtN('a');
//       A--;
//     } else {
//       K -= c[A+B-1][A-1];
//       wtN('b');
//       B--;
//     }
//   }
//   rep(A) wtN('a');
//   rep(B) wtN('b');
//   wt("");
// }


#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pb push_back
using namespace std;
using ll = long long;
const ll mod = 1e9+7;

ll fac[1000001];

void pre(){
    fac[0]=fac[1]=1;
    for(int i=2;i<=1000001;i++)
{

    fac[i]=(fac[i-1]*1LL*i)%mod;
}
}

ll binpower(ll a,ll n){
    ll res=1;
    while(n){

    if(n%2)
        res = (res*1LL*a)%mod;

        n/=2;
        a=(a*1LL*a)%mod;

    }
    return res;

}

ll nCrmod(ll n,ll r){

ll res= fac[n];
res = (res*1LL*binpower(fac[r],mod-2))%mod;
res= (res*1LL*binpower(fac[n-r],mod-2))%mod;
return res;

}

long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
ll modexp(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  modexp(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*modexp(a,b-1,m))%m;
    }
}

ll modinv(ll a,ll m){
return modexp(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}

void SieveOfEratosthenes(ll n)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Print all prime numbers
    for (ll p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

vector<int> Centroid(vector<int>g[],int n) {

        vector<int> centroid;
        vector<int> sz(n+1);
        function<void (int, int)> dfs = [&](int u, int prev) {
                sz[u] = 1;
                bool is_centroid = true;
                for (auto v : g[u]) if (v != prev) {
                        dfs(v, u);
                        sz[u] += sz[v];
                        if (sz[v] > n / 2) is_centroid = false;
                }
                if (n - sz[u] > n / 2) is_centroid = false;
                if (is_centroid) centroid.push_back(u);
        };
        dfs(1, 0);
        return centroid;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   long double a,b;

    cin>>a>>b;

    long double p = (a-b)/a;
    cout<<fixed<<setprecision(6)<<p*100.0<<endl;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
const int N = 50 + 7;
int n;
int y;
int a[N];
int b[N];
int valuey[N];
int dp[N][2];

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

  cin >> n >> y;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[n + 1] = (int) 3e18 / a[n] * a[n];
  for (int i = 1; i <= n; i++) {
    b[i] = a[i + 1] / a[i];
  }
  for (int i = n; i >= 1; i--) {
    valuey[i] = y / a[i];
    y %= a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 1; j++) {
      dp[i][valuey[i] + j >= b[i]] += dp[i - 1][j];
      int value = dp[i - 1][j];
      int x = b[i] - j - valuey[i];
      if (1 <= x && x < b[i]) {
        dp[i][(x + j + valuey[i]) >= b[i]] += value;
      }
    }
  }
  cout << dp[n][0] << "\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
//#pragma GCC target("avx,avx2,fma")
#define m_p make_pair
#define f first
#define s second
#define vec vector
#define sz(x) (int)x.size()
#define pw(x) (1LL<<x)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define pb push_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef unsigned long long ull;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
auto rnd=bind(uniform_int_distribution<ll>(1,1e18),mt19937(time(0)));
template <class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template <class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const ll inf=1e18;
//const int N=1<<16;

signed main(){
    fast_io;
    int n,m;
    cin>>n>>m;
    vec<ll>a(n);
    for(auto &z : a)
        cin>>z;
    vec<ll>mn=a;
    ll mx=-inf;
    vec<vec<int>>g(n,vec<int>());
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        g[b-1].pb(a-1);
    }
    for(int i=0;i<n;i++){
        for(auto &z : g[i]){
            umax(mx,a[i]-mn[z]);
            umin(mn[i],mn[z]);
        }
    }
    cout<<mx;
    return 0;
}
/*
qertwy
3
6 3
*/

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

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

#define LL long long
#define FI ios_base::sync_with_stdio(false); cin.tie(NULL);
#define PREC cout << setprecision(10) << fixed;

#define int long long

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int MX = 1e5 + 5;

int n;
int inp[8];
int m;
int l[MX], v[MX];

int sz;
set<int> allV;
map<int, int> mp;

struct SegTree {
    vector<int> tree;
    int DEFAULT;

    void init(int n) {
        tree.resize(4*n);
        //depends on operation
    	DEFAULT = 0;
    }

    int combine(int x, int y) {
		return max(x, y);
    }

    void update(int node, int st, int en, int id, int val) {
        if(id < st || id > en) return;
        if(st == en && st == id) {
            tree[node] = max(tree[node], val);
            return;
        }
        int mid = (st + en)/2;
        update(2*node, st, mid, id, val);
        update(2*node + 1, mid+1, en, id, val);
        tree[node] = combine(tree[2*node], tree[2*node + 1]);
    }

    int query(int node, int st, int en, int i, int j) {
        if(i > en || j < st) {
            return DEFAULT;
        }
        if(i <= st && en <= j) {
            return tree[node];
        }
        int mid = (st + en)/2;
        int left = query(2*node, st, mid, i, j);
        int right = query(2*node+1, mid+1, en, i, j);
        return combine(left, right);
    }
};

SegTree seg;

int calc(vector<int> x) {
	vector<int> pla(n);
	pla[0] = 0;
	for(int i=1;i<n;i++) {
		int sum = inp[x[i]];
		int j = i-1;
		int minD = 0;
		while(j >= 0) {
			sum += inp[x[j]];

			auto it = allV.lower_bound(sum);
			if(it == allV.begin()) {
				j--;
				continue;
			}

			it--;
			int id = mp[*it];
			int maxL = seg.query(1, 0, sz - 1, 0, id);

			maxL = maxL - (pla[i-1] - pla[j]);

			minD = max(minD, maxL);
			j--;
		}
		pla[i] = pla[i-1] + minD;
	}

	int totD = pla[n-1] - pla[0];
	return totD;
}

#undef int
int main() {
	#define int long long
	cin >> n >> m;

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

	for(int i=0;i<m;i++) {
		cin >> l[i] >> v[i];
		allV.insert(v[i]);
	}

	//Base check
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			if(inp[i] > v[j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}

	sz = 0;
	for(auto it : allV) {
		mp[it] = sz;
		sz++;
	}
	seg.init(sz);
	for(int i=0;i<m;i++) {
		int id = mp[v[i]];
		seg.update(1, 0, sz-1, id, l[i]);
	}

	int ans = INF;
	vector<int> x;
	for(int i=0;i<n;i++) x.push_back(i);
	ans = min(ans, calc(x));
	while(next_permutation(x.begin(),x.end())) {
		ans = min(ans, calc(x));
	}

	cout << ans << endl;

	return 0;
}


#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<cstdio>
#include<cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int to[400001], ne[400001], he[200001];
int Q[200001], pl[200001], dl[200001];

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

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

	int N = getint(), K = getint();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		to[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		to[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	int q = 0, p = 0;
	Q[q++] = 1;
	while (p < N) {
		int u = Q[p++];
		int tmp = 0;
		int ind = he[u];
		he[u] = 0;
		while (ind) {
			int v = to[ind];
			tmp = ne[ind];
			if (he[v] > 0) {
				Q[q++] = v;
				ne[ind] = he[u];
				he[u] = -ind;
			}
			ind = tmp;
		}
	}

	int are = 1000000, pd0 = are;
	int L = 0, R = (N + K - 1) / K;
	while (L + 1 < R) {
		int wj = (L + R) / 2;

		int num = 0;

		for (int i = N - 1; i >= 0; i--) {
			int po = pd0 - 1;
			int dd = pd0;
			int u = Q[i];
			for (int ind = -he[u]; ind; ind = -ne[ind]) {
				int v = to[ind];
				if (po < pl[v]) po = pl[v];
				if (dd < dl[v]) dd = dl[v];
			}
			if (po >= dd) dd = 0;
			if (dd >= pd0 + wj) {
				num++;
				po = pd0 + wj;
				dd = 0;
			}
			pl[u] = po - 1;
			dl[u] = dd + 1;
			if (num > K) break;
		}

		int are = num + (dl[1] > pd0);
		if (are > K) L = wj;
		else R = wj;

		pd0 += are;
	}

	printf("%d", R);

	Would you please return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    vector<vector<int>> to(N);
    for (int e = 0; e < N - 1; e++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        to[u].push_back(v), to[v].push_back(u);
    }
    int ng = -1, ok = N;
    while (ok - ng > 1) {
        const int c = (ok + ng) / 2;
        int required = 0;
        auto dfs = [&](auto self, int now, int prv) -> pair<int, int> {
            int farthest_alive = 0;
            int kouka = -1; // 何個さかのぼって消すか
            for (auto nxt : to[now]) if (nxt != prv) {
                auto [fa, k] = self(self, nxt, now);
                if (fa >= 0) farthest_alive = max(farthest_alive, fa + 1);
                if (k >= 0) kouka = max(kouka, k - 1);
            }

            if (farthest_alive <= kouka) {
                farthest_alive = -1;
            }
            if (farthest_alive >= c) {
                farthest_alive = -1;
                required++;
                kouka = c;
            }
            return {farthest_alive, kouka};
        };

        auto [f, k] = dfs(dfs, 0, -1);
        if (f >= 0) required++;
        (required <= K ? ok : ng) = c;
    }
    cout << ok << '\n';
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
template <typename T, typename U> bool chmin(T &a, const U b) {if(a > b) {a = b; return 1;} return 0;}
template <typename T, typename U> bool chmax(T &a, const U b) {if(a < b) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 2e5;
const ld eps = 1e-9;
const char newl = '\n';

ll n;
vvl G;
vl memo;

ll f(ll s) {
  if(memo[s]) return memo[s];

  vl v;
  rep(i, n) if(s & (1LL << i)) v.push_back(i);
  ll vs = v.size();

  bool is_complete = 1;
  rep(i, vs-1) {
    if(!is_complete) break;
    rep2(j, i+1, vs-1) if(!count(all(G[v[i]]), v[j])) {
      is_complete = 0;
      break;
    }
  }
  if(is_complete) {
    memo[s] = 1;
    return 1;
  }

  ll res = vs;
  for(ll t=(s-1)&s; t>0; t=(t-1)&s) chmin(res, f(t) + f(s-t));
  memo[s] = res;
  return res;
}

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

  ll m, a, b;
  cin >> n >> m;
  G = vvl(n);
  memo = vl(1LL << n);
  rep(_, m) {
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  cout << f((1LL << n) - 1) << newl;
  return 0;
}

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>

#include <bitset>

#ifdef VS
#define __builtin_clz(v) __lzcnt(v)
#endif

constexpr int MAXN = 18;

int n, m;
int gr[MAXN];
char dp[1 << MAXN];
std::bitset<1 << MAXN> may;

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

	std::cin >> n >> m;
	for (int i = 0; i < n; i++) {
		gr[i] |= (1 << i);
	}
	for (int i = 0; i < m; i++) {
		int u, v;
		std::cin >> u >> v;
		u--; v--;
		gr[u] |= 1 << v;
		gr[v] |= 1 << u;
	}
	may[0] = true;
	for (int mask = 1; mask < (1 << n); mask++) {
		int i = 31 - __builtin_clz(mask);
		if ((may[mask ^ (1 << i)]) && ((gr[i] & mask) == mask)) {
			may[mask] = true;
		}
	}

	std::fill(dp, dp + (1 << n), n);
	dp[0] = 0;
	for (int mask = 1; mask < (1 << n); mask++) {
		if (may[mask]) {
			dp[mask] = 1;
			continue;
		}
		for (int s_mask = mask; s_mask > 0; s_mask = (s_mask - 1) & mask) {
			if (may[s_mask]) {
				dp[mask] = std::min<char>(dp[mask], dp[mask ^ s_mask] + 1);
			}
		}
	}

	std::cout << (int)dp[(1 << n) - 1] << std::endl;

	return 0;
}


#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 206
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset(a , 0 , sizeof a )
typedef long long ll;
#define fail return void( puts("-1") )
int n , m;

int c[MAXN];
int G[MAXN][MAXN];
vi g[MAXN];

int vis[MAXN];
set<pii> S;
void dfs( int u , int fa ) {
	vis[u] = vis[fa] + 1;
	for( int v : g[u] ) if( v != fa ) {
		if( !vis[v] ) S.insert( mp( v , u ) ) , dfs( v , u );
		else if( vis[v] < vis[u] ) S.insert( mp( v , u ) );// , cout << v << ' ' << u << endl;
	}
}

void solve() {
	cin >> n >> m;
	vector<pii> ff;
	rep( i , 1 , m ) {
		int u , v;
		scanf("%d%d",&u,&v);
		G[u][v] = 1;
		ff.eb( mp( u , v ) );
	}
	rep( i , 1 , n ) scanf("%d",c + i);
	rep( i , 1 , n ) rep( j , 1 , n ) if( G[i][j] ) {
		if( c[i] != c[j] ) {
			if( c[i] < c[j] ) G[i][j] = 0 , G[j][i] = 1;
		} else {
			g[i].pb( j ) , g[j].pb( i );
			G[i][j] = 0;
		}
	}
	rep( i , 1 , n ) if( !vis[i] ) dfs( i , i );
	for( auto t : ff ) {
		int u = t.fi , v = t.se;
		if( c[u] != c[v] ) {
			if( G[u][v] ) puts( "->" );
			else puts( "<-" );
		} else {
			if( S.count( mp( u , v ) ) ) puts("<-");
			else puts("->");
		}
	}
}

signed main() {
//    int T;cin >> T;while( T-- ) solve();
	solve();
}

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

#define LOCAL 1;
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template<typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ", ";
  }
  out << "]";
  return out;
}

template<typename F, typename S>
ostream& operator<< (ostream& out, const pair<F,S>& p) {
  out << "[" << p.first << ", " << p.second << "]";
  return out;
}

vector<int> c;
vector<pair<int,int>> c_idx;
vector<set<int>> g;
set<pair<int,int>> ed;

//0-indexed
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  //木の根なら-(size of tree) それ以外は木の根のindexが入っている。
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {//xの方がでかい
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
map<pair<int,int>,string> ans;
void dfs(int cv, UnionFind &uf, set<int> &cver, vector<bool> &used, map<int,int> &mp){
  // cout << cv << endl;
  used[mp[cv]] = true;
  for(auto nv:g[cv]){
    if(cver.count(nv) && !used[mp[nv]]){
      ans[{cv,nv}] = "->";
      used[mp[nv]]=true;
      dfs(nv,uf,cver,used,mp);
    }
    if(ans.count({cv,nv})==0 && ans.count({nv,cv})==0){
      ans[{cv,nv}] = "->";
    }
  }
}
void solve(vector<int> &cver){
  UnionFind uf(((int)cver.size()));
  map<int,int> mp;
  set<int> st;
  rep(i,cver.size()){
    st.insert(cver[i]);
  }
  rep(i,cver.size()){
    mp[cver[i]] = i;
  }
  for(auto i:cver){
    for(auto j:cver){
      if(i>=j) continue;
      if(ed.count({i,j})){
        uf.unite(mp[i],mp[j]);
      }
    }
  }
  vector<bool> used(cver.size(),false);
  rep(i,cver.size()){
    if(uf.root(i)==i){
      // dbg(i);
      dfs(cver[i],uf,st,used,mp);
    }
  }
  rep(i,cver.size()){
    for(auto nv:g[cver[i]]){
      if(st.count(nv)==0) ans[{cver[i],nv}] = "->";
      g[nv].erase(cver[i]);
    }
    g[cver[i]].clear();
  }
}

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

  int n,m;
  cin >> n >> m;
  c.resize(n);
  c_idx.resize(n);
  g.resize(n,set<int>());
  vector<pair<int,int>> inp;
  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;--b;
    g[a].insert(b);
    g[b].insert(a);
    ed.insert({min(a,b),max(a,b)});
    inp.push_back({a,b});
  }
  rep(i,n) cin >> c[i];
  rep(i,n) c_idx[i] = {c[i],i};
  sort(c_idx.rbegin(),c_idx.rend());
  // rep(i,n)dbg(c_idx[i]);
  rep(i,n){
    vector<int> cver = {c_idx[i].second};

    int ni = i+1;
    while(ni<n && c_idx[ni].first==c_idx[i].first){
      // dbg(c_idx[ni].second);
      cver.push_back(c_idx[ni].second);
      ni++;
    }
    // dbg(cver);
    i=ni-1;
    solve(cver);
  }
  rep(i,inp.size()){
    if(ans.count(inp[i])) cout << ans[inp[i]] << endl;
    else{
      if(ans.count({inp[i].second,inp[i].first})){
        cout << "<-" << endl;
      }
      // else{
      //   cout <<"->" << endl;
      // }
    }

  }

  return 0;

}


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

int main() {
  int A;
  cin >> A;
  int B;
  cin >> B;
  int W;
  cin >> W;
  int i = 0;
  int a = 0;
  int c, d;
  int w = W * 1000;
  while (true) {
    i++;
    if (a == 0) {
      if (A * i <= w && B * i >= w) {
        a = 1;
        c = i;
      }
    }
    else if (a == 1) {
      if (A * i > w) {
        a = 2;
        d = i - 1;
        break;
      }
    }
    if (a == 0 && i >= 1000000) {
      break;
    }
  }
  if (a == 2) {
    cout << c << " " << d << endl;
  }
  if (a == 0) {
    cout << "UNSATISFIABLE" << endl;
  }
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;//三年竞赛一场空，不开long long见祖宗
//typedef __int128 lll;
#define print(i) cout << "debug: " << i << endl
#define close() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define mem(a, b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define x first
#define y second
typedef pair<int, int> pii;
const ll mod = 1e9 + 7;
const int maxn = 4e5 + 10;
const int inf = 0x3f3f3f3f;
double a[maxn], b[maxn];
const double eps=1e-6;
int vis[maxn];
int n, m, k;

inline int sgn(double x)
{
	if(x>-eps && x<eps)
		return 0;
	if(x>0) return 1;
	else	return -1;
}

int main()
{
    cin >> n >> m >> k;
    for(int i = 1; i <= k; i++)
    {
        int x; cin >> x; vis[x] = 1;
    }
    double suma = 0, sumb = 0;
    for(int i = n - 1; i >= 0; i--)
    {
        if(vis[i])
        {
            a[i] = 1, b[i] = 0;
        }
        else
        {
            a[i] = suma / m, b[i] = sumb / m + 1;
        }
        suma += a[i], suma -= a[i + m];
        sumb += b[i], sumb -= b[i + m];
    }
    //cout << a[1] << " " << b[1] << endl;
    if(sgn(a[0] - 1) == 0) cout << -1 << endl;
    else
    {
        double res = b[0] / (1 - a[0]);
        printf("%.4f\n", res);
    }

}


#include<bits/stdc++.h>
#define f first
#define int long long
#define s second
using namespace std;
const int N=2e5+5,mod=998244353;
int t,n,a[N];
string s;
 main(){
 	cin>>n;
	// t=1;
	int ans=0,cur=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		ans += a[i]*((cur+a[i])%mod)%mod;
		ans%=mod;
		cur=(cur*2+a[i])%mod;
	}
	cout<<ans;
}

#define _CRT_SECURE_NO_WARNINGS
#define fast ios::sync_with_stdio(false); cin.tie(0)
#define foru(i, k, n) for (ll i = k; i < n; i++)
#define ford(i, k, n) for (ll i = k; i >= n; i--)
#define pb push_back
#define ff first
#define ss second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <queue>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll, ll> pll;

const ll mod = 998244353;

void imult(ll& lhs, const ll& rhs) {
	lhs = ((lhs % mod) * (rhs % mod)) % mod;
}

void iadd(ll& lhs, const ll& rhs) {
	lhs = ((lhs%mod) + (rhs%mod)) % mod;
}

void isubt(ll& lhs, const ll& rhs) {
	ll ret = (lhs - rhs) % mod;
	lhs = ret + (ret < 0 ? mod : 0);
}

ll bpw(const ll& lhs, const ll& rhs) {
	if (rhs == 0)return 1;
	ll ret = bpw(lhs, rhs >> 1);
	imult(ret, ret);
	if (rhs & 1) imult(ret, lhs);
	return ret;
}

ll inv(const ll& x) {
	return bpw(x, mod - 2);
}

ll mult(const ll& lhs, const ll& rhs) {
	return ((lhs % mod) * (rhs % mod)) % mod;
}

ll add(const ll& lhs, const ll& rhs) {
	return ((lhs%mod) + (rhs%mod)) % mod;
}

ll subt(const ll& lhs, const ll& rhs) {
	ll ret = (lhs - rhs) % mod;
	return ret + (ret < 0 ? mod : 0);
}

ll div(const ll& lhs, const ll& rhs) {
	return mult(lhs, inv(rhs));
}

const int sz = 5e5;
int n;
int a[sz];

int main() {
	fast;
	cin >> n;
	ll sum = 0;
	foru(i, 0, n)
		cin >> a[i],  iadd(sum, mult(a[i], a[i]));
	sort(a, a + n);
	ll poly = a[0];
	foru(i, 1, n) {
		iadd(sum, mult(poly, a[i]));
		imult(poly, 2);
		iadd(poly, a[i]);
	}
	cout << sum << '\n';
	return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1<<30;
const ll inf_l = 1LL<<61;
const int MAX = 1e5;

const int mod = 1e9 + 7;
struct mint {
    ll x;
    mint (ll 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 {return mint(*this) += a;}
    mint operator -(const mint a) const {return mint(*this) -= a;}
    mint operator *(const mint a) const {return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {return pow(mod - 2);}
    mint operator /=(const mint a) {return *this *= a.inv();}
    mint operator /(const mint a) {return mint(*this) /= a;}
};
istream& operator >>(istream &is, mint &a) {return is >> a.x;}
ostream& operator <<(ostream &os, const mint &a) {return os << a.x;}

mint dp[2005][2005];
mint sum_v[2005][2005];
mint sum_h[2005][2005];
mint sum_d[2005][2005];

int main() {
    int h, w; cin >> h >> w;
    vector<string> field(h);
    rep(i,h) cin >> field[i];
    sum_v[1][1] = 1;
    sum_h[1][1] = 1;
    sum_d[1][1] = 1;
    dp[1][1] = 1;
    REP(i,h+1)REP(j,w+1) {
        if (field[i - 1][j - 1] == '#') continue;
        if (i == 1 && j == 1) continue;
        dp[i][j] = sum_v[i - 1][j] + sum_h[i][j - 1] + sum_d[i - 1][j - 1];
        sum_v[i][j] = sum_v[i - 1][j] + dp[i][j];
        sum_h[i][j] = sum_h[i][j - 1] + dp[i][j];
        sum_d[i][j] = sum_d[i - 1][j - 1] + dp[i][j];
    }
    cout << dp[h][w] << endl;
}

#include <bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n,m;
char a[510][510];
int cntr,cntb;
signed main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>(a[i]+1);
	for(int i=1;i<=m;i++){
		bool flgr=0,flgb=0;
		for(int x=1,y=i;x<=n&&y>=1;x++,y--){
			if(a[x][y]=='R')flgr=1;
			if(a[x][y]=='B')flgb=1;
		}
		if(flgr==1&&flgb==1)return puts("0"),0;
		if(flgr==1)cntr++;
		if(flgb==1)cntb++;
	}
	for(int i=2;i<=n;i++){
		bool flgr=0,flgb=0;
		for(int x=i,y=m;x<=n&&y>=1;x++,y--){
			if(a[x][y]=='R')flgr=1;
			if(a[x][y]=='B')flgb=1;
		}
		if(flgr==1&&flgb==1)return puts("0"),0;
		if(flgr==1)cntr++;
		if(flgb==1)cntb++;
	}
	int t=n+m-1LL-cntr-cntb;
//	cout<<t<<endl;
	int ans=1LL;
	for(int i=1;i<=t;i++)ans=ans*2LL%998244353LL;
	cout<<ans<<endl;
	return 0;
}
/*
rrb
rbr
brr

r.r
.br
...

#####
#####
#####
*/


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

// Constants
#define INF 2e18
#define EPS 1e-9
#define MOD 1000000007

// // for using in pairs
#define F first
#define S second

// Macros
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)

// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

template<typename T>
using oset = tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

// Temporary macro.
#define int long long

// Operator overloads.

/**
 * Both types in the pair should have overload for << operator with ostream.
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2>& p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

/**
 * The type of element in the vector should have overload for << operator with ostream.
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

template<typename T1, typename T2>
istream& operator>>(istream &istream, pair<T1, T2>& p)
{
	istream >> p.first >> p.second;
	return istream;
}

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

// Utility functions.

template<typename T>
T MIN(T first) { return first; }

template<typename T, typename... Args>
T MIN(T first, Args... args) { return min(first, MIN(args...)); }

template<typename T>
T MAX(T first) { return first; }

template<typename T, typename... Args>
T MAX(T first, Args... args) { return max(first, MAX(args...)); }

template <typename T>
void DEBUG(T&& t) {cout << t << "\n";}

template <typename T, typename... Args>
void DEBUG(T&& t, Args&&... args)
{
    cout << t << " ";
    DEBUG(forward<Args>(args)...);
}

template<typename T>
int32_t size_i(T& container) { return static_cast<int32_t>(container.size()); }

// Mathematical functions.

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = INF)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;
}

/**
 * m should be prime
 */
int modinv(int x, int m = MOD)
{
	return modpow(x, m - 2, m);
}

//////////////////// START CODE HERE ///////////////////////////

void preSolve()
{
}

struct comp
{
	int l, t, lt, val;
	comp()
	{
		l = 0;
		t = 0;
		lt = 0;
		val = 0;
	}
	comp(int l, int t, int lt, int val)
		: l(l), t(t), lt(lt), val(val) {}
	int sum() { return l + lt + t; }
};

void solve(int tc)
{
	int n, m;
	cin >> n >> m;
	char a[n + 1][m + 1];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];

	comp dp[n + 1][m + 1];
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= m; j++)
		{
			if (!i || !j)
				continue;
			if (a[i][j] == '#')
			{
				dp[i][j] = comp();
				continue;
			}
			if (i == 1 && j == 1)
			{
				dp[1][1] = comp(0, 0, 0, 1);
				continue;
			}
			dp[i][j] = comp();
			dp[i][j].l  += (dp[i][j - 1].val + dp[i][j - 1].l) % MOD;
			dp[i][j].t  += (dp[i - 1][j].val + dp[i - 1][j].t) % MOD;
			dp[i][j].lt += (dp[i - 1][j - 1].val + dp[i - 1][j - 1].lt) % MOD;
			dp[i][j].val = (dp[i][j].sum()) % MOD;
		}
	}

	cout << dp[n][m].val;
}

int32_t main()
{
	#ifdef LOCAL_PROJECT
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#else
		// freopen("input.txt", "r", stdin);
		// freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	preSolve();

	int t = 1;
	// cin >> t;
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}
	return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << " ";
    return out;
}

istream& operator>> (istream& in, pii& b) {
    in >> b.first >> b.second;
    return in;
}

ostream& operator<< (ostream& out, const pii& b) {
    out << "{" << b.first << ", " << b.second << "}";
    return out;
}

template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
#else
    #define dbg(x) 57
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
#endif

const ld PI = acos(-1);

#define time clock() / (double) CLOCKS_PER_SEC

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int MAXN = 110;
const int S = 150000;

int n, k, m;
int dp[MAXN][S];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k >> m;
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        int val = min(i, n - i - 1);
        int up = val * (val + 1) / 2 * k;
        for (int sum = 0; sum <= up; sum++) {
            for (int t = 0, tt = 0; t <= sum && tt <= k; t += i, tt++) {
                dp[i][sum] += dp[i - 1][sum - t];
                if (dp[i][sum] >= m) dp[i][sum] -= m;
            }
        }
    }
    for (int x = 1; x <= n; x++) {
        int ans = 0;
        int val = min(x - 1, n - x);
        int up = val * (val + 1) / 2 * k;
        for (int sum = 1; sum <= up; sum++) {
            ans += dp[x - 1][sum] * dp[n - x][sum] % m * (k + 1) % m;
            if (ans >= m) ans -= m;
        }
        ans += k;
        if (ans >= m) ans -= m;
        cout << ans << "\n";
    }
}
/*

*/

#include <bits/stdc++.h>

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

using namespace std;

int MOD;
class mint{
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long x,const mint& m){ return mint(x)+m; }
mint operator-(long long x,const mint& m){ return mint(x)-m; }
mint operator*(long long x,const mint& m){ return mint(x)*m; }
mint operator/(long long x,const mint& m){ return mint(x)/m; }

int main(){
	int n,k; scanf("%d%d%d",&n,&k,&MOD);

	int m=n*(n+1)/2*k;
	static mint buf[3000000];
	mint* a=&buf[1500000];

	a[0]=1;
	for(int i=1;i<n;i++){
		// * (1-X^{(k+1)*i})
		for(int j=m;j>=-m+(k+1)*i;j--) a[j]-=a[j-(k+1)*i];
		// / (1-X^i)
		for(int j=-m;j<=m-i;j++) a[j+i]+=a[j];
	}
	// * (k+1)
	for(int j=-m;j<=m;j++) a[j]*=k+1;

	cout<<a[0]-1<<'\n';

	for(int x=2;x<=n;x++){
		// * (1-X^{n+1-x})
		for(int j=m;j>=-m+n+1-x;j--) a[j]-=a[j-(n+1-x)];
		// / (1-X^{(k+1)*(n+1-x)})
		for(int j=-m;j<=m-(k+1)*(n+1-x);j++) a[j+(k+1)*(n+1-x)]+=a[j];

		// * X^{-k*(x-1)}
		for(int j=-m;j<=m-k*(x-1);j++) a[j]=a[j+k*(x-1)];
		// * (1-X^{(k+1)*(x-1)})
		for(int j=m;j>=-m+(k+1)*(x-1);j--) a[j]-=a[j-(k+1)*(x-1)];
		// / (1-X^(x-1))
		for(int j=-m;j<=m-(x-1);j++) a[j+(x-1)]+=a[j];

		cout<<a[0]-1<<'\n';
	}

	return 0;
}


#include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x)
#define pdd pair<dd,dd>
#define read_arr(a,n) for(ll i=1;i<=n;i++)cin>>a[i];
#define init_arr(a,n) for(ll i=1;i<=n;i++)a[i]=n-i+1;
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
#define arr array
using namespace std;
ll a[200005];
int main(){
	ll n,x;
	cin>>n>>x;
	ll tot=0;
	ll sol=-1;
	for(ll i=1;i<=n;i++){
		ll v,p;
		cin>>v>>p;
		tot+=v*p;
		if(tot>x*100 and sol==-1){
			sol=i;
		}
	}
	cout<<sol;

}

#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int N;
    ll X;
    cin >> N >> X;

    vector<ll> V(N);
    vector<ll> P(N);

    for (int i = 0; i < N; ++i) {
        cin >> V.at(i) >> P.at(i);
    }

    ll total = 0;

    for (int i = 0; i < N; ++i) {
        total += P.at(i) * V.at(i);

        if(total > X * 100){
            cout << i + 1 << endl;
            return 0;
        }
    }

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


#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr)->sync_with_stdio(false);
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  if (d * c - b > 0)
    cout << (a + d * c - b - 1) / (d * c - b) << '\n';
  else
    cout << "-1\n";
}

/**
*    author:  velengel
*    created: 24.04.2021 21:04:04
**/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

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

  int a,b,c;
  cin>>a>>b>>c;
  cout<<((a*a+b*b<c*c)?"Yes":"No")<<endl;

  return 0;
}


#include <iostream>
using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b!=c){
    cout<<c;
  }
  if(a==c && c!=b){
    cout<<b;
  }
  if(b==c && c!=a){
    cout<<a;
  }
  if(a==b && b==c){
    cout<<a;
  }
  if(a!=b && b!=c && c!=a){
    cout<<0;
  }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;

#define forn(i,x,n) for(long long int i = x; i < n; ++i)
# define pb push_back
# define mp make_pair

struct node
{
    char c;
    ll v;
};

vector<ll> variable_list(10);

ll find_num(string a, ll count, node* my_struct){
    ll i=0,m=1,j;
    ll val=0;
    for (i = a.length() - 1; i >= 0; i--)
    {
        char ch = a[i];
        for (j = 0; j < count; j++)
            if (my_struct[j].c == ch)
                break;

        val += m * my_struct[j].v;
        m *= 10;
    }
    return val;
}
ll sum_check(node* my_struct, const ll count, string s1, string s2, string s3){
    ll val1 = find_num(s1, count, my_struct);
    ll val2 = find_num(s2, count, my_struct);
    ll val3 = find_num(s3, count, my_struct);
    if (val3 == (val1 + val2)) return 1;
    return 0;
}

bool permute_string(const ll count, node* my_struct, ll n, string s1, string s2, string s3)
{
    if (n == count - 1) {
        forn(i,0,10) {
            if (variable_list[i] == 0) {

                if(i==0 && (my_struct[n].c == s1[0] || my_struct[n].c == s2[0] || my_struct[n].c == s3[0] )){continue;}
                my_struct[n].v = i;

                if (sum_check(my_struct, count, s1, s2, s3) == 1)
                {
                    map <char,ll> m;
                    for (ll j = 0; j < count; j++){
                        m[my_struct[j].c] = my_struct[j].v;
                    }

                    forn(i,0,s1.length()) cout<< m[s1[i]];
                    cout<<endl;
                    forn(i,0,s2.length()) cout<< m[s2[i]];
                    cout<<endl;
                    forn(i,0,s3.length()) cout<< m[s3[i]];
                    cout<<endl;
                    return true;
                }
            }
        }
        return false;
    }

    forn(i,0,10)
    {
        if (variable_list[i] == 0)
        {

            if(i==0 && (my_struct[n].c == s1[0] || my_struct[n].c == s2[0] || my_struct[n].c == s3[0] )){continue;}
            my_struct[n].v = i;
            variable_list[i] = 1;

            if (permute_string(count, my_struct, n + 1, s1, s2, s3))
                return true;

            variable_list[i] = 0;
        }
    }
    return false;
}

bool alphametic(string s1, string s2, string s3)
{
    vector<ll> freq(26);
    ll count = 0;
    ll l1 = s1.length();
    ll l2 = s2.length();
    ll l3 = s3.length();

    forn(i,0,s1.length()) freq[s1[i] - 'a']++;
    forn(i,0,s2.length()) freq[s2[i] - 'a']++;
    forn(i,0,s3.length()) freq[s3[i] - 'a']++;

    forn(i,0,26) if (freq[i] > 0) count++;

    if (count > 10) return 0;

    node my_struct[count];
    ll j=0;
    forn(i,0,26) {
        if (freq[i] > 0) {
            my_struct[j].c = char(i + 'a'); j++;
        }
    }
    return permute_string(count, my_struct, 0, s1, s2, s3);
}

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    if (!alphametic(a, b, c))
        cout << "UNSOLVABLE"<<endl;
    return 0;
}


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

int main() {
  long long N, p, q;
  cin >> N;
  p = 0;
  q = N * (N - 1) * 0.5;
  vector<int> A(N);
  rep(i, N){
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  rep(i, N - 1){
    if(A.at(i) == A.at(i + 1)){
      p++;
    }
    else{
      q = q - p * (p + 1) * 0.5;
      p = 0;
    }
  }
  q = q - p * (p + 1) * 0.5;
  cout << q << endl;
}

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

#define FOR(x, a, b) for (int x = a; x <= b; x++)
#define FOD(x, a, b) for (int x = a; x >= b; x--)
#define REP(x, a, b) for (int x = a; x < b; x++)
#define RED(x, a, b) for (int x = a; x > b; x--)

void solve() {
    int n, res = 0;
    cin >> n;
    vector<int> x(n), y(n);

    REP(i, 0, n) cin >> x[i] >> y[i];

    REP(i, 0, n - 1) {
        REP(j, i + 1, n) {
            if (abs(1.0 * (y[j] - y[i]) / (x[j] - x[i])) <= 1) {
                res ++;
            }
        }
    }

    cout << res;
}

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

//    cin >> tests;
//    while (tests--) {
//        solve();
//    }

    solve();
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int main(){
  long long N;
  rd(N);
  long long res = 0;
  long long x = 1;
  long long y;
  long long c = 0;
  for(;;){
    y =min_L(x * 1000, N+1);
    if(x >= y){
      break;
    }
    res += c * (y - x);
    c++;
    x *= 1000;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay version 20210227-1

// --- original code ---
// {
//   ll @N, res = 0, x = 1, y, c = 0;
//   for(;;){
//     y = min(x * 1000, N+1);
//     if(x >= y) break;
//     res += c * (y - x);
//     c++;
//     x *= 1000;
//   }
//   wt(res);
// }


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

int main(){
int a,b;
  cin >>a>>b;
  vector<vector<char>> vec(a,vector<char>(b));
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      cin >>vec[i][j];
    }
  }
  vector<int> x={-1,1,0,0};
  vector<int> y={0,0,1,-1};
  int ans=0;
  for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
      if(vec[i][j]=='.'){
        vec[i][j]='#';
        for(int k=0;k<4;k++){
          if(i+x[k]<0||j+y[k]<0||i+x[k]>=a||j+y[k]>=b){
            continue;
          }

          if(vec[i+x[k]][j+y[k]]=='.'){
            ans++;

          }
        }
      }
    }
  }
  cout << ans <<endl;
}

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

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

const ll MOD = 1e9 + 7;
const int N = 2e3;

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

int h, w, k;
string st[N + 5];
int hr[N + 5][N + 5][2], vr[N + 5][N + 5][2];

void solve() {
  cin >> h >> w;
  for(int i = 0; i < h; i++) {
    cin >> st[i];
    for(int j = 0; j < w; j++) {
      k += (st[i][j] == '.');
    }
  }
  for(int i = 0; i < h; i++) {
    int ed;
    ed = 0;
    for(int j = 0; j < w; j++) {
      if(st[i][j] == '#') ed = j + 1;
      else {
        hr[i][j][0] = ed;
      }
    }
    ed = w + 1;
    for(int j = w - 1; j >= 0; j--) {
      if(st[i][j] == '#') ed = j + 1;
      else {
        hr[i][j][1] = ed;
      }
    }
  }
  for(int i = 0; i < w; i++) {
    int ed;
    ed = 0;
    for(int j = 0; j < h; j++) {
      if(st[j][i] == '#') ed = j + 1;
      else {
        vr[j][i][0] = ed;
      }
    }
    ed = h + 1;
    for(int j = h - 1; j >= 0; j--) {
      if(st[j][i] == '#') ed = j + 1;
      else {
        vr[j][i][1] = ed;
      }
    }
  }
  ll ans = 0;
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      if(st[i][j] == '#') continue;
      int ni = i + 1, nj = j + 1;
      int tot_hr = hr[i][j][1] - hr[i][j][0] - 1;
      int tot_vr = vr[i][j][1] - vr[i][j][0] - 1;
      // cerr << i << ' ' << j << ' ' << tot_hr << ' ' << tot_vr << '\n';
      // for(int x = 0; x < 2; x++) {
      //   cerr << hr[i][j][x] << ' ' << vr[i][j][x] << '\n';
      // }
      int tot = tot_hr + tot_vr - 1;
      ll temp = (fastexpo(2, k) - fastexpo(2, k - tot));
      ans = (ans + temp) % MOD;
    }
  }
  if(ans < 0) ans += MOD;
  cout << ans << '\n';
}

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

  int TC = 1;
  for(int i = 1; i <= TC; i++) {
    solve();
  }

  return 0;
}


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

#define FAST_IO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define show(x)  cerr << #x << " = " << x << '\n'
#define endl     '\n'
typedef long long ll;
typedef unsigned long long ull;
const double EPS = 1e-10;  // epsilon
const double PI = acos(-1);
const ll MOD = (ll)1e9 + 7;
const int N = 2e5 + 5;

int t = 1;
string s;

int main()
{
    FAST_IO
    //scanf("%d", &t);
    while (t--)
    {
        cin >> s;
        for (auto& c : s)
        {
            if (c == '.')
                break;
            cout << c;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	string x;
	cin>>x;
	int pos;
	if(x.find(".")!=string::npos)
	{
		pos=x.find(".");
		cout<<x.substr(0,pos);
	}
	else
	cout<<x;
	return 0;
}


#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
int M;
int A[100];
int main(){
  int res;
  rd(N);
  rd(K);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N-1);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    int cTE1_r3A;
    if(N-1==0){
      cTE1_r3A = 0;
    }
    else{
      cTE1_r3A = A[0];
      for(e98WHCEY=(1);e98WHCEY<(N-1);e98WHCEY++){
        cTE1_r3A += A[e98WHCEY];
      }
    }
    res = N*M-cTE1_r3A;
  }
  if(res < 0){
    res = 0;
  }
  if(res > K){
    res = -1;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200112-1

// --- original code ---
// int N, K, M, A[100];
// {
//   int res;
//   rd(N,K,M,A(N-1));
//   res = N*M-sum(A(N-1));
//   if(res < 0) res = 0;
//   if(res > K) res = -1;
//   wt(res);
// }

#include <bits/stdc++.h>
using namespace std;
const long long mod1 = 1000000007;
using ll = long long;
using graph = vector<vector<int>>;
vector<ll> dx = {0,-1,0,1};
vector<ll> dy = {-1,0,1,0};

long long pow(long x,long n){
    long long ans = 1;
    while(n != 0){
        long long a = x;
        long long z = 1;
        while(z*2 <= n){
            a *=a;
            a=a%mod1;
            z*=2;
        }
        ans*=a;
        ans=ans%mod1;
        n-=z;
    }
    return ans;
}//累乗 x^n

template<typename T>
void input_vec(vector<T> &A,long long N){
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    return;
}//入力を配列で受け取る

template<typename T>
void output_vec(vector<T> &A,long long N){
    for(int i = 0; i < N; i++){
        if(i != 0){
            cout << " ";
        }
        cout << A.at(i);
    }
    cout << endl;
    return;
}//配列を出力

template<typename T>
long long count_vec(vector<T> &A,T x){
    long long counter = 0;
    for(int i = 0; i < (int)A.size(); i++){
        if(A.at(i) == x){
            counter++;
        }
    }
    return counter;
}//配列内のxの個数をreturn

vector<char> change_vec(string s,int n){
    vector<char> ans(n);
    for(int i = 0; i < n; i++){
        ans.at(i) = s.at(i);
    }
    return ans;
}//長さがnの文字列を配列に変換

vector<ll> change_vec2(ll x){
    vector<ll> ans;
    while(x != 0){
        ans.push_back(x%10);
        x/=10;
    }
    return ans;
}//数列を配列に変換

ll sort_big(ll x){
    vector<ll> vec = change_vec2(x);
    sort(vec.begin(),vec.end());
    ll ans = 0;
    for(int i = (int)vec.size()-1; i >= 0 ; i--){
        ans += vec.at(i);
        if(i != 0) ans*=10;
    }
    return ans;

}//桁ごとに大きい順に並べ替え

ll sort_small(ll x){
    vector<ll> vec = change_vec2(x);
    sort(vec.begin(),vec.end());
    ll ans = 0;
    for(int i = 0; i < (int)vec.size();i++){
        ans += vec.at(i);
        if(i+1 != (int)vec.size()) ans*= 10;
    }
    return ans;
}//桁ごとに小さい順に並べ替え

int main(){
    string C; cin >> C;
    bool ans = false;
    if(C.at(0) == C.at(1) && C.at(0) == C.at(2)) ans = true;

    if(ans) cout << "Won" << endl;
    else cout << "Lost" << endl;

}


#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void perr0(){}; template<typename H,typename... T> void perr0(H h,T... t){cerr<<h;perr0(t...);}
void perr(){perr0("\n");}; template<typename H,typename... T>void perr(H h,T... t){perr0(h);if(sizeof...(T)>0)perr0(" ");perr(t...);}
void ioinit() { cout << fixed << setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on

vector<ll> makedivprimes(ll n) {
    vector<ll> divprimes(n + 1, -1);
    vector<bool> isprime(n + 1, true);
    isprime[0] = false;
    isprime[1] = false;
    for (ll i = 2; i <= n; i++) {
        if (isprime[i]) {
            divprimes[i] = i;
            for (ll j = 2 * i; j <= n; j += i) {
                divprimes[j] = i;  // その数をふるい落とした素数を記録
                isprime[j] = false;
            }
        }
    }
    return divprimes;
}
map<ll, ll> prime_factor_fast(ll n, vector<ll>& divprimes) {
    map<ll, ll> result;
    ll ni = n;
    while (ni >= 2) {
        ll p = divprimes[ni];
        if (!result.count(p)) {
            result[p] = 0;
        }
        result[p]++;
        ni = ni / p;
    }
    return result;
}

int main() {
    ioinit();
    ll l, r;
    cin >> l >> r;

    auto divprimes = makedivprimes(1000009);
    ll gans = 0;
    for (ll x = l; x < r; x++) {
        if (x == 1 || divprimes[x] == x) continue;

        ll ans = 0;
        auto pfs = prime_factor_fast(x, divprimes);
        vector<ll> primes;
        for (auto pf : pfs) {
            primes.push_back(pf.first);
        }
        ll m = primes.size();
        for (ll i = 0; i < (1ULL << m); i++) {
            ll usepr = 0;
            ll v = 1;
            for (ll j = 0; j < m; j++) {
                if ((i >> j) & 1) {
                    v *= primes[j];
                    usepr++;
                }
            }
            if (usepr == 0) {
                continue;
            }
            ll sign = 1;
            if (usepr % 2 == 0) {  // 包除原理？
                sign = -1;
            }
            // x+kv<=r;
            // k<=(r-x)/v
            ll k = (r - x) / v;
            for (ll kk = k - 1; kk <= k + 1; kk++) {
                if (x + kk * v <= r) k = kk;
            }
            if (k >= 1) {
                ans += sign * k;
            }
            //perr(x, ans);
        }
        // 最後にxの倍数を除去
        {
            ll k = (r - x) / x;
            for (ll kk = k - 1; kk <= k + 1; kk++) {
                if (x + kk * x <= r) k = kk;
            }
            if (k >= 1) {
                ans -= k;
            }
            //perr(x, ans);
        }
        //perr(x, ans);
        gans += ans;
    }
    print(gans * 2);
}

#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int L, R; cin >> L >> R;

    vector<ll> cnt(R + 1, 0);
    for (int i = R; i >= 2; i--) {
        cnt[i] = R / i - (L - 1) / i;
        cnt[i] *= cnt[i];
        for (int j = i + i; j <= R; j += i) cnt[i] -= cnt[j];
    }

    ll ans = accumulate(ALL(cnt), 0LL);
    REP(i, max(L, 2), R + 1) {
        ans -= 2LL * (R / i - (L - 1) / i);
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define Bs binary_search
#define In insert
#define Mp make_pair
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second

const int mx1 = 35;
const int mx2 = 105;
const int mx3 = 2005;
const int mx4 = 10005;
const int mx5 = 200005;
const int mx6 = 1000005;

typedef vector<int> Vi;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vi> VVi;
typedef pair<int, int> Pii;
typedef pair<DD, DD> Pdd;
typedef vector<Pii> Vpi;
typedef vector<Pdd> Vpd;
typedef queue<int> Qi;
typedef stack<int> Si;
typedef deque<int> Di;

int _toggle(int N, int pos) {return N = N ^ (1 << pos);}
int _set(int N, int pos) {return N = N | (1 << pos);}
int _reset(int N, int pos) {return N = N & ~(1 << pos);}
bool _check(int N, int pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

int dx[] = {1, -1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};

///******************************************************///

const int inf = 1e9;
int n, m, a[mx3][mx3], self[mx3], dist[mx3][mx3];
Vpi g[mx3];

void dijkstra(int sr)
{
    priority_queue<Pii, vector<Pii>, greater<Pii>> Q;
    for(int i = 1; i <= n; i++){
        dist[sr][i] = a[sr][i];
        if(a[sr][i] < inf){
            Q.push({a[sr][i], i});
        }
    }
    while(!Q.empty()){
        int v = Q.top().Y;
        int d_v = Q.top().X;
        Q.pop();
        if(d_v != dist[sr][v]){
            continue;
        }
        for(auto i: g[v]){
            int to = i.X;
            int len = i.Y;
            if(dist[sr][v] + len < dist[sr][to]){
                dist[sr][to] = dist[sr][v] + len;
                Q.push({dist[sr][to], to});
            }
        }
    }
}

void solve()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            a[i][j] = inf;
        }
        self[i] = inf;
    }
    for(int i = 1; i <= m; i++){
        int u, v, w;
        cin >> u >> v >> w;
        if(u == v){
            self[u] = min(self[u], w);
        }
        else{
            a[u][v] = min(a[u][v], w);
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(a[i][j] < inf){
                g[i].Pb({j, a[i][j]});
            }
        }
    }
    for(int i = 1; i <= n; i++){
        dijkstra(i);
        int ans = min(dist[i][i], self[i]);
        if(ans == inf){
            ans = -1;
        }
        cout << ans << '\n';
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    int tc = 1;
    //cin >> tc;
    while(tc--){
        solve();
    }
}

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;
/* using namespace atcoder; */

using ll = long long;
using P = pair<int, int>;

const ll INF = 1 << 30;

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

struct Data {
  int to;
  ll cost;
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> dist(n, INF);
  vector<vector<ll>> G2(n, vector<ll>(n, INF));
  vector<vector<Data>> G(n, vector<Data>());
  rep(i, m) {
    int a, b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    if (a == b) {
      chmin(dist.at(a), c);
    } else {
//      chmin(G2.at(a).at(b), c);
      Data d = {b, c};
      G.at(a).push_back(d);
    }
  }
//  vector<vector<Data>> G(n, vector<Data>());
//  rep(i, n) {
//    rep(j, n) {
//      if (i == j) continue;
//      Data d = {j, G2.at(i).at(j)};
//      G.at(i).push_back(d);
//    }
//  }

  vector<vector<ll>> dist2(n, vector<ll>(n, INF));
  rep(i, n) {
    vector<ll> dist3(n, INF);
    dist3.at(i) = 0;
    priority_queue<pair<ll, int>, vector<pair<ll, int>>,
        greater<pair<ll, int>>> que;
    que.push(make_pair(dist3.at(i), i));
    while (!que.empty()) {
      int v = que.top().second;
      ll d = que.top().first;
      que.pop();
      if (d > dist3.at(v)) continue;
      for (auto e : G.at(v)) {
        if (e.to == i) {
          continue;
        }
        if (chmin(dist3.at(e.to), dist3.at(v) + e.cost)) {
          que.push(make_pair(dist3.at(e.to), e.to));
        }
      }
    }
    rep(j, n) {
//      cerr << dist3.at(j) << " ";
      dist2.at(i).at(j) = dist3.at(j);
    }
//    cerr << endl;
  }
  rep(i, n) {
    rep(j, n) {
      if (i == j) continue;
      dist.at(i) = min(dist.at(i), dist2.at(i).at(j) + dist2.at(j).at(i));
    }
  }
  rep(i, n) {
    cout << ((dist.at(i) == INF) ? -1 : dist.at(i)) << endl;
  }
  return 0;
}


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

template <typename T>
struct SegmentTree {
  int n;
  vector<T> node;
  using FX = function<T(T, T)>; // T•T -> T となる関数の型
  FX fx;
  const T ex; // 単位元(RMQの時はex=INFint)

  // 元配列 v をセグメント木で表現する
  SegmentTree(vector<T> v, FX fx_, T ex_): fx(fx_), ex(ex_) {
    int sz = v.size();
    n = 1; while(n < sz) n *= 2; // 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
    node.resize(2 * n - 1, ex); // セグメント木全体で必要なノード数は 2n-1 個である

    for(int i = 0; i < sz; i++) node[i + n - 1] = v[i]; // 配列そのままが入るのはindex n-1から
    for(int i = n - 2; i >= 0; i--) node[i] = fx(node[2 * i + 1], node[2 * i + 2]); // 下の段から順に初期値を計算していく(根はnode[0])
  }
  void update(int x, T val) {
    x += n - 1; // 最下段のノードにアクセスする
    node[x] = val;
    while(x > 0) {
      x = (x - 1) / 2; // 自分の親ノードに行く
      node[x] = fx(node[2 * x + 1], node[2 * x + 2]);
    }
  }
  T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
  T query_sub(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return ex;
    if (a <= l && r <= b) return node[k];

    T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
    return fx(vl, vr);
  }
  T get(int x) { // もとの配列のx番目(0-indexed)の値を返す
    return node[x + n - 1];
  }
  void print(){ // 最下段[n-1,2n-1)のn個を出力する
    for(int i(0); i < n; i++) cout << node[i + n - 1] << " ";
    cout << endl;
  }
  void printall(){ // 全てのノードの値を出力する
    for(int i(0); i<2 * n; i++) cout << node[i] << " ";
    cout << endl;
  }
};

int main(){
  int N, Q;
  cin>>N>>Q;
  vector<int> A(N);
  for(int i(0);i<N;i++) cin>>A[i];
  SegmentTree<int> stree(A, [](int x, int y){return (x ^ y);}, 0);
  for(int i(0);i<Q;i++){
    int t, x, y;
    cin>>t>>x>>y;
    x--;
    if (t == 1){
      stree.update(x, stree.get(x) ^ y);
    } else {
      cout << stree.query(x, y) << endl;
    }
  }
  return 0;
}

// C++ program to show Segment Tree - XOR of range
#include<bits/stdc++.h>
using namespace std;
#define w(x)            int x; cin>>x; while(x--)
#define nl              "\n"
#define fr(i,t)         for(int i=0;i<t;i++)
#define fr1(i,a,b)      for(int i = a; i<b; i++)
#define frr(i,n)        for(int i = n; i>=0; i--)
#define frr1(i,a,b)     for(int i = a; i>=b; i--)
#define dbug(x)         cout<<#x<<"="<<x<<endl;
#define debug(v, n)     fr(i,n){cout<<v[i]<<" ";if(i == n-1)cout<<nl;}
#define debug1(v, a, b) cout<<#v<<nl;fr1(i,a,b){cout<<v[i]<<" ";if(i == b)cout<<nl;}
#define fast            ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb				push_back
#define ff 		    	first
#define ss 		    	second
#define pii				pair<int, int>
#define ll				long long int
// int                      -10**9  to 10**9        4 byte       -2**31 to +2**31    -2147483647 to +2147483648
// long long int            -10**19 to 10**19       8 byte       -2**63 to +2**63
// unsigned long long int   -0      to 10**20       8 byte          0   to +2**64
// log(10 ** 5)             16.60
// log(10 ** 6)             19.93
// log(10 ** 9)             29.89
// INT_MAX                  0x7fffffff 2147483647
const int M1  = 1000000007;
const int M2  = 998244353;
const int N = 300005;

int BIT[N];

int arr[N];

void update(int idx, int val, int n){
    while(idx<=n){
        BIT[idx] ^= val;
        idx += idx & (-idx);
    }
}

void build (int n){
    fr1(i,1,n+1){
        update(i,arr[i-1],n);
    }
}

ll getxor(int idx){
    ll sum = 0;
    while(idx){
        sum ^= BIT[idx];
        idx -= idx & (-idx);
    }
    return sum;
}

void showBIT(int n){
    cout<<"BIT content : "<<nl;
    fr1(i,1,n+1){
        cout<<BIT[i]<<" ";
    }
}
int main()
{
    int n,q,type,a,b;
    cin>>n>>q;
    fr(i,n){
        cin>>arr[i];
    }
    build(n);
    fr(i,q){
            cin>>type>>a>>b;
            if(type == 1){
                update(a, b, n);
            }

            else{
                cout<<(getxor(b) ^ getxor(a-1))<<nl;
            }

        }
}


#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1e9+7LL;

vector<ll> IntegerToVector(ll bit, ll N) {
    vector<ll> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

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

int main() {
    ll N; cin >> N;
    vector<ll> X(N);
    rep(i, N){
        cin >> X[i];
    }

    ll ans = 1e18;
    vector<ll> pr = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
    rep2(i,1,1<<15){
        vector<ll> S = IntegerToVector(i,15);
        ll s = S.size();
        ll res = 1;
        bool flag = true;
        rep(j, s) res *= pr[S[j]];
        rep(j, N){
            if(gcd(res,X[j])==1) flag = false;
        }
        if(flag&&res<ans) ans = res;
    }
    cout << ans << endl;
}

/*
                    __
                   /\ \
 _ __   ___     ___\ \ \/'\     ___      __      ___     ___      __
/\`'__\/ __`\  /'___\ \ , <    / __`\  /'__`\  /' _ `\ /' _ `\  /'__`\
\ \ \//\ \L\ \/\ \__/\ \ \\`\ /\ \L\ \/\ \L\.\_/\ \/\ \/\ \/\ \/\ \L\.\_
 \ \_\\ \____/\ \____\\ \_\ \_\ \____/\ \__/.\_\ \_\ \_\ \_\ \_\ \__/.\_\
  \/_/ \/___/  \/____/ \/_/\/_/\/___/  \/__/\/_/\/_/\/_/\/_/\/_/\/__/\/_/

*/

#ifndef __AHA__HEADER
#define __AHA__HEADER

#include <bits/stdc++.h>
using namespace std;
#define g0 get<0>
#define g1 get<1>
#define g2 get<2>
#define ft first
#define sd second
#define sz(x) (i6) x.size()
#define psb(x) push_back(x)
#define ppb() pop_back()
#define bg(x) x.begin()
#define ed(x) x.end()
#define col(x) x.begin(), x.end()
#define srt(x) sort(x.begin(), x.end())
#define vec vector
#define deq deque
#define hmap unordered_map
#define pq priority_queue
#define fn function
#ifdef LOCAL
#define git stauDBG_MACRO_NO_WARNING
#include <dbg.h>
#define dbgt dbg(dbg::time())
#else
#define dbg(...)
#define dbgt
#endif
typedef string str;
typedef int32_t i3;
typedef int64_t i6;
typedef int64_t i64;
typedef uint32_t u3;
typedef uint64_t u6;
typedef long double d6;
typedef pair<i6, i6> p6;
typedef vec<i6> vi6;
typedef vec<p6> vp6;
typedef vec<bool> vb;
typedef vec<vi6> vv;
typedef deq<p6> dp6;
typedef deq<i6> di6;
typedef map<i6, i6> mi6;
typedef map<p6, i6> mp6;
typedef set<i6> si6;
typedef hmap<i6, i6> hi6;
typedef vv graph;
typedef vv matrix;

const i6 INF = INT64_MAX / 4;
const i6 NINF = -INF;
const i6 ZERO = 0;
const i6 ONE = 1;

#endif

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifdef LOCAL
  ifstream cin{"input.txt"};
  ofstream cout{"output.txt"};
#endif

  i64 n;
  cin >> n;

  d6 res = 0;
  for (i64 i = 1; i < n; i++) {
    res += n / (double)(n - i);
  }

  cout << std::setprecision(11);
  cout << fixed;

  cout << res << endl;

  return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    cout << 2*a + 100 - b;
}

#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
    for(ll i : x) {
        cout << i << " ";
    }
    cout << endl;
}
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v, m;
ll codeforces = 1;
string S, T;
vector<vl> g(MAX_N);
vl A, B;
void input() { cin >> x >> y; }
void solve() { print(x * 2 + 100 - y); }
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    while(codeforces--) {
        solve();
    }
}


/*
 *   ##   #####   ####      ####  #    #  ####
 *  #  #  #    # #    #    #    # #    # #    #
 * #    # #####  #         #    # #    # #    #
 * ###### #    # #         #    # # ## # #    #
 * #    # #    # #    #    #    # ##  ## #    #
 * #    # #####   ####      ####  #    #  ####
 */
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair <int, int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define info() cerr << __PRETTY_FUNCTION__ << ": " << __LINE__ << endl
void abc() {cerr << endl;}
template <typename T, typename ...U> void abc(T a, U ...b) {
    cerr << a << ' ', abc(b...);
}
template <typename T> void printv(T l, T r) {
    while (l != r) cout << *l << " \n"[++l == r];
}
template <typename A, typename B> istream& operator >> (istream& o, pair<A, B> &a) {
    return o >> a.X >> a.Y;
}
template <typename A, typename B> ostream& operator << (ostream& o, pair<A, B> a) {
    return o << '(' << a.X << ", " << a.Y << ')';
}
template <typename T> ostream& operator << (ostream& o, vector<T> a) {
    bool is = false;
    for (T i : a) {o << (is ? ' ' : '{'), is = true, o << i;}
    return o << '}';
}
template <typename T> struct vv : vector <vector <T>> {
    vv(int n, int m, T v) : vector <vector <T>> (n, vector <T>(m, v)) {}
    vv() {}
};
template <typename T> struct vvv : vector <vv <T>> {
    vvv(int n, int m, int k, T v) : vector <vv <T>> (n, vv <T>(m, k, v)) {}
    vvv() {}
};
#ifdef Doludu
#define test(args...) info(), abc("[" + string(#args) + "]", args)
#define owo void(0)
#else
#define test(args...) void(0)
#define owo ios::sync_with_stdio(false); cin.tie(0)
#endif
const int mod = 1e9 + 7, N = 400001, logC = 30, logN = 19, K = 111, M = 4e6;

vector <int> adj[N];
bool vis[N];
int edge, pt;

void dfs(int v) {
    edge += adj[v].size();
    vis[v] = true;
    pt++;
    for (int u : adj[v]) if (!vis[u]) {
        dfs(u);
    }
}

int main () {
    owo;
    int n;
    cin >> n;
    for (int i = 0, u, v; i < n; ++i) {
        cin >> u >> v, --u, --v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) if (!vis[i]) {
        dfs(i);
        edge >>= 1;
        if (edge >= pt) ans += pt;
        else ans += pt - 1;
        edge = pt = 0;
    }
    cout << ans << endl;
}

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>
#include <functional>
#include <cassert>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using ld = long double;
using vld = vector<ld>;
using vb = vector<bool>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}
template <class T> ostream& operator<<(ostream& s, const vector<T>& a) { for(auto i : a) s << i << ' '; return s; }

constexpr ll INFL = 1LL << 60;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

vvll g;
vll c;
ll cc;

void dfs(ll now, ll cc) {
    c[now] = cc;
    for(ll nxt : g[now]) {
        if(c[nxt] != -1) continue;
        dfs(nxt, cc);
    }
}

void solve() {
    ll n;
    cin >> n;
    const int maxn = 400000;
    g.assign(maxn+1, vll(0));
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    c.assign(maxn, -1);
    cc = 0;
    rep(i, maxn) {
        if(c[i] != -1) continue;
        dfs(i, cc);
        ++cc;
    }
    assert(cc > 0);
    vll v(cc), e(cc);
    rep(i, maxn) {
        assert(c[i] < cc);
        ++v[c[i]];
        e[c[i]] += g[i].size();
    }
    rep(i, cc) e[i] /= 2;
    ll ans = 0;
    rep(i, cc) {
        if(e[i] == v[i] - 1) ans += v[i] - 1;
        else ans += v[i];
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

int main(void){
    string s,t;
    cin >> s >> t;
    if(s == "Y"){
        if(t == "a")cout << "A";
        else if(t == "b")cout << "B";
        else cout << "C";
    } else cout << t;

}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
#define ll long long
using namespace std;
int n;ll k,s3[3000010],s2[3000010],f2[3000010],s[1000010];
void solve1(int sum,int fir,ll k)
{
	ll sec=max(1ll,sum-fir-n)+k-1;
	printf("%lld %lld %lld",fir,sec,sum-fir-sec);
	exit(0);
}
void solve(int sum,ll k)
{
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]+f2[sum-i];
		if(s[i]>=k)
			solve1(sum,i,k-s[i-1]);
	}
}
signed main()
{
	scanf("%lld %lld",&n,&k);
	for(int i=2;i<=2*n;i++)
	{
		f2[i]=n-abs(i-(n+1));
		s2[i]=s2[i-1]+f2[i];
	}
	for(int i=2*n+1;i<=3*n;i++)
		s2[i]=s2[i-1];
	for(int i=3;i<=3*n;i++)
		s3[i]=s3[i-1]+s2[i-1]-s2[max(0ll,i-n-1)];
	for(int i=3;i<=3*n;i++)
		if(s3[i]>=k)
			solve(i,k-s3[i-1]);
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rem(i, s, n) for (int i = (s); i >= (n); --i)
using ll = long long;
const int MOD = 1e9 + 7;

int main(){
    int n, k, m; cin >> n >> k >> m;
    vector<int> a(n); rep(i, 0, n) cin >> a[i];

    int sum = accumulate(a.begin(), a.end(), 0);
    int g = n * m;
    if (g - sum > k) cout << -1 << endl;
    else cout << max((g - sum), 0) << endl;

    return 0;
}

#include<iostream>

using namespace std;

int main(){
    int n, k, m;
    cin >> n >> k >> m;
    int sum = 0;
    for (int i = 0; i < n-1; i++)
    {
        int ai;
        cin >> ai;
        sum += ai;
    }
    int ans = n * m - sum;
    if (ans <= k)
    {
        if(ans<0)
            ans = 0;
        cout << ans << endl;
        return 0;
    }
    cout << "-1" << endl;
    return 0;
}


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

void solve()
{
    ll r, x, y;
    cin >> r >> x >> y;
    double d = sqrt(x * x + y * y);
    ll k = ceil(d / r);
    if (d == r)
        cout << "1";
    else if (d <= 2 * r)
        cout << "2";
    else
        cout << k;
}

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

    ll t = 1;
    // cin>>t;
    while (t--)
    {
        solve();
        cout << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
#pragma GCC optimize ("-O2")
using namespace std;
#define el              "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fo(a,n) for(int i=a;i<n;i++)
#define rep(i,a,b) for (int i = a; i < b; i++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))

#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif

void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}

void _print(double t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

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

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = ((int)result * base) % mod;
		base = ((int)base * base) % mod;
		exp >>= 1;
	}
	return result;
}

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

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//c_p_c();
	int a, b, c;
	cin >> a >> b >> c;
	if (!(c & 1)) {
		a = abs(a);
		b = abs(b);
	}
	if (a < b) cout << "<";
	else if (a == b) cout << "=";
	else cout << ">";
	return 0;
}