#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>

/* MACROS START */
#define input std::cin
#define for2(i,n) for(int i=0; i<n; i++)
#define for3(i,a,n) for(int i=a; i<n; i++)
#define for4(i,a,n,s) for(int i=a; i<n; i+=s)

using lint = long long int;
using namespace std;

template <typename T>
void printvec(T vec) {
  for (auto& a: vec)
	cout << a << " ";
  cout << endl;
}
/* MACROS END */

/* LIBRARY START */
/* LIBRARY END */

struct Expectation {
  double exact = 0, variable = 0;

  Expectation& operator+=(const Expectation& other) {
	this->exact += other.exact;
	this->variable += other.variable;
	return *this;
  }

  Expectation& operator-=(const Expectation& other) {
	this->exact -= other.exact;
	this->variable -= other.variable;
	return *this;
  }
};

Expectation operator/(const Expectation& e, double d) {
  return {e.exact/d, e.variable/d};
}

Expectation operator+(const Expectation& e, int d) {
  return {e.exact+d, e.variable};
}

int main() {
  std::ios_base::sync_with_stdio(0);
  int n, m, k; input >> n >> m >> k;
  set<int> traps;
  for2(i, k) {
	int tr; input >> tr;
	traps.insert(tr);
  }
  queue<Expectation> runsum;
  for2(i, m) {
	runsum.push({0, 0});
  }
  Expectation sum = {0, 0};
  for(int i=n-1; i>0; i--) {
	if (traps.count(i)) {
	  runsum.push({0, 1});
	} else {
	  runsum.push((sum + m) / m);
	}
	sum -= runsum.front(); runsum.pop();
	sum += runsum.back();
  }
  Expectation exp = (sum + m) / m;
  if (exp.variable >= 0.999999)
	std::cout << -1 << std::endl;
  else {
	double ans = exp.exact / (1.0 - exp.variable);
	std::cout << std::fixed << ans << std::endl;
  }
}

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

#define rep(x, k, n)    for(int x = (k); x < (n); ++x)
#define repr(x, k, n)   for(int x = (k); x > (n); --x)
#define tr(it,a)        for(auto it = (a).begin(); it != (a).end(); ++it)
#define ll              long long
#define siz(x)          ((int)(x).size())
#define print(x)        cout << (x) << '\n'
#define prints(x)       cout << (x) << " "
#define eb              emplace_back
#define mp              make_pair
#define F               first
#define S               second
#define o2(x)           ( (x) * (x) )
#define all(x)          (x).begin(), (x).end()
#define allr(x)         (x).rbegin(), (x).rend()
#define clr(x,k)        memset(x, k, sizeof(x))
#define sortall(x)      sort(all(x))
#define sortalld(x)     sort(all(x), greater<int>())
#define printv(v)       rep(x, 0, siz(v)){ prints(v[x]); } cout << '\n'
#define print2dv(V)     rep(y, 0, siz(V)){ printv(V[y]); }
#define out(x)          cout << ((x) ? "Yes" : "No") << '\n';
#define PI              3.1415926535897932384626
#define inf             INT_MAX
#define ninf            INT_MIN
#define int             long long // take care of it when too much computation required

typedef pair<int,int>   pii;
typedef pair<ll,ll>     pll;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<char>    vc;
typedef vector<bool>    vb;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
typedef vector<vc>      vvc;
typedef vector<vb>      vvb;
typedef vector<vpii>    vvpii;

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

#ifndef ONLINE_JUDGE
#define deb(...) cout << "[ ", debug_out(#__VA_ARGS__, __VA_ARGS__)
#else
#define deb(...)
#endif

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const int mod = 1e9+7;
const int N = 3e5, M = N;

/*
->Do not forget to check the edge cases.
->Make sure you are submitting the right file.
->Do not make "easy->complicated".
*/
/*
    -> 1, 2, 3, 3, 4, 5
    -> 1 + 2 + 3 : (n * (n + 1)) / 2 = 6
    -> 3 + 4 + 5 : (5 * 6)/2 - (2 * 3)/2 =

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

void Solve_main() {
    int n, m, k;

    cin >> n;
    int l, r, res = 0;
    rep(i, 0, n){
        cin >> l >> r;
        res += (r * (r + 1))/2;
        res -= (l * (l - 1))/2;

    }
    cout << res << '\n';
}

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

int32_t main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    // cout << setprecision(12) << fixed;
    int tc = 1;
    // cin >> tc;
    for(int i = 0; i < tc; i++) {
        Solve_main();
    }

    cerr << "[time:" << 1.0*clock()/CLOCKS_PER_SEC << "s] ";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
#define pd push_back
#define sort(v) sort(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end(),greater<int>())
#define display(s) for(auto val:s) cout<<val<<" "; cout<<endl;
#define displayMap(mymap) for(auto val:mymap) cout<<val.first<<" -> "<<val.second<<endl;
#define Sortcom(v) sort(v.begin(),v.end(),mycompare)
#define f(a,b,c) for(int i=a;i<b;i+=c)

int solve(){
    int a,b,c,d; cin>>a>>b>>c>>d;
    int R=0,C=0,cnt=0;
    C = a;
    if(d*c-b<=0) return -1;
    return (int)ceil((double)a/(d*c-b));
}

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

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ll a,b,c,d;cin>>a>>b>>c>>d;ll e=0;
    ll ans=-1;
    for(ll x=0;x<=1e8;x++){
        ll r=a+b*x;
        ll l=c*x;
        if(r<=l*d){
            ans=x;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool delimiter, unof = 1;
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define rev(i,s,e) for (int i = s; i > e; --i)
inline namespace IO{
    template<class t> using con=vector<t>;
    template<class t, class u> using pi=pair<t,u>;

    template<class t, class u> istream& operator>>(istream& is, pi<t,u>& pr){
        is >> pr.F >> pr.S; return is;
    }
    template<class t, class u> ostream& operator<<(ostream& os, const pi<t,u>& pr){
        delimiter=0; os << (unof ? "\t{" : "") << pr.F << (unof? " , " : " ") << pr.S << (unof? "}" : ""); return os;
    }

    template<class t> istream& operator>>(istream& is,con<t>& v){
        for (auto &i : v) is >> i; return is;
    }
    template<class t> ostream& operator<<(ostream& os,const con<t>& v){
        delimiter=1; os << (unof? "[": ""); bool fst = 0;
        for(auto e:v) os << (unof and fst? ", " : "") << e << (delimiter ? ' ' : '\n'), fst = 1;
        os << (unof? "]": ""); return os;
    }
}
const int N = 1e5 + 9 ;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef CLion
    freopen("input.txt" , "r" , stdin);
//    freopen("output.txt", "w" , stdout);
#endif

    int a, b;
    cin >> a >> b;

    set<ll> s;
    if (a > b){
        int df = a - b;
        int pos = df + 1, neg = 1;
        a -= pos; b -= neg;

        ll sum = 0;
        rep(i,1,pos + 1){
            cout << i << " ";
            sum += i; s.insert(i);
        }
        cout << -sum << " ";
        s.insert(-sum);
    }
    else if (b > a){
        int df = b - a;
        int neg = df + 1, pos = 1;
        a -= pos; b -= neg;

        ll sum = 0;
        rep(i,1,neg + 1){
            cout << -i << " ";
            sum += -i; s.insert(-i);
        }
        cout << -sum << " ";
        s.insert(-sum);
    }

    for ( int i = 1e9; a > 0 and b > 0; --i,--a,--b ){
        if ( s.count(i) == 0 and s.count(-i) == 0 ){
            cout << i << " " << -i << " ";
        }
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main () {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int a, b; cin >> a >> b;

    int sum = a * (a + 1) / 2 - b * (b + 1) / 2;
    for (int i = 1; i <= a; i++) {
        int x = i;
        if (sum < 0) x += abs(sum), sum = 0;
        cout << x << " ";
    }

    for (int i = 1; i <= b; i++) {
        int x = -i;
        if (sum > 0) x -= sum, sum = 0;
        cout << x << " ";
    }
    cout << "\n";
}


#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(x.rbegin(), x.rend())
#define REVERSE(x) reverse(ALL(x))
#define MAX(x) *max_element(ALL(x))
#define MAXI(x) max_element(ALL(x)) - x.begin()
#define SUM(x) accumulate(ALL(x), 0ll)
#define COUNT(x, y) count(ALL(x), y);
#define ANS cout << ans << "\n"
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << endl;
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(z, v.size()) cerr << " " << v[z]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;
using vp = vector<P>;
using vs = vector<string>;

template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  rep(j, v.size()) i >> v[j];
  return i;
}

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

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

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

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

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

ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % mod, n / 2, mod);
  if (n & 1) res *= x;
  res %= mod;
  return res;
}

signed main() {
  init();
  ll N, C;
  cin >> N >> C;

  priority_queue<P, vector<P>, greater<P>> q;

  rep(i, N) {
    ll a, b, c;
    cin >> a >> b >> c;
    q.push({a, c});
    q.push({b + 1, -c});
  }

  ll ans = 0;
  ll before_index = 0;
  ll before_value = 0;
  ll now = 0;
  ll value = 0;
  while (!q.empty()) {
    P t = q.top();
    q.pop();
    // debug(t.first);
    // debug(t.second);

    if (now == t.first) {
      value += t.second;
      before_value = value;
      before_index = now;
      continue;
    } else {
      now = t.first;
      value += t.second;
      ll l = now - before_index;
      ans += l * min(C, before_value);
      before_value = value;
      before_index = now;
      // debug(l);
      // debug(ans);
      // ENDL;
    }
  }
  ANS;
  return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int n;
int64_t C;

int minn(int64_t &a, int &b) {
    return (a < b) ? a : b;
}

int main(int argc, const char * argv[]) {

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

    cin >> n >> C;

    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);

    set<int> s;
    map<int, int64_t> changes;

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

    for(int i = 0; i < n; ++i) {
        static_cast<void>(s.insert(a[i])), s.insert(b[i] + 1);
        changes[a[i]] += c[i];
        changes[b[i] + 1] -= c[i];
    }

    vector<int> v(s.begin(), s.end());

    int m = int(v.size());

    int64_t acc = 0;

    int64_t ans = 0;
    for(int i = 0; i < m - 1; ++i) {
        acc += changes[v[i]];
        ans += (min(C, acc)) * (v[i + 1] - v[i]);

    }

    cout << ans;

    return 0;
}


#include <iostream>
using namespace std;

int main(void){
    double x,y,z; //take_g, taka_yen, su_g, su_yen

    cin >> x >> y >> z;

    // 高橋,すぬの1gあたりの値段
    double taka_per_yen = y/x;
    double su_per_yen;
    // すぬの1gあたりの値段がより小さくなるまで回す
    int amp = z*taka_per_yen;

    while(true){
        su_per_yen = amp/z;

        if(su_per_yen < taka_per_yen || amp <= 0){
            break;
        }
        amp--;
    }
    cout << amp << endl;

    return 0;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>
#include<set>

#define int long long
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
#define lc (x<<1)
#define rc (x<<1|1)
#define max Max
#define min Min
#define abs Abs

using namespace std;

inline int read()
{
	int ans=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=(ans<<1)+(ans<<3)+c-'0';c=getchar();}
	return ans*f;
}

inline void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x/10) write(x/10);
	putchar((char)(x%10)+'0');
}

template<typename T>inline T Abs(T a){return a>0?a:-a;};
template<typename T,typename TT>inline T Min(T a,TT b){return a>b?b:a;}
template<typename T,typename TT> inline T Max(T a,TT b){return a>b?a:b;}

int n,m,ans;

signed main()
{
	n=read();m=1;
	for(int i=2;i<=n;++i)
		m=m*i/__gcd(i,m);
	printf("%lld\n",m+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	int t=1000000000;
	int tt=t;
	for(int i=1;i<a;i++){
		cout<<i<<" ";
		tt-=i;
	}
	cout<<tt<<" ";
	int ttt=t;
	for(int i=1;i<b;i++){
		cout<<-i<<" ";
		ttt-=i;
	}
	cout<<-ttt;
}

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

int main() {
	double a, b;
	cin >> a >> b;
	double ans = 100-((b / a) * 100);
	cout << ans << endl;
}


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

using namespace std;

int main() {
	int n, s, d, xs, ys;
	cin >> n >> s >> d;
	bool dmg = false;
	for (int i = 0; i < n; ++i) {
		cin >> xs >> ys;
		if (xs < s && ys > d) dmg = true;
	}
	if (dmg) cout << "Yes\n";
	else cout << "No\n";

		return 0;
}

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

int main(){
	int a, b, c; cin>>a>>b>>c;
	if((a<0 || b<0) && c%2==0) a = abs(a), b = abs(b);
	puts(a<b? "<": a>b? ">":"=");
}


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

int main() {
// long long int i,j,k,n,m,t,v,s,d;

  long double x,y,r;

 cin>>x>>y>>r;

 r+=1e-14;

 long long int sx=ceil(x-r),ex=floor(x+r);

 long long  int c=0;

  for(long long int i=sx;i<=ex;i++)
  {

     if(i>=x-r && i<=x+r)
     {

   long  double ystart,yend;

      ystart=y+sqrt(fabs(r*r-(x-i)*(x-i)));
      yend=y-sqrt(fabs(r*r-(x-i)*(x-i)));

    long long   int ys=floor(ystart),ye=ceil(yend);

      if(ys>ystart)
      ys--;
      if(ye<yend)
      ye++;

      if(ys>=ye)
      c+=ys-ye+1;

    //   if(ceil(ystart)!=ys && belongs(i,ceil(ystart),x,y,r))
    //   c++;

    //   if(floor(yend)!=ye && belongs(i,floor(yend),x,y,r))
    //   c++;
     }

  }

  cout<<c;

}

// #define ONLINE_JUDGE
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifndef ONLINE_JUDGE
#   define dbg(x) cerr << '#' << #x << '	' << x << endl
#   define TIME cerr << "RuningTime: " << clock() << "ms\n", 0
#else
#   define dbg(x)
#   define TIME 0
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define endl '\n'
const ll base = 1e4;

ll input(){
    string s; cin >> s;
    ll res = 0;
    bool flag = 0; // 标记是否遇到小数点
    int cnt = 0; // 记录小数点后位数
    for(auto i : s){
        if(i == '.'){
            flag = 1;
            continue;
        }
        res = res * 10 + (i - '0');
        if(flag) cnt++;
    }
    while(cnt < 4){
        res = res * 10;
        cnt++;
    }
    return res;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0),cin.tie(0);
    ll x = input(), y = input(), r = input();
    dbg(x);
    ll lx = x - r, rx = x + r;
    while(lx % base != 0) lx++;
    while(rx % base != 0) rx--;
    ll uy = y, dy = y;
    while(uy % base != 0) uy++;
    while(dy % base != 0) dy--;

    ll ans = 0;
    for(ll i = lx; i <= rx; i += base){
        ll tmpx = abs(x - i);

        // uy下移
        while(tmpx * tmpx + (uy - y) * (uy - y) > r * r) uy -= base;
        // uy上移到上界+1
        while(uy <= y || tmpx * tmpx + (uy - y) * (uy - y) <= r * r) uy += base;

        // dy上移
        while(tmpx * tmpx + (y - dy) * (y - dy) > r * r) dy += base;
        // dy下移到下界-1
        while(dy >= y || tmpx * tmpx + (y - dy) * (y - dy) <= r * r) dy -= base;

        ans += (uy - dy + base - 2 * base) / base;

    }
    cout << ans;
}


#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "random"
#include        "chrono"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;

#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          pb push_back
#define          N (int)2e5+5
#define          PI acos(-1.0)
#define          int long long
#define          vi vector<int>
#define          mod 1000000007
#define          ld long double
#define          eb emplace_back
#define          mii map<int,int>
#define          vpii vector<pii>
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) x.rbegin(),x.rend()
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

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

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

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

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k,q;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
    char x, y;
    cin >> x >> y;

    if( x == 'Y' )
    {
        cout << ( char )( y - 'a' + 'A' ) << endl;
    }
    else
    {
        cout << y << endl;
    }

}

int32_t main()
{
    FAST;
    int t=1;
    // cin>>t;
    test(t) go();
}

// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(false);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  vi ans;
  rep(i, 1, N + 1) {
    if (i * i > N) break;
    if (i * i == N) {
      ans.pb(i);
    } else if (N % i == 0) {
      ans.pb(i);
      ans.pb(N / i);
    }
  }
  sort(all(ans));
  for (int x : ans) cout << x << endl;
}


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

using namespace std;

typedef long long ll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define range(i, a, b, s) for (int i = (a), __##i = (b); i < __##i; i += (s))
#define down(i, a, b, s) for (int i = (a), __##i = (b); __##i < i; i += (s))

const int maxn = 1002;

bool vis[maxn];
int n, a[maxn], cnt[maxn], idx = 0, prime[maxn];

template <size_t N>
void prepare_primes(int& idx, int prime[N], bool vis[N]) {
  memset(vis, false, sizeof(bool) * N);
  range(i, 2, N, 1) {
    if (!vis[i]) {
      prime[idx++] = i;
      range(j, i + i, n, i) vis[j] = true;
    }
  }
}

int main() {
  // freopen("B.txt", "r", stdin);

  prepare_primes<maxn>(idx, prime, vis);

  while (cin >> n) {
    range(i, 0, n, 1) cin >> a[i];

    memset(cnt, 0, sizeof(cnt));
    range(i, 0, n, 1) {
      range(j, 0, idx, 1) {
        if (a[i] % prime[j] == 0) {
          cnt[j] += 1;
        }
      }
    }

    int ans = 1, value = 0;
    range(i, 0, idx, 1) {
      if (value < cnt[i]) {
        value = cnt[i];
        ans = prime[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
//#include <random>
#include <map>
//#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <time.h>
//#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
//#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
double pi = 3.141592653589793;
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

int main() {
	string s;
	cin >> s;
	int n = s.size();

	vector<int> a(10);
	rep(i, n) {
		a[s[i] - '0']++;
	}

	if (s.size() == 1) {
		if (s == "8") {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		return 0;
	}
	if (s.size() == 2) {
		if ((a[0] == 1 && a[8] == 1) ||
			(a[1] == 1 && a[6] == 1) ||
			(a[2] == 1 && a[4] == 1) ||
			(a[3] == 1 && a[2] == 1) ||
			(a[4] == 1 && a[0] == 1) ||
			(a[4] == 1 && a[8] == 1) ||
			(a[5] == 1 && a[6] == 1) ||
			(a[6] == 1 && a[4] == 1) ||
			(a[7] == 1 && a[2] == 1) ||
			(a[8] == 2) ||
			(a[9] == 1 && a[6] == 1)) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
		return 0;
	}

	int x = -8;
	while (x < 1000) {
		x += 8;
		auto str = std::to_string(x);
		if (str.size() == 1)str.push_back('0');
		if (str.size() == 2)str.push_back('0');
		auto sub = a;
		sub[str[0] - '0']--;
		if (sub[str[0] - '0'] < 0) continue;
		sub[str[1] - '0']--;
		if (sub[str[1] - '0'] < 0) continue;
		sub[str[2] - '0']--;
		if (sub[str[2] - '0'] < 0) continue;
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;
	return 0;
}


/*
  AUTHOR:SOURABH
  CREATED:13:12:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAXN 10000001
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,m,tt,i,l,f,curr;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>m>>tt;
        vector<pll> a(m);
        fn(i,m)
        cin>>a[i].fi>>a[i].se;
        l=0;
        f=1;
        curr=n;
        fn(i,m)
        {
            curr-=(a[i].fi-l);
            if(curr<=0)
            {f=0;break;}
            curr=min(curr+(a[i].se-a[i].fi),n);
            l=a[i].se;
        }
        curr-=(tt-l);
        if(curr<=0)
            f=0;
        if(f)
            cout<<"Yes";
        else
            cout<<"No";
    }
    return 0;
}

#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

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

const int MX = 205;
int n, mem[MX];
int x[MX], to[MX], cn;

void no () {
	cout << "No" << endl;
	exit(0);
}

int dp (int i) {
	if (i == 2 * n) return 1;

	int &res = mem[i];
	if (res != -1) return res;
	res = 0;

	for (int j = i + 1; j < 2 * n; j += 2) {
		int m = (i + j) / 2, f = 1, izq = 0, der = 0;
		int len = j - m;

		for (int k = i; k <= m; k++) {
			if (x[k] == 2) f = 0;
			if (x[k] == 1) {
				if (to[k] != -1) {
					if (to[k] != k + len) f = 0;
				} else {
					if (x[k + len]) f = 0;
					izq++;
				}
			}
		}

		for (int k = m + 1; k <= j; k++) {
			if (x[k] == 1) f = 0;
			if (x[k] == 2) {
				if (to[k] != -1) {
					if (to[k] != k - len) f = 0;
				} else {
					if (x[k - len]) f = 0;
					der++;
				}
			}
		}

		f &= izq + der <= len;

		if (f) res |= dp(j + 1);
	}

	return res;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
 	memset(mem, -1, sizeof(mem));
 	memset(to, -1, sizeof(to));

	cin >> n;

	forn (i, n) {
		int a, b;
		cin >> a >> b;
		a--, b--;

		if (a >= 0 && b >= 0 && a > b) no();

		if (a >= 0) {
			if (x[a]) no();
			x[a] = 1;
			if (b >= 0) to[a] = b;
		}

		if (b >= 0) {
			if (x[b]) no();
			x[b] = 2;
			if (a >= 0) to[b] = a;
		}
	}

	if (dp(0)) cout << "Yes" << endl;
	else no();

	return 0;
}


#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream, getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device
#include <limits>	//numeric_limits

using namespace std;
constexpr long long int D_MOD = 1000000007;

int main() {

	int a, b, c;
	cin >> a >> b >> c;

	if (a * a + b * b < c * c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	if (a<=b){
		cout << min(x+(b-a)*y, (b-a)*2*x+x) << endl;
		return 0;
	}
	else{
		cout << min(x+(a-b-1)*y, (a-b-1)*2*x+x) << endl;
		return 0;
	}
}


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <memory.h>
#include <iomanip>
//#include <atcoder/all>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
//using namespace atcoder;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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

//lli gcd2(lli x, lli y)
//{
//    lli t;
//    while (y != 0)
//        t = x % y, x = y, y = t;
//    return (x);
//}
//
//lli lcm2(lli x, lli y)
//{
//    lli xy = x * y;
//    if (xy < 0)
//        xy = -xy;
//    return (xy / gcd2(x, y));
//}
/*  divisor(n)
    入力：整数 n
    出力：nのすべての約数
    計算量：O(√n)
*/
vector<long long> divisor(long long n)
{
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

lli eightarray[18];
void num_to_eight(int x)
{
    lli power8 = 1;
    for (int i = 0; i < 18; i++)
    {
        eightarray[i] = (x / power8) % 8;
        power8 *= 8;
    }
}
lli n_array[18];
//N進法
void num_to_N(int x, int N)
{
    lli powerN = 1;
    for (int i = 0; i < 18; i++)
    {
        n_array[i] = (x / powerN) % N;
        powerN *= N;
    }
}

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

/*  lcm2 (a, b) : 2整数版
    入力：整数 a, b
    出力：aとbの最小公倍数
*/
long long lcm2(long long a, long long b)
{
    long long d = gcd(a, b);
    return a / d * b;
}

/* lcm (vec) : ベクトルでの多整数版
    入力：整数のベクトル vec
    出力：すべての要素の最小公倍数
*/
long long lcm(const vector<long long> &vec)
{
    long long l = vec[0];
    for (int i = 0; i < vec.size() - 1; i++)
    {
        l = lcm2(l, vec[i + 1]);
    }
    return l;
}

int main(void)
{
    int N;
    string s;
    cin >> N;
    cout << 100 - (N % 100) << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
signed main(){
  int x;
  cin>>x;
  cout<<(x<0?0:x);
}


#include <climits>
#include <iostream>
#include <unordered_map>
#include <map>
#include <vector>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <set>
#include <cmath>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <unordered_map>
#include <map>
#include <vector>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <set>
#include <cmath>
#define MAXN  10000000
using namespace std;

long long mod=998244353;
int spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}

// A O(log n) function returning primefactorization
// by dividing by smallest prime factor at every step
unordered_map<int, int> getFactorization(int x)
{
    unordered_map<int, int> factors;
    while (x != 1)
    {
        factors[spf[x]]++;
        x = x / spf[x];
    }
    return factors;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tt=1;
    sieve();
    long long dp[21][200001];
    for(int i=20;i>=1;i--){
        for(int j=200000;j>=0;j--){
            if(i==20 && j==200000){
                dp[i][j]=1;
                continue;
            }
            if(j==200000){
                dp[i][j]=dp[i+1][j];
                continue;
            }
            if(i==20){
                dp[i][j]=(1+dp[i][j+1])%mod;
                continue;
            }
            dp[i][j]=(dp[i][j+1]+dp[i+1][j])%mod;
        }
    }
    while(tt--){
        int n, m;
        cin>>n>>m;
        long long ways=1;
        for(int i=2;i<=m;i++){
            unordered_map<int, int> factors=getFactorization(i);
            long curr=1;
            for(auto it=factors.begin();it!=factors.end();it++){

                curr=(curr*dp[21-(it->second)][200001-n])%mod;
            }
            ways=(ways+curr)%mod;
        }
        cout<<ways<<endl;

    }

}

//3 4 2 1 5 6

//1 2 3

#include <bits/stdc++.h>

#define endl '\n'
using namespace std;
using ll = long long;
const int MOD = 998244353;
static const int MX = 200100;

ll poww(ll a, ll b) {
	if (b == 0) {
		return 1;
	}
	if (b & 1) {
		return (a * poww(a, b - 1)) % MOD;
	}
	return poww((a * a) % MOD, b >> 1);
}

ll inv(ll a) {
	return poww(a, MOD - 2);
}

ll fact[MX + 1];
ll invfact[MX + 1];

ll C(int n, int k) {
	return ((fact[n] * invfact[k]) % MOD * invfact[n - k]) % MOD;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	fact[0] = 1;
	invfact[0] = 1;
	for (int i = 1; i <= MX; ++i) {
		fact[i] = (fact[i - 1] * i) % MOD;
		// there was linear time formula, but who cares
		invfact[i] = inv(fact[i]);
	}
    static vector<int> sieve(MX + 1);
    iota(sieve.begin(), sieve.end(), 0);
    for (int i = 2; i * i <= MX; ++i) {
        if (sieve[i] < i) continue;
        for (int j = i * i; j <= MX; j += i) {
            sieve[j] = i;
        }
    }
	int n, m;
	cin >> n >> m;
	ll gans = 0;
	for (int i = 1; i <= m; ++i) {
		ll ans = 1;
		int x = i;
	    for (int cur = sieve[x]; x > 1; cur = sieve[x]) {
	        int cnt = 0;
	        for (; x % cur == 0; cnt++, x /= cur);
	        ans *= C(n + cnt - 1, cnt);
	    	ans %= MOD;
	    }
	    gans += ans;
	    if (gans >= MOD) {
	    	gans -= MOD;
	    }
	}
	cout << gans << endl;
}


#include <bits/stdc++.h>

#include <vector>
// #include <atcoder/all>
// using namespace atcoder;

using namespace std;
using ll = long long;

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

    int N, M, T;
    cin >> N >> M >> T;

    vector<ll> A(M);
    vector<ll> B(M);
    for (int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
    }

    int capa = N;
    capa -= A[0];
    if (capa <= 0) {
        cout << "No" << endl;
        return 0;
    }
    capa += B[0] - A[0];
    capa = min(capa, N);
    // cout << capa << endl;
    for (int i = 1; i < M; i++) {
        capa -= A[i] - B[i - 1];
        if (capa <= 0) {
            cout << "No" << endl;
            return 0;
        }
        // cout << capa << endl;
        capa += B[i] - A[i];
        capa = min(capa, N);
        // cout << capa << endl;
    }
    capa -= T - B[M - 1];
    if (capa <= 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}

string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,t,x,y,c;
    cin>>n>>m>>t;
    y=0;
    c=n;
    while (m--)
    {
        cin>>x;
        c-=(x-y);
        if (c<=0)
        {
            cout<<"No";
            return 0;
        }
        cin>>y;
        c=min(c+y-x,n);
    }
    c-=(t-y);
    if (c<=0)
        cout<<"No";
    else cout<<"Yes";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define endl "\n"
#define ll long long int

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

        ll n;
    cin>>n;
        double D,H;
        cin>>D>>H;

        double ans=0.0;

        while(n--)
        {
            double d,h;
            cin>>d>>h;
            double tan=(d*(H-h))/(D-d);
            tan=h-tan;
            ans=max(ans,tan);
        }
        cout<<setprecision(15)<<fixed<<ans<<endl;

    return 0;
}

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

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

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

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

#define en "\n"

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

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

void Main(){
    int N; double D,H; cin >> N >> D >> H;
    VI d(N),h(N); REP(i,N) cin >> d[i] >> h[i];

    double ng = 0, ok = 1000;
    REP(_,50){
        double b = (ok+ng)/2;
        double a = (H-b)/D;
        bool flag = true;
        REP(i,N){
            if(a*d[i]+b < h[i]){
                flag = false;
                break;
            }
        }
        if(flag) ok = b;
        else ng = b;
    }
    cout << ok << en;
    return;
}

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


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define eps 1e-9
#define INF 2000000000              // 2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))

#ifndef LOCAL
#define dmp(...) ;
#else
#define dmp(...)                                                               \
  cerr << "[ " << #__VA_ARGS__ << " ] : " << dump_str(__VA_ARGS__) << endl
#endif

// ---------------- Utility ------------------

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

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;

template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

// ----------------- Input -------------------

template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  return is >> p.first >> p.second;
}

template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}

// ----------------- Output ------------------

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << p.first << ',' << p.second;
}

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

template <class T>
ostream &operator<<(ostream &os, const deque<T> &d) {
  for (const T &e : d) os << e << " ";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << "{ ";
  for (const T &e : s) os << e << " ";
  return os << "}";
}

template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &m) {
  os << "{ ";
  for (const auto &[key, val] : m) os << "( " << key << " -> " << val << " ) ";
  return os << "}";
}

void dump_str_rec(ostringstream &) {}

template <class Head, class... Tail>
void dump_str_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << ", " << head;
  dump_str_rec(oss, forward<Tail>(tail)...);
}

template <class T, class... U>
string dump_str(T &&arg, U &&... args) {
  ostringstream oss;
  oss << arg;
  dump_str_rec(oss, forward<U>(args)...);
  return oss.str();
}

// --------------- Fast I/O ------------------

void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

// ------------ End of template --------------

#define endl "\n"

ll get(int x, int y) {
  x = abs(x);
  y = abs(y);
  if (x == 0 && y == 0) return 0;
  ll ret = LLINF;
  for (ll i = -3; i <= 3; i++) {
    for (ll j = -3; j <= 3; j++) {
      if (abs(i) + abs(j) > 3) continue;
      ll nx = x - i;
      ll ny = y - j;
      if (nx == 0 && ny == 0) return 1;
      if (nx == ny) chmin(ret, 2ll);
    }
  }
  if (x == y) return 1;
  if ((x + y) % 2 == 0) return 2;
  if (ret == 2) return 2;
  return 3;
}

void solve() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  c -= a;
  d -= b;
  c = abs(c);
  d = abs(d);
  if (c == d) {
    cout << ((c == 0) ? 0 : 1) << endl;
    return;
  }
  ll ans = LLINF;
  for (ll i = -3; i <= 3; i++) {
    for (ll j = -3; j <= 3; j++) {
      if (abs(i) + abs(j) > 3) continue;
      ll nc = c + i;
      ll nd = d + j;
      ll cost = (i == 0 && j == 0) ? 0 : 1;
      chmin(ans, get(nc, nd) + cost);
    }
  }
  cout << ans << endl;
  return;
}

int main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}

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

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

    if(a == c && b == d) {
        cout << 0;
        return 0;
    }

    if(a + b == c + d || a - b == c - d || abs(a - c) + abs(b - d) <= 3) {
        cout << 1;
        return 0;
    }

    if((a + b) % 2 == (c + d) % 2 || abs(a+b-c-d) <= 3 || abs(a-b-c+d) <= 3 || abs(a - c) + abs(b - d) <= 6) {
        cout << 2;
        return 0;
    }

    cout << 3;

    return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
#define all(V) V.begin(),V.end()
#define pi 3.1415926535897932384626
#define fi fixed<<setprecision(13)
#define ll long long
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)
#define Rep(i, n) for (ll i = 1; i <=(ll)(n); i++)
#define reps(i,k,n) for (ll i = (ll)k; i < (ll)(n); i++)
#define mp make_pair
#define mt make_tuple
using namespace std;
using V = vector<vector<int>>;
using Vc = vector<vector<char>>;
using Vb = vector<vector<bool>>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using Vp = vector<vector<pair<int,int>>>;
template<class T> void chmin(T& a,T b){ if(a > b) a=b; }
template<class T> void chmax(T& a,T b){ if(a < b) a=b; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
const ll infll = 1LL<<61;
const ll inf = 1<<30;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {1, -1, 0, 0};
struct Edge{
  int to;
  ll w;
  Edge(int to,ll w) : to(to),w(w){}
};
ll nck(ll a,ll b){
  ll s=1,x=1;
  rep(i,b) s=(s*(a-i))/x,x++;
  return s;
}
using Graph = vector<vector<Edge>>;
/*-------------------------------------------------------------------*/

/*-------------------------------------------------------------------*/
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  /*----------------------------------------------------*/
  int n; cin >> n;
  int r = 0, g = 0, b = 0;
  vector<pair<ll, string>> x(2 * n);
  rep(i, 2 * n){
    ll a; string s;
    cin >> a >> s;
    if(s == "R") r++;
    if(s == "G") g++;
    if(s == "B") b++;
    x[i] = mp(a, s);
  }
  if(r % 2 == 0 && g % 2 == 0 && b % 2 == 0){
    cout << 0 << "\n";
    return 0;
  }
  sort(all(x));
  ll RGmin = infll, RBmin = infll, GBmin = infll;
  if(r % 2 == 0){
    rep(i, 2 * n - 1){
      if(x[i].second != x[i+1].second ){
        if(x[i].second == "R" || x[i+1].second == "R"){
          if(x[i].second == "G" || x[i+1].second == "G") chmin(RGmin, abs(x[i].first - x[i+1].first));
          else chmin(RBmin,abs(x[i].first - x[i+1].first));
        }
        else chmin(GBmin,abs(x[i].first - x[i+1].first));
      }
    }
    cout << min(RGmin + RBmin, GBmin) << "\n";
    return 0;
  }
 if(g % 2 == 0){
    rep(i, 2 * n - 1){
      if(x[i].second != x[i+1].second ){
        if(x[i].second == "G" || x[i+1].second == "G"){
          if(x[i].second == "B" || x[i+1].second == "B") chmin(GBmin, abs(x[i].first - x[i+1].first));
          else chmin(RGmin,abs(x[i].first - x[i+1].first));
        }
        else chmin(RBmin,abs(x[i].first - x[i+1].first));
      }
    }
    cout << min(GBmin + RGmin, RBmin) << "\n";
    return 0;
  }
    if(b % 2 == 0){
    rep(i, 2 * n - 1){
      if(x[i].second != x[i+1].second ){
        if(x[i].second == "B" || x[i+1].second == "B"){
          if(x[i].second == "G" || x[i+1].second == "G") chmin(GBmin, abs(x[i].first - x[i+1].first));
          else chmin(RBmin,abs(x[i].first - x[i+1].first));
        }
        else chmin(RGmin,abs(x[i].first - x[i+1].first));
      }
    }
    cout << min(GBmin + RBmin, RGmin) << "\n";
    return 0;
  }
}

/*制約を確認しろllじゃなくて大丈夫か？*/
/* sample 保存
8
1 5 3 4 5 2 3 1

*/

#include<bits/stdc++.h>
using namespace std;
#define dbg(x) cerr << #x << " = " << x << endl
#define rep(i, a, b) for(int i = (a); i <= (b); ++ i)
#define MP make_pair
#define pb push_back
#define fi first
#define se second
typedef long long LL;
typedef unsigned long long u64;
typedef unsigned int u32;
template <typename Tp> void read(Tp &x){
	x = 0; int op = 1; char ch = getchar();
	while(!isdigit(ch)){ if(ch == '-') op = -1; ch = getchar(); }
	while(isdigit(ch)){ x = x*10+ch-'0'; ch = getchar(); } x *= op;
}
template <typename Tp> void CMax(Tp &x, Tp y){ if(y > x) x = y; }
template <typename Tp> void CMin(Tp &x, Tp y){ if(y < x) x = y; }

const int N = 1e5 + 10;

int n;
char s[N];

int main()
{
	scanf("%d", &n);
	scanf("%s", s + 1);
	if(s[1] != s[n]){
		printf("1");
		return 0;
	}
	rep(i, 2, n - 2) {
		if(s[i] != s[1] && s[i + 1] != s[1]){
			printf("2");
			return 0;
		}
	}
	printf("-1");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod;
ll qpow(ll a, ll n)//计算a^n % mod
{
    ll re = 1;
    while(n)
    {
        if(n & 1)//判断n的最后一位是否为1
            re = (re * a) %mod;
        n >>= 1;//舍去n的最后一位
        a = (a * a) %mod;//将a平方
    }
    return re %mod;
}

int main()
{
    ll n, m;
    scanf("%lld %lld", &n, &m);
    mod=m*m;
    printf("%lld\n", qpow(10, n)/m);
}

#include<bits/stdc++.h>
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999
#define pb push_back
#define ff first
#define ss second

#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll power(ll x, ll y, ll p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;

    //cin >> T;
    while (T--) {
        ll n, m;
        cin >> n >> m;
        n = power(10, n, m * m);
        ll ans = (n / m) % m;
        cout << ans << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <cmath>
#include <unordered_set>
using namespace std;
using ll = long long;
using vi = vector<int>;

int main() {
  double x, y, z;
  cin >> x >> y >> z;
  double ans = 10000000;
  while(y/x <= ans/z){
    ans--;
  }
  cout << ans << endl;
}

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

#define ll long long
#define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i]
#define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>

#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;
//constexpr ll mod = 998244353;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
void pt(T val) {
    cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];

        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}
ll mypow(ll a, ll n) {
    ll ret = 1;
    if(n==0) return 1;
    if(a==0) return 0;
    rep(i, n) {
        if (ret > (ll)(1e18 + 10) / a) return -1;
        ret *= a;
    }
    return ret;
}
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;
}
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
vector<ll> enum_div(ll n){    //約数全列挙
    vector<ll> ret;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i != 1 && i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}
int main() {
    ll z,y,x,ans=INF;
    cin>>x>>y>>z;
    ans=(z*y-1)/x;
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=998244353;
#define rep(i,n) for (int i = 0; i < (n); i++)
int n,m;
ll dp[10000];
ll fac[5100], finv[5100], inv[5100];
void COMinit(int n) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < n; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(){
    COMinit(5100);
    cin >> n >> m;
    dp[0]=1;
    for(int i=1;i<=m;i++){
        if(i%2==1)continue;
        for(int j=0;j<=n && j<=i;j+=2){
            dp[i]+=dp[(i-j)/2]*COM(n,j);
            dp[i]%=mod;
        }
    }
    cout << dp[m] << endl;
    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=998244353;
inline int addmod(int x)
{
	return x>=mod?x-mod:x;
}
int n,m,c[5005][5005],f[105][5005],pn=5e3;
int main()
{
	for(int i=0;i<=pn;i++)
		c[i][0]=1;
	for(int i=1;i<=pn;i++)
		for(int j=1;j<=pn;j++)
			c[i][j]=addmod(c[i-1][j-1]+c[i-1][j]);
	scanf("%d%d",&n,&m);
	for(int i=0;i<=min(m,n);i+=2)
		f[0][m-i]=c[n][i];
	for(int i=0;i<=14;i++)
	{
		for(int k=0;k<=m;k+=2)
		{
			int nw=k/2;
			for(int j=0;j<=min(n,nw);j+=2)
				f[i+1][nw-j]=addmod(f[i+1][nw-j]+1ll*f[i][k]*c[n][j]%mod);
		}
	}
	printf("%d\n",f[15][0]);
	return 0;
}


                   /**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#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;
using ll=long long;
using db=double;
///***************************************************** CONSTANTS ******************************************************///

int const N=1e7+3;
ll MOD=1e9+7,fact[N];
const long long inf=(long long)1e18;
const long double PI=3.14159265358979;

///************************************************ CONTAINER DEFINITIONS ***********************************************///

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///************************************************ SHORT FORM KEYWORDS *************************************************///

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define I insert
#define lb lower_bound
#define ub upper_bound
#define endl '\n'

///************************************************ SHORT FORM FUNCTIONS ************************************************///

#define loop(a,b) for(ll i=a;i<b;i++)
#define loopr(a,b) for(ll i=a-1;i>=b;i--)
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define stll(x) stoll(x, nullptr, 10);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define all(a) a.begin(),a.end()
#define mxa(a,N) *max_element(a,a+N)
#define mna(a,N) *min_element(a,a+N)
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define io() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///************************************************ SOLUTION STARTS HERE ************************************************///
///======================================================================================================================///

void solve(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b==c+d || a+c==b+d || a+d==b+c || a==b+c+d || b==a+c+d || c==a+b+d || d==a+b+c) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
int main()
{
    io();

    int T=1;//cin>>T;
    while(T--) solve();
    return 0;
}

/****************ALHAMDULILLAH******************/

#include<bits/stdc++.h>
using namespace std;
#define db(a) cout<<#a<<"="<<(a)<<'\n';
#define DB(a) {cout<<#a<<"里的元素为 ";for(auto x:a)cout<<x<<' ';cout<<'\n';}
#define DBB(a) {cout<<#a<<"里的元素为 ";for(auto x:a)cout<<x.first<<' '<<x.second<<"    ";cout<<'\n';}
#define bb begin()
#define ee end()
#define ss size()
#define pb push_back
#define te int t;cin>>t;while(t--)
using ll=long long;
int h,w,a,b,ans;
void dfs(int s,int pos,int a,int b){
    if(s==h*w){ans++;return;}
    if(1<<s&pos){return dfs(s+1,pos,a,b);}
    if(b>0)dfs(s+1,pos|1<<s,a,b-1);
    if(a>0){
        if(s%w<w-1)dfs(s+1,pos|1<<s|1<<(s+1),a-1,b);
        if(s+w<h*w)dfs(s+1,pos|1<<s|1<<(s+w),a-1,b);
    }
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>h>>w>>a>>b;
    dfs(0,0,a,b);
    cout<<ans;
}


/*
 * Author: Kewth

 * Date:
  echo -n '  ' && date +%Y.%m.%d # Type "!!sh" in Vim.

 * Solution:
  To be updated after "Accept".

 * Digression:

 * CopyRight:
   __  __                  __   __
  |  |/  |.-----.--.--.--.|  |_|  |--.
  |     < |  -__|  |  |  ||   _|     |
  |__|\__||_____|________||____|__|__|

 */

#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

static struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator () (a...); }
} read;

const int maxn = 3030, mod = 998244353;
ll f[maxn][maxn << 1];

int main () {
	int n = read, m = read;
	f[0][0] = 1;
	for (int i = 1; i <= n; i ++)
		for (int j = i; j; j --) {
			f[i][j] = (f[i - 1][j - 1] + f[i][j << 1]) % mod;
			/* g[i][j] = (g[i - 1][j - 1] + f[i][j]) % mod; */
		}
	printf("%lld\n", f[n][m]);
	/* for (int i = 1; i <= n; i ++) { */
	/* 	for (int j = 1; j <= i; j ++) */
	/* 		debug(" %lld", f[i][j]); */
	/* 	debug("\n"); */
	/* } */
}

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

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

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 998244353;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int n, k;
	cin >> n >> k;
	ll x = 1;
	while(n >= k * x * 2)
		x *= 2;
	vvl dp(n + 1, vl(n + 1));
	dp[0][0] = 1;
	rep(j, 1, n + 1)
	{
		rep(i, 1, n + 1)
		{
			ll z = 1;
			while(i * z - 1 <= n)
			{
				(dp[i][j] += dp[i * z - 1][j - 1]) %= h;
				z *= 2;
			}
		}
	}
	cout << dp[k][n];
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;

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

    ll distance;
    distance = x*x + y*y;

    ll ans = 1;
    while(1) {
        if (r*r*ans*ans >= distance) break;
        ans++;
    }
    if (ans == 1) {
        if (r*r != distance) {
            cout << 2 << endl;
            return 0;
        }
    }

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

//Code Written by Pinaki Bhattacharjee
#include<bits/stdc++.h>
using namespace std;

// typedef
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;

// #define
#define LOCAL
#define INF 1e18
#define MAX 10000
#define PI 2*acos(0.0)
#define endl "\n"
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define ppc __builtin_popcountll
#define pinakipb2 ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

// constants
const int MOD = (int) 1e9 + 7;

// debugger
#ifdef LOCAL
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
    #define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << 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...);
}

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

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

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(ld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull 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.first); cerr << ","; _print(p.second); 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 << "]";}

void google(int t) {cout << "Case #" << t << ": ";}
ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}

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

int main()
{
    pinakipb2;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
    // Code begins

    ll r,x,y;
    cin>>r>>x>>y;
    ll ans = ceil(sqrt((x*x)+(y*y)));
    if(x==0 && y==0)
    {
        cout<<0<<endl;
    }
    else if(ans<r)
    {
        cout<<2<<endl;
    }
    else if(ans%r==0)
    {
        cout<<ans/r<<endl;
    }
    else
    {
        cout<<ans/r+1<<endl;
    }

    // Code ends
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> g(n);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        g[a]|=1<<b;
        g[b]|=1<<a;
    }
    if(m==0){
        cout<<n<<endl;
        return 0;
    }
    vector<int> dp(1<<n,n+1);
    dp[0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<(1<<n);j++){
            if(dp[j]==1&&(g[i]&j)==j)dp[j|(1<<i)]=1;
        }
    }
    for(int i=0;i<(1<<n);i++){
        for(int j=i;--j&=i;){
            dp[i]=min(dp[i],dp[i^j]+dp[j]);
        }
    }
    cout<<dp.back()<<endl;
}

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

signed main(){
    int n,m;cin>>n>>m;
    vector<vector<int>> g(n,vector<int>(n,false));
    rep(i,m){
        int u,v;cin>>u>>v;u--,v--;
        g[u][v]=true;
        g[v][u]=true;
    }

    vector<int> dp(1<<n,INF);
    dp[0]=0;
    for(int bit=1;bit<(1<<n);bit++){
        bool f=true;
        for(int i=0;i<n and f;i++)if((bit>>i)&1){
            for(int j=i+1;j<n and f;j++)if((bit>>j)&1){
                if(!g[i][j])f=false;
            }
        }
        if(f){
            dp[bit]=1;
            // cout<<bit<<" "<<1<<endl;
        }
    }

    for(int bit=1;bit<(1<<n);bit++){
        //部分集合bitの部分集合subsetの列挙
        int subset=bit;
        do{
            //処理
            if(subset!=bit){
                chmin(dp[bit],dp[subset]+dp[bit^subset]);
            }
            //次の集合計算↓
            subset=(subset-1)&bit;
        }while(subset!=bit);//0の次，-1&bit=bitなので終わり
    }
    cout<<dp[(1<<n)-1]<<endl;
    return 0;
}


//@Author: KeinYukiyoshi

// clang-format off
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#define int long long
using namespace std;
#define stoi stoll
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define _max(x) *max_element(ALL(x))
#define _min(x) *min_element(ALL(x))
#define _sum(x) accumulate(ALL(x), 0LL)

const int MOD   = 1000000007;
// const int MOD    = 998244353;
const int INF    = 10000000000007; // 1e13 + 7
const int INF2    = LLONG_MAX; // 9.2e18
const double EPS = 1e-8;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b) {int res = 1;for (a %= MOD; b; a = a * a % MOD, b >>= 1)if (b & 1) res = res * a % MOD;return res;}
struct mint {long long x;mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) { (x *= a.x) %= MOD;return *this; }mint operator+(const mint a) const { 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(long long 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) const { 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; }
// clang-format on

class ALongCommonSubsequence {
public:
  static void solve(istream &cin, ostream &cout) {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int t;
    cin >> t;
    rep(_, t) {
      int N;
      string S1, S2, S3;
      cin >> N >> S1 >> S2 >> S3;
      cout << string(N, '0') + string(N, '1') + '0' << endl;
    }
  }
};

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

#include <bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sll set<long long>
#define si set<int>
#define sti stack<int>
#define stkl stack<ll>
#define qi queue<int>
#define pb push_back
#define ff first
#define ss second
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll mod=1e9+7;
using namespace std;
int c=0;

ll pow(ll a,ll b){
	if(b==0)
		return 1;
	ll ans=pow(a,b/2)*pow(a,b/2);
	if(b&1)
		return a*ans;
	return ans;
}

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

ll nCr(ll n,ll r){
	vll a(r+1);
	a[0]=1;
	while(--n){
		for(int i=r-1;i>=0;i--)
			a[i+1]+=a[i];
	}
	return a[r];
}

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

	vector<pii> a(1<<n);
	map<int,int> ma;
	for(int i=0,x;i<(1<<n);i++){
		cin>>x;
		a[i]={x,i+1};
	}

	for(int i=0;i<n-1;i++){
		int m=a.size();
		vi b;
		for(int j=0;j<m-1;j+=2){
			if(a[j].ff<=a[j+1].ff){
				b.pb(j);
			}
			else{
				b.pb(j+1);
			}
		}
		int l=0;
		for(auto k:b){
			// cout<<k<<" ";
			a.erase(a.begin()+k-l);
			l++;
		}
	}
	sort(a.begin(), a.end());

	// for(auto i:a)
	// 	cout<<i.ff<<" "<<i.ss<<endl;
	cout<<a[0].ss<<endl;
}

int main(){
    IOS;
    int q=1;
    //cin>>q;
    while(q--){
    	c++;
        solve();
    }
}


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

int main() {
  int n;
  cin >> n;
  n *= 1.08;
  if(n < 206) {
    cout << "Yay!" << endl;
  } else if(n == 206) {
    cout << "so-so" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}

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

#define int         long long

#define read(a)		for(auto &z : a) cin >> z;
#define	write(a)	{for(auto &z : a) cout << z << ' ';cout << '\n';}
#define print(a)	cout << a << "\n";
#define all(a) 		a.begin(), a.end()

pair<int, int> mov[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

int32_t main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
    int _ = 1, n, m;
    // cin >> _;

    outer : while(_--) {
        cin >> n;
        int num = floor(n * 1.08);
        if(num < 206) {
            cout << "Yay!\n";
        }
        else if(num == 206) {
            cout << "so-so\n";
        }
        else {
            cout << ":(\n";
        }
    }

    return 0;
}


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

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

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

template<ll MOD = 1000000007>
class ModInt {
    ll n;
    ModInt constexpr inverse() const {
        return ModInt::pow(*this, MOD - 2);
    }

public:
    ModInt()
        : n(0) {}
    ModInt(ll _n)
        : n(((_n % MOD) + MOD) % MOD) {}
    ModInt operator+=(const ModInt &m) {
        n += m.n;
        if (n >= MOD) n -= MOD;
        return *this;
    }
    ModInt operator-=(const ModInt &m) {
        n -= m.n;
        if (n < 0) n += MOD;
        return *this;
    }
    ModInt operator*=(const ModInt &m) {
        n *= m.n;
        if (n >= MOD) n %= MOD;
        return *this;
    }
    ModInt operator/=(const ModInt &m) {
        (*this) *= m.inverse();
        return *this;
    }
    friend ModInt operator+(ModInt t, const ModInt &m) {
        return t += m;
    }
    friend ModInt operator-(ModInt t, const ModInt &m) {
        return t -= m;
    }
    friend ModInt operator*(ModInt t, const ModInt &m) {
        return t *= m;
    }
    friend ModInt operator/(ModInt t, const ModInt &m) {
        return t /= m;
    }
    ModInt operator=(const ll l) {
        n = l % MOD;
        if (n < 0) n += MOD;
        return *this;
    }
    friend ostream &operator<<(ostream &out, const ModInt &m) {
        out << m.n;
        return out;
    }
    friend istream &operator>>(istream &in, ModInt &m) {
        ll l;
        in >> l;
        m = l;
        return in;
    }
    static constexpr ModInt pow(const ModInt x, ll p) {
        ModInt<MOD> ans = 1;
        for (ModInt<MOD> m = x; p > 0; p /= 2, m *= m) {
            if (p % 2) ans *= m;
        }
        return ans;
    }
};
using mint = ModInt<998244353>;
mint operator"" _m(unsigned long long m) {
    return mint(m);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin, a, b, c;
    mint ans = 1_m * a * (a + 1) / 2 * 1_m * b * (b + 1) / 2 * 1_m * c * (c + 1) / 2;
    print(ans);
    return 0;
}

#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair <int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'
#define vi vector<int>

const int M = 998244353;

int mod(int m, int mod = M) {
   m %= mod;
   return (m + mod) % mod;
}

int32_t main() {
	boost;
	int a, b, c;
	cin >> a >> b >> c;
	int aa = a * (a + 1) / 2;
	aa = mod(aa);
	int bb = b * (b + 1) / 2;
	bb = mod(bb);
	int ans = c * (c + 1) / 2;
	ans = mod(ans);
	ans = mod(ans * aa);
	ans = mod(ans * bb);
	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;
int n, m, a, b, db=1;
string s[100];
int main()
{
    cin >> n >> m >> a >> b;
    a--, b--;
    for (int i=0; i<n; i++) {
        cin >> s[i];
    }
    for (int j=b-1; j>=0; j--) {
        if (s[a][j]=='.') {
            db++;
        } else {
            break;
        }
    }
    for (int j=b+1; j<m; j++) {
        if (s[a][j]=='.') {
            db++;
        } else {
            break;
        }
    }
    for (int i=a-1; i>=0; i--) {
        if (s[i][b]=='.') {
            db++;
        } else {
            break;
        }
    }
    for (int i=a+1; i<n; i++) {
        if (s[i][b]=='.') {
            db++;
        } else {
            break;
        }
    }
    cout << db << "\n";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int w,h,x,y,i,j,s=0,k;
    cin>>h>>w>>x>>y;
    char a[h][w];
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    for(i=x-1;i<x;i++){
        for(j=y-1;j<y;j++){
            for(k=j+1;k<w;k++){
                //cout<<k<<" "<<i<<endl;
                if(a[i][k]=='.') s++;
                else break;
            }
            //cout<<s<<endl;
            for(k=j-1;k>=0;k--){
                if(a[i][k]=='.') s++;
                else break;
            }
            //cout<<s<<endl;
            for(k=i+1;k<h;k++){
                if(a[k][j]=='.') s++;
                else break;
            }
            //cout<<s<<endl;
            for(k=i-1;k>=0;k--){
                if(a[k][j]=='.') s++;
                else break;
            }
            //cout<<s<<endl;
        }
    }
    cout<<s+1<<endl;
}


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

#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif

#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 1000000007;

const string FIRST = "First";
const string SECOND = "Second";
auto solveCase(int n, const vector<int64_t> &a)
{
    // TODO: edit here
    if (n % 2)
        return SECOND;
    map<int, int> cnt;
    for (auto &x : a)
        cnt[x]++;
    for (auto &x : cnt)
    {
        if(x.second % 2)
            return FIRST;
    }
    return SECOND;

}

// generated by oj-template v4.7.2 (https://github.com/online-judge-tools/template-generator)
int main()
{
#ifndef LOCAL
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    constexpr char endl = '\n';
    // failed to analyze input format
    // TODO: edit here
    int t, n;
    cin >> t;
    for (size_t i = 0; i < t; i++)
    {
        cin >> n;
        vector<int64_t> a(n);
        for (int i = 0; i < n; ++i)
            cin >> a[i];
        auto ans = solveCase(n, a);
        cout << ans << '\n';
    }

    return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
int solve(){
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++) scanf("%d",a+i);
	if(n%2){
		puts("Second");
		return 0;
	}
	sort(a,a+n);
	for(int i=0;i<n;){
		int st=0;
		while(st+i<n and a[st+i]==a[i]) st++;
		if(st&1){
			puts("First");
			return 0;
		}
		i+=st;
	}
	puts("Second");
	return 0;
}
int main(){
	int t;
	cin>>t;
	while(t--) solve();
}


#include<bits/stdc++.h>
using namespace std ;
#define long long ll
#define mod 1000000007
int main ()
{
	string str ;
	cin >> str ;
	int count=0 ;
	for (int i=0;i<=(str.length()-4);i++)
	{
		if(str[i]=='Z')
		{
			if(str[i+1]=='O'&&str[i+2]=='N'&&str[i+3]=='e')
			count++;
		}
	}
	cout<<count<<"\n";
}

#include              <bits/stdc++.h>
#define ll            long long int
#define w(t)          int t; cin>>t; while(t--)
#define F             first
#define S             second
#define pb            push_back
#define mp            make_pair
#define pii           pair<int,int>
#define mii           map<int,int>
#define sp(x,y)       fixed<<setprecision(y)<<x
using namespace std;
int countFreq(string &pat, string &txt)
{
	int M = pat.length();
	int N = txt.length();
	int res = 0;
    for (int i = 0; i <= N - M; i++)
	{
		int j;
		for (j = 0; j < M; j++)
			if (txt[i+j] != pat[j])
				break;
		if (j == M)
		{
		res++;
		j = 0;
		}
	}
	return res;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s,a="ZONe";
    cin>>s;
    cout << countFreq(a, s);
    return 0;
}


#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef pair<ll,int> P ;
#define MAX_M (ll)100
#define MAX_N 100000

int n , m , X , Y ;

struct edge
{
  ll cost ;
  ll limit ;
  int to ;
};

vector<edge> G[100000] ;
ll d[100000] ;

ll djikstra(int s , int t){
  fill(d,d+n,LLONG_MAX) ;
  d[s] = 0 ;
  priority_queue<P,vector<P>,greater<P>> que ;
  que.push(P(0,s)) ;
  while(!que.empty()){
    P p = que.top() ; que.pop() ;
    int v = p.second ;
    if(p.first > d[v]) continue ;
    for(int i = 0 ; i < G[v].size() ; i++){
      edge e = G[v][i] ;
      if(d[v] % e.limit == 0){
        if(d[e.to] > d[v] + e.cost){
          d[e.to] = d[v] + e.cost ;
          que.push(P(d[e.to],e.to)) ;
        }
      }
      else{
        ll mod = d[v] / e.limit + 1 ;
        if(d[e.to] > mod * e.limit + e.cost){
          d[e.to] = mod * e.limit + e.cost ;
          que.push(P(d[e.to],e.to)) ;
        }
      }
    }
  }
  return d[t] ;
}

int main(){
  cin >> n >> m >> X >> Y ;
  for(int i = 0 ; i < m ; i++){
    int A , B ;
    ll tim , k ;
    cin >> A >> B >> tim >> k ;
    edge E , F ;
    E.to = B - 1 ;
    E.cost = tim ;
    E.limit = k ;
    F.to = A - 1 ;
    F.cost = tim ;
    F.limit = k ;
    G[A-1].push_back(E) ;
    G[B-1].push_back(F) ;
  }
  ll ans = djikstra(X-1,Y-1) ;
  if(ans == LLONG_MAX) cout << -1 << endl ;
  else cout << ans << endl ;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

struct Edge {
    ll to, cost, D;
    Edge(ll to, ll cost, ll D): to(to), cost(cost), D(D) {}
};

struct Data {
    ll v, x;  // いまいる頂点v, 進んだ距離x
    Data(ll v, ll x): v(v), x(x) {}
    bool operator<(const Data& hoge) const {
        return x > hoge.x;
    }
};

ll ceil(ll a, ll b) {  // a÷b以上の最小の整数
    if(b == 0) {
        return 0;
    }
    return (a+b-1)/b;
}

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

    vector<vector<Edge>> G(n);
    rep(i, m) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        a--;  b--;
        G[a].emplace_back(b, c, d);
        G[b].emplace_back(a, c, d);
    }

    vl dp(n, INF);  // dp[v] : 頂点vまでの距離の最小値
    priority_queue<Data> Q;
    auto push = [&](ll v, ll x) {
        if(dp[v] <= x) {
            return;
        }
        dp[v] = x;
        Q.emplace(v, x);
    };

    // ダイクストラ法。計算量はO((V+E)*log(V))
    push(sv, 0);
    while(!Q.empty()) {
        Data hoge = Q.top();  Q.pop();
        ll v = hoge.v, x = hoge.x;
        if(dp[v] != x) {
            continue;
        }
        for(Edge e : G[v]) {
            ll u = e.to;
            ll c = e.cost;
            ll d = e.D;
            push(u, d*ceil(x, d) + c);
        }
    }

    if(dp[gv] == INF) {
        out(-1);
    }
    else {
        out(dp[gv]);
    }

    re0;
}


#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << " " << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	rep(i, v.size()) {
		if (i) os << " ";
		os << v[i];
	}
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
#ifdef LOCAL
#define dbg(x) cerr << #x << ": " << (x) << '\n'
#define say(x) cerr << (x) << '\n'
#else
#define dbg(x)
#define say(x)
#endif
string solve(bool a) { return ((a) ? "Yes" : "No"); }
int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;

	int ans = 0;
	cin >> n;
	Vi a(n);
	cin >> a;
	int down = INF;
	rep(i, n) {
		down = INF;
		for (int j = i; j < n; j++) {
			chmin(down, a[j]);
			chmax(ans, down * (j - i + 1));
		}
	}
	cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;
#define fast	ios::sync_with_stdio(0);cin.tie(0);
#define ll	long long int
#define INFL    1e18L
#define INF     2e9
#define nl     	'\n'
#define ld long double
#define precision(x)	fixed << setprecision(x)
const ll mod = 998244353;

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

ll powm(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * 1LL * a) % mod;
		b >>= 1LL;
		a = (a * 1LL * a) % mod;
	}
	return res;
}
const int N = 2e5 + 5;
const int M = 10;

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

void solve() {
	int n;
	cin >> n;
	ll mn[n][n];
	ll a[n];

	for (int i = 0; i < n; i++) cin >> a[i];
	ll ans = 0;
	for (int len = 1; len <= n; len++) {
		for (int i = 0; i <= n - len; i++) {
			int j = i + len - 1;
			if (i == j) {
				mn[i][j] = a[i];
				ans = max(ans, mn[i][j]);
			} else {
				mn[i][j] = min(a[j], mn[i][j - 1]);
				ans = max(ans, mn[i][j] * len);
			}
		}
	}
	cout << ans << nl;
}
int main() {
	fast
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int tc = 1;
	// cin >> tc;
	int _ = 0;
	while (_++ < tc) {
		solve();
	}
	return 0;
}


#include <iostream>

using namespace std;
int N;
long long int A[1000006], B[1000006];

int main(void) {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}

	for (int i = 1; i <= N; i++) {
		cin >> B[i];
	}

	long long int ans = 0;

	for (int i = 1; i <= N; i++) {
		ans += A[i] * B[i];
	}

	if (ans == 0) { cout << "Yes"<<endl;}
	else { cout << "No" << endl; }

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int ll
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vb >
#define pii pair<int,int>
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi >
#define vs vector<string>
#define vvs vector<vs >
#define pqi priority_queue <int>
#define minpqi priority_queue <int, vector<int>, greater<int> >
#define all(x) x.begin(),x.end()
#define mii map<int,int>
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define per1(i,n) for(ll i=n;i>0;i--)
#define repeat(i,start,n) for(ll i=start;i<n;i++)
#define inp(arr,n) ll arr[n];rep(i,n){ cin>>arr[i];}
#define inp1(arr,n) ll arr[n+1];rep1(i,n){ cin>>arr[i];}
#define inp2d(arr,n,m) ll arr[n][m];rep(i,n)rep(j,m)cin>>arr[i][j];
#define inpg(adj,m) rep(i,m){int a,b;cin>>a>>b;adj[a].pb(b);adj[b].pb(a);}
#define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
#define print1(a,n) for(ll i=1;i<=n;i++){ cout<<a[i]<<endl;}
#define mod 1000000007
#define maxx 1000000000000000000
#define PI 3.141592653589793238462643383279
#define mmax(a,b,c) max(a,max(b,c))
#define mmin(a,b,c) min(a,min(b,c))
#define init(arr,a) memset(arr,a,sizeof(arr))
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element

//------------------------------------Code Starts here------------------------------------//

void solve()
{
	int n;
	cin>>n;
	int a[n],b[n];
	for0(i,n)cin>>a[i];
	for0(i,n)cin>>b[i];
	int sum=0;
	for0(i,n)
	{

		sum+=a[i]*b[i];
	}
	if(sum==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return;
}
 signed main()
{
	int t=1;
	//cin>>t;
	while(t--)
	{

		solve();
	}
}


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

#define forn(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f first
#define s second
#define rand(i, j) uniform_int_distribution<ll>((ll)(i), (ll)(j))(rng)
mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<vi> vii;

//Printing pairs and vectors
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
	cout << "["; for (int i = 0; i < (int)v.size(); i++) {if (i) cout << ", "; cout << v[i]; } return cout << "]";
}

//2 147 483 647 int max
//9 223 372 036 854 775 807 ll max

int main(){
	cin.tie(0)->sync_with_stdio(0);

	int n;
	string s;
	cin >> n >> s;
	if(s.at(0) != s.at(n-1)){
		cout << 1 << "\n";
	}else{
		for(int i=1; i<n-1; i++){
			if(s.at(i) != s.at(0) && s.at(i+1) != s.at(0)){
				cout << 2 << "\n";
				return 0;
			}
		}
		cout << -1 << "\n";
	}
}

#define _GLIBCXX_DEBUG
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cur = 0;
  vector<int> cnt(n+1, 0);
  for (int i = 0; i < m; ++i) {
    cnt[a[i]]++;
    while (cnt[cur]) cur++;
  }
  int ans = cur;
  int left = 0, right = m-1;
  for (int i = 0; i < n-m; ++i) {
    right++;
    cnt[a[right]]++;
    cnt[a[left]]--;
    if (cur > a[left] && cnt[a[left]] == 0) cur = a[left];
    left++;
    while (cnt[cur]) cur++;
    if (ans > cur) ans = cur;
  }
  cout << ans << endl;
  return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<stack>
#include<queue>
#include<string>
using namespace std;

const int INF = 1000000001;

typedef pair<int, int> P;
typedef long long ll;

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

#include <bits/stdc++.h>

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(ll i=0;i<(n);++i)
#define repA(i,a,n) for(ll i=a;i<=(n);++i)
#define repD(i,a,n) for(ll i=a;i>=(n);--i)
#define repV(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pb push_back
// #define mp make_pair
#define F first
#define S second
#define CN cout<<"NO\n"
#define CY cout<<"YES\n"
#define M_PI  3.14159265358979323846

using namespace std;
using ll = long long;
#define MAXN 10000001
#define mod 1000000007

void solve(){
    ll a,b,c; cin>>a>>b>>c;
    if(a==b) {
        cout<<c;return;
    }
    if(c==b) {
        cout<<a;return;
    }
    if(a==c) {
        cout<<b;return;
    }
    cout<<"0";

}
int main()
{
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    ll t=1;
    // cin>>t;
    repA(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
int x,y;
cin>>x>>y;
int z=min(x,y);
int g=max(x,y);
if(z+3>g)
    cout<<"Yes";
else
    cout<<" No";

    return 0;
}

// include
#include <algorithm>
#include <complex>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

//型短縮
#define ll long long

//マクロ定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll N, K;
  cin >> N >> K;
  ll res = 0;
  string bigstr = to_string(N);
  string smallstr = to_string(N);
  if (K == 0)
    cout << N;
  else {
    rep(i, K) {
      sort(smallstr.begin(), smallstr.end());
      sort(bigstr.begin(), bigstr.end(), greater<int>());
      ll big = stoll(bigstr);
      ll small = stoll(smallstr);
      if (big - small == res) break;
      res = big - small;
      bigstr = to_string(res);
      smallstr = to_string(res);
    }
    cout << res;
  }
  return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int N;
    cin >> N;
    int x = N/100;
    if (!(N%100==0)) x++;
    cout << x;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <numeric>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <limits>
#include <limits.h>
#include <iomanip>
#include <algorithm>
using namespace std;

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define ull unsigned long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define mkp make_pair
#define fi first
#define se second

void solve() {
    int N;
    cin >> N;
    if(N%100==0)
        cout << N/100;
    else {
        cout << (N/100)+1;
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    IOS;

    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}