//***JAI SHREE KRISHNA***
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define inf             1e18
#define MAX             INT_MAX
#define MIN             INT_MIN
#define F               first
#define S               second
#define pbmax           priority_queue<int>//max heap
#define pbmin           priority_queue<int, vector<int>, greater<int>>//min heap priority_queue
#define lpi(i,a,b)      for(int i=0;i<n;i++)
#define lpd(i,a,b)      for(int i=a;i>=b;i--)
const double pi = 3.14159265359;
const int mod = 1e9 + 7;
void task()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = -1;
    int blue = a;
    int red = 0;
    for (int i = 1; i <= 1e5; i++)
    {

        blue += b;
        red += c;
        if (blue  <= (red )*d)
        {
            ans = i;
            break;
        }

    }
    cout << ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int test_cases = 1;
    //cin >> test_cases;
    while (test_cases--)
    {
        task();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long;
#define INF32 2147483647
const long long INF = 1LL << 60;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;} return 0;}
template<class T> bool chmin(T &a,const T &b){if(b<a){a=b;return 1;} return 0;}

int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    double CD_B = C * D - B;
    double ans = 0;
    if(CD_B <= 0 ){
        cout << -1 << endl;
    }else{
        ans = A / CD_B;
        cout << ceil(ans) << endl;
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>
#include<cmath>
#include<set>

typedef long long ll;

#define debug(x) cout << #x << '=' << x << endl;
#define debug_arr(a, n) for(ll i = 0; i < n; i++){cout << a[i] << ' ';} cout << endl;
#define inf 100000000000
#define loop(i,n) for(ll i = 0; i < n; i++)
#define graph vector<vector<ll>>
#define P pair<ll,ll>

using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<P> jobs(n);

    loop(i,n){
        cin >> jobs[i].first >> jobs[i].second;
    }

    ll ans = inf;
    loop(i,n){
        loop(j,n){
            if(i == j) ans = min(jobs[i].first + jobs[j].second, ans);
            else ans = min(max(jobs[i].first, jobs[j].second), ans);
        }
    }

    cout << ans << endl;
    return 0;

}

#include <bits/stdc++.h>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

using ll = long long;
const int N(1e5 + 10);
int n, tr[200];
std::vector<ll> a[3];

#define Odd(x) ((x) & 1)

ll Dis(int x, int y)
{
	std::set<ll> S; ll ans = 1e18;
	for (auto i : a[y]) S.insert(i);
	for (auto i : a[x])
	{
		auto it = S.lower_bound(i);
		if (it != S.end()) ans = std::min(ans, *it - i);
		if (it != S.begin()) ans = std::min(ans, i - *std::prev(it));
	}
	return ans;
}

int main()
{
#ifndef ONLINE_JUDGE
	file(cpp);
#endif
	tr['R'] = 0, tr['G'] = 1, tr['B'] = 2;
	std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cin >> n;
	for (int i = 1; i <= (n << 1); i++)
		{ ll x; char c; std::cin >> x >> c; a[tr[c]].push_back(x); }
	if (!(Odd(a[0].size()) || Odd(a[1].size()) || Odd(a[2].size()))) return puts("0"), 0;
	if (!Odd(a[0].size())) std::swap(a[0], a[2]);
	if (!Odd(a[1].size())) std::swap(a[1], a[2]);
	printf("%lld\n", std::min(Dis(0, 2) + Dis(1, 2), Dis(0, 1)));
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
#define Type int
#define rept(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) rept(i,0,a)
using namespace std;
void fail(string s){ cout<<s;exit(0); }
void fail(int s){ cout<<s;exit(0); }
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
void init(){
}
void run(){
	int a,b,c;
	cin>>a>>b>>c;
	int d=b*b+c*c;
	if (d<a*a)
		fail(2);
	rep(ans,1000000000000000){
		int t=(ans*a)*(ans*a);
		if (t>=d){
			fail(ans);
		}
	}
}
signed main()
{
	init();
	int tc=1;
//	cin>>tc;
	while (tc--){
		run();
	}
	re 0;
}


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

int main() {
  float A,B;
  cin >> A >> B;

  float V;
  V = (A - B) / A * 100;
  cout << V << endl;
}

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
// clang-format off
#define PI 3.14159265358979323846264338327950L
#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)
#define prep_ios(do_flush) if(!do_flush){ ios::sync_with_stdio(false);cin.tie(nullptr);constexpr char endl='\n'; } cout<<fixed<<setprecision(20)
#define put(expr) cout<<expr<<'\n'
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "[ "; for (auto v: vec) os << v << " "; os << "]"; return os; }template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "< "; for (auto v: vec) os << v << " "; os << ">"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{ "; for (auto v: vec) os << v << " "; os << "}"; return os; }template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{ "; for (auto v: vec) os << v << " "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{ "; for (auto v: mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{ "; for (auto v: mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
typedef int8_t i8; typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; typedef float f32; typedef double f64; typedef long double f80;
typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef map<int, int> mii;
typedef __int128_t i128; i128 parse(string &s) { i128 ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } istream &operator>>(istream &is, i128 &v) { string s; is >> s; v = parse(s); return is; } ostream &operator<<(ostream &os, const i128 &v) { if (v == 0) return (os << "0"); i128 num = v; if (v < 0) { os << '-'; num = -num; } string s; for (; num > 0; num /= 10) s.push_back('0' + (char)(num % 10)); reverse(s.begin(), s.end()); return (os << s); }
template <typename T> bool chmax(T &now, const T &cand) { if (now < cand) { now = cand; return true; } return false; } template <typename T> bool chmin(T &now, const T &cand) { if (now > cand) { now = cand; return true; } return false; }
template <typename T> T gcd(const T &a, const T &b) { if (a % b == 0) return b; return gcd(b, a % b); } template <typename T> T lcm(const T &a, const T &b) { return a * b / gcd(a, b); }
template <typename T> T nCr(const T &n, T k) { if (k > n) return 0; if (k * 2 > n) k = n - k; if (k == 0) return 1; int result = n; for (int i = 2; i <= k; ++i) { result *= (n - i + 1); result /= i; } return result; }
const int INF = 1<<30; /* INF > 10^9 */ const i64 INFLL = 1LL<<60; /* INFLL > 10^18 */ const string YES = "Yes", NO = "No";

// clang-format on?

int main() {
  prep_ios(true);

  f64 A,B;
  cin >> A>>B;

  put(100.0-(B/A)*100.0);

}


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

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) (v).begin() , (v).end() , comp

# define ll long long
# define ld long double

# define line cout << "\n" ;
# define fast ios_base :: sync_with_stdio ( false ) ; cin.tie ( 0 ) ;

# define pii pair < int , int >
# define pll pair < ll , ll >

# define F first
# define S second

const int mod = 1e9 + 7 ;

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

void solve ( int test_case )
{
    int a , b , c , d ;
    cin >> a >> b >> c >> d ;

    int ans = b - c ;
    cout << ans ; line ;
}

int main()
{
    int t = 1 ;
    // cin >> t ;

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

    return 0 ;
}

#define _DEBUG
#include "bits/stdc++.h"
//#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,a5,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#define debug_6(x1,x2,x3,x4,x5,x6) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<", "#x6<<": "<<x6<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_6,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define prind(argument) cout<<std::fixed<<setprecision(13)<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define puba(a) emplace_back(a)
#define pubamp(a,b) emplace_back(mp(a,b))
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int a,b,c,d;
	scan(a>>b>>c>>d);
	prin(b-c);
	return 0;
}


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

//alias g++='g++ -I/mnt/c/Users/Owner/Desktop/ac-library'
using ll             = long long;
using ld             = long double;
using P              = pair<int, int>;
using PI             = pair<pair<int, int>, int>;
using PL             = pair<long long, long long>;
using PLL            = pair<pair<long long, long long>, long long>;
using Pxy            = pair<long double, long double>;
const int INF        = 1001001007;
const int modd       = 1000000007;
const long long modl = 1000000007LL;
const long long mod  = 998244353LL;
const ll inf         = 2e18;

void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yn(bool t) {
    if (t)
        yes();
    else
        no();
}
void Yes() { cout << "YES" << endl; }
void No() { cout << "NO" << endl; }
void YN(bool t) {
    if (t)
        Yes();
    else
        No();
}

vector<int> dx   = { 0, 1, 0, -1 };
vector<int> dy   = { 1, 0, -1, 0 };
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string alp = "abcdefghijklmnopqrstuvwxyz";

int main() {
    string S;
    cin >> S;
    deque<char> T;
    bool flag = false;

    for (char s : S) {
        if (s == 'R') {
            flag = flag ? false : true;
        } else {
            if (flag)  T.push_front(s);
            else  T.push_back(s);
        }
    }
    if (flag == true) reverse(T.begin(), T.end());
    string U;
    rep(i,T.size()){
        if(U.size() && T[i]==U.back()){
            U.pop_back();
        }
        else U.push_back(T[i]);
    }

    cout << U << endl;
}

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize ("trapv")

#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mkp make_pair
#define pb push_back
#define pf push_front
#define inf 1000000000
#define maxn 300005
#define mod  100000000
#define mod1 1000000009

using namespace std;

void solve(){

  ll n;

  cin>>n;

  ll ans_=LONG_LONG_MAX;

  for(int i=0;i<60;++i){

     ll t=(1LL<<i);

     ll c=n%t;

     ll a=(n/t);

     ans_=min(ans_,a+c+i);

  }

  cout<<ans_<<'\n';

}

int main(){

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

  #ifndef ONLINE_JUDGE

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

  #endif

        // int t;
        // cin>>t;
        // while(t--)
        solve();

return 0;

}


#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
typedef long long ll;
const int N = 100000000;
using namespace std;
//100000000
 int main(){
     int n;
     cin >> n;
     vector<long long> a(n);
     rep(i,n)cin >> a[i];

    sort(a.begin(), a.end(), greater<long long>());

    // rep(i,n){
    //     cout << a[i] << " ";
    // }
    // cout << endl;
    vector<long long> sum(n);

    rep(i,n){
        sum[i] = a[i];
    }
    rep(i,n){
        if(i == 0)continue;
        sum[i] += sum[i - 1];
    }
    rep(i, n){
        // cout << sum[i] << " ";
    }
    // cout << endl;

    long long ans = 0;

    for(int i = 0;i < n - 1;i++){
        ans += a[i] * (n - i - 1) - (sum[n - 1] - sum[i]);
        // cout << ans << endl;
    }

    cout << ans << endl;
    return 0;

 }

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

typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

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

      vector<int>aa(31,0);
      aa[2]=aa[3]=aa[5]=aa[7]=aa[11]=aa[13]=aa[17]=aa[19]=aa[23]=aa[29]=1;
      ll v=1;
      if(n==30)n=29;
      for(ll i=n;i>=2;i--){
        if(v%i!=0)v*=i;
      }

    //   map<int,ll>dp;
    //   dp.clear();
    //   for(ll i=0;i<31;i++){
    //       if(aa[i]==0)continue;
    //       else{

    //           for(int j=1;j<=n;j++){
    //                 ll u = j;
    //                 ll k = 0;
    //                 if(u%i==0){
    //                     k++;
    //                     u/=i;
    //                 }
    //                 dp[i]=max(dp[i],k);
    //           }
    //       }
    //   }

    //   for(ll i=0;i<31;i++){
    //       if(aa[i]){
    //           ll ff=1;
    //           for(int j=1;j<=dp[i];j++){
    //               ff*=i;
    //           }
    //         //   cout<<ff<<" ";
    //           v*=ff;
    //       }
    //   }
      cout<<(v+1)<<"\n";

    //   for(int i=2;i<=n;i++){
    //       cout<<(v+1)%i<<" ";
    //   }
    //   cout<<"\n";

return 0;

}


#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
//#define int long long
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PI = pair<pair<int,int>,int>;
using PL = pair<long long, long long>;
using PLL = pair<pair<long long, long long>, long long>;
using Pxy = pair<long double, long double>;
using Tiib = tuple<int, int, bool>;
using vvl = vector<vector<ll>>;
const int INF = 1001001007;
const int modd = 1000000007;
const long long modl = 1000000007LL;
const long long mod = 998244353LL;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

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

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

char rps(char a, char b){
    if (a == b) return a;
    if (a == 'P'){
        if (b == 'R') return a;
        else return b;
    }
    if (a == 'R'){
        if (b == 'P') return b;
        else return a;
    }
    if (a == 'S'){
        if (b == 'P') return a;
        else return b;
    }
}

int main(){
    int n, k; cin >> n >> k;
    string s; cin >> s;
    s += s;
    rep(i,k){
        string t = "";
        rep(j,s.size() / 2){
            t += rps(s[2*j],s[2*j+1]);
        }
        t += t;
        s = t;
    }
    cout << s[0] << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)

/****************************** CODE IS HERE ***********************************/

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

    int n, m; cin >> n >> m;
    vector <int> A(n), B(m);
    for (int &i: A) cin >> i;
    for (int &i: B) cin >> i;

    vector <vector<int>> dp(n+1, vector<int>(m+1, -1));

    function<int(int, int)> go = [&](int i, int j) {
        if (i == n and j == m) return 0;
        if (i < n and j == m) return (n - i);
        if (i == n and j < m) return (m - j);
        int &res = dp[i][j];
        if (res != -1) return res;
        int ans = 1e9;
        if (A[i] == B[j]) ans = go(i+1, j+1);
        else ans = 1 + go(i+1, j+1);
        ans = min({ans, 1 + go(i+1, j), 1 + go(i, j+1)});
        return res = ans;
    };

    cout << go(0, 0);

    return 0;
}

/*

f(i, j) => min {
        if (A[i] == B[j]) f(i+1, j+1),
        1 + f(i+1, j),
        1 + f(i, j+1),
        1 + f(i+1, j+1)
    }

    base cases:
    if (i == n and j == m) return 0;
    if (i < n and j == m) return (n-i);
    if (i == n and j < m) return (m - j);

*/


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

namespace IO {
	const int MAXIOSIZE = 1 << 24 | 1;
	unsigned char buf[MAXIOSIZE], *p1, *p2;
	#define gc (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2) ? EOF : *p1++)
	template <typename T> void read(T& x) {
		x = 0; char ch = gc; bool flg = false;
		for (; ch < '0' || '9' < ch; ch = gc) if (ch == '-') flg |= true;
		for (; '0' <= ch && ch <= '9'; ch = gc) x = x * 10 + ch - '0';
		flg ? x = -x : 0;
	}
	template <typename T> void out(const T& x) { if (x > 9) out(x / 10); putchar(x % 10 + '0'); }
	template <typename T> inline void write(const T& x, const char& ed = ' ') { if (x < 0) putchar('-'), out(-x); else out(x); putchar(ed); }
}

typedef long long ll;

const int MAXN = 2e5 + 10;
const int MAXLOG = 18 + 10;

int n, q;
vector<int> E[MAXN];
pair<int, int> Edge[MAXN];

int dfsclock, dtp[MAXN];
struct Vertex { int dfn, dep, sz, fa[MAXLOG]; ll val; } vtx[MAXN];

void dfs(int u) {
	dtp[ vtx[u].dfn = ++dfsclock ] = u, vtx[u].sz = 1;
	rep(i, 1, 18) vtx[u].fa[i] = vtx[vtx[u].fa[i - 1]].fa[i - 1];
	vtx[u].dep = vtx[vtx[u].fa[0]].dep + 1;
	for (int v : E[u]) {
		if (v == vtx[u].fa[0]) continue;
		vtx[v].fa[0] = u;
		dfs(v); vtx[u].sz += vtx[v].sz;
	}
}

bool anc_son(int u, int v) { return vtx[u].dfn <= vtx[v].dfn && vtx[v].dfn <= vtx[u].dfn + vtx[u].sz - 1; }

int get_vertex(int u, int v) { // get the closest vertex from u to v
	int r = u;
	per(bit, 18, 0) if (vtx[vtx[r].fa[bit]].dep >= vtx[v].dep + 1) r = vtx[r].fa[bit];
	return r;
}

inline void work(int u, int v, int x) { // reachable for u, withou reaching v
	if (anc_son(u, v) || anc_son(v, u)) {
		if (vtx[u].dep < vtx[v].dep) return vtx[1].val += x, vtx[v].val -= x, void();
		u = get_vertex(u, v); vtx[u].val += x;
		return ;
	}
	vtx[1].val += x, vtx[v].val -= x;
}

ll ans[MAXN];
void calc_ans(int u) {
	vtx[u].val += vtx[vtx[u].fa[0]].val;
	ans[u] = vtx[u].val;
	for (int v : E[u]) if (v != vtx[u].fa[0]) calc_ans(v);
}

int main() {
	#ifdef LOCAL
		freopen("in.txt", "r", stdin);
	#endif
	IO::read(n);
	rep(i, 1, n - 1) {
		int u, v; IO::read(u), IO::read(v);
		Edge[i] = make_pair(u, v);
		E[u].push_back(v), E[v].push_back(u);
	}
	IO::read(q);
	dfs(1);
	rep(i, 1, q) {
		int t, e, x, u, v;
		IO::read(t), IO::read(e), IO::read(x);
		u = Edge[e].first, v = Edge[e].second;
		if (t == 2) swap(u, v);
		work(u, v, x);
	}
	calc_ans(1);
	rep(i, 1, n) IO::write(ans[i], '\n');
	return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

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

    int n, C;
    cin >> n >> C;
    map<int, vector<int>> op;
    map<int, vector<int>> cl;
    vector<int> ip;
    for (int i = 0; i < n; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        op[a].push_back(c);
        cl[b].push_back(c);
        ip.push_back(a);
        ip.push_back(b);
    }
    sort(ip.begin(), ip.end());
    ip.resize(unique(ip.begin(), ip.end()) - ip.begin());
    int cur = 0;
    int prev = -1;
    int ans = 0;
    for (auto x : ip) {
        ans += (x - prev - 1) * min(C, cur);
        for (auto t : op[x]) cur += t;
        ans += min(C, cur);
        for (auto t : cl[x]) cur -= t;
        prev = x;
    }
    cout << ans << '\n';
}


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

#define dvg(x) cout<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#define endl "\n"
#define rep(i, st, n) for(int i = st; i <= n; i += 1)
#define ll long long
#define l64 int64_t
#define ld long double
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll,ll>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pb(x) push_back(x)
#define pp() pop_back()
#define in(x) insert(x)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<Pll>
#define vvi vector<vi>
#define pn(n) cout<<n<<"\n";
#define pn2(x,y) cout<<x<<" "<<y<<"\n";
#define pr(ar) {for (auto i : ar) cout<<i<<" "; cout<<"\n";}
#define get(x) cin>>x;
#define get2(x, y) cin>>x>>y;
#define cn(v) for(auto &i : v) cin>>i;
#define sq(a) (a*a)
#define mem(x, y) memset(x, y, sizeof(x))

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

int const N = 1e5 + 10;

void solve()
{
	double n; cin>>n;
	double ans = 0;
	for(int i = 1; i < n; i++) ans += 1.000/i;
	ans *= n;

	setprecision(12);
	cout<<fixed<<ans<<endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int T = 1;
	//
	while(T--)
	{
		solve();
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector<vpit> vpitt;
typedef long double ld;
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};

void solve(int tc){
	int n;
	cin >> n;
	double ans = 0;
	for(int e=1;e<n;e++) ans += (double)n/(double)e;
	printf("%.9lf",ans);
}

int main(void){
	/*
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	*/
	int tc = 1;
	/*
		cin >> tc;
	*/
	for(int test_number=1;test_number<=tc;test_number++){
		solve(test_number);
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

// using mint = long double;
// using mint = modint998244353;
// using mint = modint1000000007;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 1e18;
const ll fact_table = 320000;

priority_queue<ll> pql;
priority_queue<P> pqp;
// big priority queue
priority_queue<ll, vector<ll>, greater<ll>> pqls;
priority_queue<P, vector<P>, greater<P>> pqps;

// small priority queue
// top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};
//↓,→,↑,←

#define p(x) cout << x << "\n";
#define el cout << endl;
#define pe(x) cout << x << " ";
#define ps(x) cout << fixed << setprecision(25) << x << endl;
#define pu(x) cout << (x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = a; i <= (b); i++)
#define rep3(i, a, b) for (ll i = a; i >= (b); i--)
#define all(c) begin(c), end(c)
#define sorti(v) sort(all(v))
#define sortd(v)                                                               \
    sort(all(v));                                                              \
    reverse(all(v));
#define SUM(v) accumulate(all(v), 0LL)
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

// vec v(n) -> 長さnのベクトルを宣言
// mat dp(h, vec(w)) -> h * w の行列を宣言

// const ll mod = 1000000007ll;
const ll mod = 998244353ll;

ll mypow(ll a, ll b, ll m = mod) {
    ll x = 1;
    while (b) {
        while (!(b & 1)) {
            (a *= a) %= m;
            b >>= 1;
        }
        (x *= a) %= m;
        b--;
    }
    return x;
}
vec rv(ll read) {
    vec res(read);
    for (int i = 0; i < read; i++) {
        cin >> res[i];
    }
    return res;
}
/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}

ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod) * rfact[n - r]) % mod;
}
*/
bool icpc = false;
bool multicase = false;

map<ll, ll> mp;

bool solve() {
    ll n;
    cin >> n;
    ll sum = 0;
    ll ans = 0;
    mp[0]++;
    rep(i, n) {
        ll value;
        cin >> value;
        if (i % 2 == 0) value *= -1;
        sum += value;
        mp[sum]++;
    }
    for (auto [num, cnt] : mp) {
        ans += cnt * (cnt - 1) / 2;
    }
    p(ans);

    return true;
}
/*

*/

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    if (icpc) {
        while (solve())
            ;
        return 0;
    }
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // cout << "Case #" << testcase << ": ";
        solve();
        testcase++;
    }

    // solve();
    return 0;
}

#include <iostream>
#include <string>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define pb push_back
#define fo(i, a, b) for (int i = a; i < b; i++)
#define sqr(x) ((ll)(x) * (x))
#define p(a) cout << a << "\n"
#define fast_io              \
    ios::sync_with_stdio(0); \
    cin.tie(0);

inline string IntToString(ll a)
{
    char x[100];
    sprintf(x, "%lld", a);
    string s = x;
    return s;
}
void PrintArr(ll Arr[], ll N)
{
    cout << "Printing: \n";
    fo(j, 0, N)
    {
        cout << Arr[j] << " ";
    }
    printf("\n");
}

inline ll StringToInt(string a)
{
    char x[100];
    ll res;
    strcpy(x, a.c_str());
    sscanf(x, "%lld", &res);
    return res;
}
bool prime(ll no)
{
    if (no < 3)
        return false;
    int factor = 0;
    for (int i = 2; i * i <= no; i++)
    {
        if (no % i == 0)
        {
            return false;
        }
    }
    return true;
}
long long lcm(ll a, ll b)
{
    return (a * b) / (__gcd(a, b));
}
/*...........................DSU.................................*/
void unin(int u,int v,int parent[])
{
    parent[u]+=parent[v];
    parent[v]=u;
}
int find(int n,int parent[])
{
    if(parent[n]<0)
    return n;
    return parent[n]=find(parent[n],parent);
}
/*.................................................................code starts here.........................................................*/
void testCase()
{
    ll l,r; cin>>l>>r;
    ll avail=r-l;
    ll ans=0;
    if(l==r && l!=0)
    {
        cout<<"0\n";
    }
    else if(l==r && l==0)
    {
        cout<<"1\n";
    }
    else if(2*l>r)
    cout<<"0\n";
    else{
        avail-=l; avail+=1;
        if(avail>0)
        ans=(avail*(avail+1))/2;
        else if(avail==0)
        ans=1;
        cout<<ans<<endl;
    }
}
int main()
{
    fast_io int t;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    cin>>t;
    while (t--)
    {
        testCase();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<int> A(n), B(n), C(n);
  rep(i, n) cin >> A[i];
  rep(i, n) cin >> B[i];
  rep(i, n) cin >> C[i];
  vector<int> D(n);
  rep(i, n) D[i] = B[C[i]-1];
  map<int, int> cntA, cntD;
  rep(i, n) {
    cntA[A[i]]++;
    cntD[D[i]]++;
  }
  ll ans = 0;
  for(auto [a, c]: cntA) {
    ans += 1LL * c * cntD[a];
  }
  cout << ans << endk;
  return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = (sizeof(int) == 4 ? 1e9 : 2e18) + 1e5;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// #define MULTIPLE_TEST_CASES
void solve(const int test) {
  int n;
  cin >> n;
  int k;
  cin >> k;

  while (k--) {
    if (n % 200 == 0) {
      n /= 200;
    } else {
      n *= 1000;
      n += 200;
    }
  }
  cout << n << endl;
}

signed main() {
  // const string FILE_NAME = "";
  // freopen((FILE_NAME + string(".in")).c_str(), "r", stdin);
  // freopen((FILE_NAME + string(".out")).c_str(), "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  for (int i = 1; i <= t; ++i)
    solve(i);
}


#include <bits/stdc++.h>
int main(){
    int a, b, c, d;
    std::cin >>a >> b >> c >> d;
    std::cout << (a*d - b*c) << std::endl;
}

#include <math.h>
#include <stdio.h>
#include <time.h>

#include <algorithm>
#include <complex>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout << "YES" << endl
#define cNO cout << "NO" << endl
#define cYes cout << "Yes" << endl
#define cNo cout << "No" << endl
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Rep(i, a, b) for (ll i = (a); i < (b); ++i)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define rRep(i, a, b) for (ll i = a; i >= b; i--)
#define crep(i) for (char i = 'a'; i <= 'z'; ++i)
#define psortsecond(A, N) \
  sort(A, A + N,          \
       [](const pii& a, const pii& b) { return a.second < b.second; });
#define ALL(x) (x).begin(), (x).end()
#define debug(v)      \
  cout << #v << ":";  \
  for (auto x : v) {  \
    cout << x << ' '; \
  }                   \
  cout << endl;
#define endl '\n'
int ctoi(const char c) {
  if ('0' <= c && c <= '9') return (c - '0');
  return -1;
}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll MOD = 1000000007;
constexpr ll INF = 1000000011;
constexpr ll MOD2 = 998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS = 10e-8;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return 1;
  }
  return 0;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto&& x : v) is >> x;
  return is;
}
template <typename T, typename U>
istream& operator>>(istream& is, pair<T, U>& p) {
  is >> p.first;
  is >> p.second;
  return is;
}
template <typename T, typename U>
ostream& operator>>(ostream& os, const pair<T, U>& p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto i = begin(v); i != end(v); ++i) {
    if (i != begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

// modint

template <std::uint_fast64_t Modulus>
class modint {
  using u64 = std::uint_fast64_t;

 public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64& value() noexcept { return a; }
  constexpr const u64& value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint& operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint& operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint& operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint& operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

int main() {
  string S;
  ll A, B, C, D, E, F, G, H, L, M, N, P, Q, R, T, U, X, Y, Z;
  cin >> A >> B >> C >> D;
  cout << A * D - B * C << endl;
}


//
// Created by whq on 2021/2/21.
//

#include <bits/stdc++.h>

#define uset unordered_set
#define umap unordered_map
#define debug cout<<"ok"<<endl
#define ll long long
#define ii pair<ll, ll>
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vvl vector<vector<ll>>
#define vl vector<ll>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define For(i, n) for (int i = 0; i < n; i++)
#define forn(i, a, b) for(int i=a;i<=b;i++)
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end()
#define lowbit(x) x&(-x)
using namespace std;

class A {
public:
    void solve() {
        ll k;
        cin >> k;
        ll res = 0;
        for (ll i = 1; i * i * i <= k; i++) res++;
        for (ll i = 1; i * (i + 1) <= k; i++) {
            for (ll j = i + 1; j * i <= k; j++) {
                if (i * i * j <= k) res += 3;
                if (i * j * j <= k) res += 3;
            }
        }
        for (ll i = 1; i * (i + 1) <= k; i++) {
            for (ll j = i + 1; j * i <= k; j++) {
                for (ll l = j + 1; l * j * i <= k; l++) res += 6;
            }
        }
        cout << res << endl;
    }
};

class B {
public:
    ll base;

    ll fpow(ll a, ll k) {
        if (k == 0) return 1;
        ll temp = fpow(a, k / 2) % base;
        temp = (temp * temp) % base;
        if ((k % 2) == 1) return ((temp % base) * (a % base)) % base;
        else return temp;
    }

    ll superPow(ll a, ll b) {
        if(b==0) return 1ll;
        ll p1=fpow(a,b%10);
        ll p2=fpow(superPow(a,b/10),10);
        return (p1)*(p2)%base;
    }
    void solve() {
        ll a, b, c;
        cin >> a >> b >> c;
        set<int> one = {0, 1, 5, 6};
        ll cur = a % 10;
        map<int, map<int, int> > two;
        two[4][1] = 4;
        two[4][0] = 6;
        two[9][1] = 9;
        two[9][0] = 1;
        if (one.count(cur)) {
            cout << cur << endl;
            return;
        }
        if (cur == 4 || cur == 9) {
            cout << two[cur][b % 2] << endl;
            return;
        }
        base = 4;
        map<int, map<int, int>> f;
        f[2][1] = 2;
        f[2][2] = 4;
        f[2][3] = 8;
        f[2][0] = 6;
        f[3][1] = 3;
        f[3][2] = 9;
        f[3][3] = 7;
        f[3][0] = 1;
        f[7][1] = 7;
        f[7][2] = 9;
        f[7][3] = 3;
        f[7][0] = 1;
        f[8][1] = 8;
        f[8][2] = 4;
        f[8][3] = 2;
        f[8][0] = 6;
        ll left=superPow(b,c)%base;
        cout<<f[cur][left]<<endl;
    }
};
class C{
public:
    void solve(){
        string s;
        cin>>s;
        vi cnt(26,0);
        ll n=s.size();
        ll res=0;
        for(int i=n-1;i>=0;i--){
            cnt[s[i]-'a']++;
            if(i+1<n&&s[i]==s[i+1]){
                res+=n-i-cnt[s[i]-'a'];
                for(int j=0;j<26;j++){
                    if(j==s[i]-'a') continue;
                    cnt[s[i]-'a']+=cnt[j];
                    cnt[j]=0;
                }
            }
        }
        cout<<res<<endl;
    }
};
class D{
public:
    ll base=998244353;
    ll binpow(ll a, ll b) {
        ll res = 1;
        while (b > 0) {
            if (b & 1) res = res * a%base;
            a = a * a%base;
            b >>= 1;
        }
        return res;
    }
    void solve(){
        ll n,m,k;
        cin>>n>>m>>k;
        ll res=0;
        if(n==1||m==1){
            cout<<binpow(k,n*m)<<endl;
            return;
        }
        for(ll i=1;i<=k;i++) {
            ll tot=(binpow(i,n)-binpow(i-1,n))%mod;
            res=(res+tot*(binpow(k-i+1,m))%base)%base;
        }
        if(res<0) res+=base;
        cout<<res%base<<endl;
    }
};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    D ans;
    ans.solve();
    return 0;
}

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for (ll i = j; i < (n); ++i)
#define rrep(i, j, n) for (ll i = (n)-1; j <= i; --i)

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& a) {
  for (size_t i = 0; i < a.size(); ++i) os << (i > 0 ? " " : "") << a[i];
  return os << '\n';
}

[[maybe_unused]] constexpr ll MOD = 998244353;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

ll mpow(ll x, ll e) {
  ll res = 1;
  while (e > 0) {
    if (e & 1) res = res * x % MOD;
    x = x * x % MOD;
    e >>= 1;
  }
  return res;
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  ll n, m, k;
  cin >> n >> m >> k;
  if (n == 1 || m == 1) {
    if (n == 1 && m == 1) {
      cout << k;
      return 0;
    }
    if (n == 1) {
      ll ans = 0;
      rep(i, 1, k + 1) {
        // 行の最小値がi
        // 少なくとも人つ
        ans += (MOD + (mpow(k - (i - 1), m) - mpow(k - i, m)) % MOD) % MOD;
        ans %= MOD;
      }
      cout << ans;
      return 0;
    }
    if (m == 1) {
      ll ans = 0;
      rep(i, 1, k + 1) {
        ans += (MOD + (mpow(i, n) - mpow(i - 1, n)) % MOD) % MOD;
        ans %= MOD;
      }
      cout << ans;
      return 0;
    }
  }

  // aのみの問題を考える。　➡　各行は独立なので、普通にk^n
  // マスの埋め方は
  // a[i]==xの時、i行目にはx未満の値が現れない　∧　xが少なくとも一回現れる。

  // k^nで決めた後、aのmax以上の値は、任意のbで取れる。
  // aのmaxがxとなる組み合わせ * (x ~ k)^m
  ll ans = 0;
  rep(x, 1, k + 1) {
    ll tmp = (MOD + (mpow(x, n) - mpow(x - 1, n)) % MOD) % MOD;
    ans += tmp * mpow(k - x + 1, m) % MOD;
    ans %= MOD;
  }
  cout << ans;

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long int ll;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for(auto it = d.b;it != d.e;++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

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

  ll s, p;cin >> s >> p;
  bool ans = false;
  for(ll i = 1;i * i <= p;i++){
    if(p % i == 0){
      ll fst = i;
      ll snd = p / i;
      if(fst + snd == s)ans = true;
    }
  }
  if(ans)cout << "Yes";
  else cout << "No";
  cout << endl;
}

#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
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> inline T int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
#include <bits/stdc++.h>
using namespace std;
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
// sort(ALL(v), [](auto const& lhs, auto const& rhs) { return lhs > rhs; /* 左の方が大きい...というイメージ。*/ });
// --------------------------------------------------------------------------------------------- //

static const int MAX = 100001;
static const ll MOD = 1000000007;

ll dividedNum(ll n){
	ll ret = 0;
	ll lim = sqrt(n)+1;
    for(ll i=1; i<lim; i++){
        if(n%i==0){
            ret++;
            if(i != n / i && lim <= n/i){
                ret++;
            }
        }
	}
	ll res = ret / 2 * 2;
	res += ret % 2;
    return res;
}

ll dp[MAX];
ll N, K;
ll dividedNum2(ll n){
	if(n == 2) return 1;
	ll ret = 0;
	ll ng_num = max(0LL, n - N - 1LL);
	ll tmp = (n-1)/2 - ng_num;
	ret += tmp * 2;
	ret = max(0LL, ret);
	if(n % 2 == 0 && n / 2 <= N){
		ret++;
	}

	return max(0LL, ret);
}

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	cin >> N >> K;

	if(K < 0) K *= -1;
	memset(dp, 0, sizeof(dp));

	// 足したら2 * Nになるやつを求める

	ll ans = 0;
	// A決定
	for(int i=2; i<=2 * N; i++){
		//  Kから，B決定
		ll A = i;
		ll B = A - K;
		if(!(2 <= B && B <= 2 * N)){
			continue;
		}
		// cout << A << " " << B << endl;
		// A, Bの作り方の個数を調べる
		ll a_num = dividedNum2(A);
		ll b_num = dividedNum2(B);
		// cout << a_num << " " << b_num << endl;
		// それの掛け算をansにプラス
		ans += a_num * b_num;
	}
	cout << ans << endl;

	return 0;
}


#ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif

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

#pragma region macros

using str=string;
using ll=long long;
using vl=vector<ll>;
using vc=vector<char>;
using pl=pair<ll,ll>;
using ml=map<ll,ll>;
using sl=set<ll>;
template<class T> using V=vector<T>;
template<class T,class U> using P=pair<T,U>;

#define FOR(n) for(ll i=0;i<n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=1;i<n;i++)
#define REP(i,m,n) for(ll i=m;i<n;i++)
#define drep(i,n) for(ll i=n-1;i>=0;i--)
#define fore(n) for(auto&& i:n)
#define fors(n) for(auto&&[i,j]:n)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sor(v) sort(all(v))
#define rsor(v) sort(rall(v))
#define rev(v) reverse(all(v))
#define low(v,x) lower_bound(all(v),x)-v.begin()
#define up(v,x) upper_bound(all(v),x)-v.begin()
#define acc(v) accumulate(all(v),0LL)
#define ef(x) emplace_front(x)
#define eb(x) emplace_back(x)
#define pf() pop_front()
#define pb() pop_back()
#define mp(a,b) make_pair(a,b)
#define ceil(a,b) (a+b-1)/b
#define bit(n) (1LL<<n)

#define fi first
#define se second
#define fr front()
#define ba back()
#define be begin()
#define en end()
#define br break
#define cn continue
#define wh while
#define el else if
#define re return

const ll inf=1LL<<60;
const ll mod=1000000007;
const ll MOD=998244353;
const double pi=3.1415926535;
const double eps=1e-10;
const ll dx[4]={1,0,-1,0};
const ll dy[4]={0,1,0,-1};

void input(){}
void inputs(){}
void output(){}
template<class T,class...U> void input(T& x,U&...y){cin>>x;input(y...);}
template<class...T> void in(T&...x){input(x...);}
template<class T> void inputs(const ll t,T& x){cin>>x[t];}
template<class T,class...U> void inputs(const ll t,T& x,U&...y){cin>>x[t];inputs(t,y...);}
template<class T,class...U> void inputs(T& x,U&...y){rep(t,size(x))inputs(t,x,y...);}
template<class...T> void ins(T&...x){inputs(x...);}
template<class T,class...U> void output(T x,U...y){cout<<x<<"\n";output(y...);}
template<class...T> void out(T...x){output(x...);}
template<class...T> void fin(T...x){out(x...);exit(0);}
template<class T> istream&operator>>(istream& i,V<T>& v){for(T& x:v)i>>x;re i;}
template<class T,class U> istream&operator>>(istream& i,P<T,U>& p){re i>>p.fi>>p.se;}
template<class T> ostream&operator<<(ostream& o,V<T>& v){for(T& x:v)o<<x<<" ";re o;}
template<class T,class U> ostream&operator<<(ostream& o,P<T,U>& p){re o<<p.fi<<" "<<p.se;}

void yn(bool b){fin((b?"Yes":"No"));}
void YN(bool b){fin((b?"YES":"NO"));}
void pos(bool b){fin((b?"POSSIBLE":"IMPOSSIBLE"));}
template<class T,class U> void chmax(T& a,U b){if(a<b)a=b;}
template<class T,class U> void chmin(T& a,U b){if(a>b)a=b;}
template<class T,class U> auto max(T a,U b){re a>b?a:b;}
template<class T,class U> auto min(T a,U b){re a<b?a:b;}
ll qp(ll x,ll n){ll r=1;wh(n>0){if(n&1)r*=x;x*=x;n>>=1;}re r;}
ll mdp(ll x,ll n){ll r=1;wh(n>0){if(n&1)r=r*x%mod;x=x*x%mod;n>>=1;}re r;}
ll MDp(ll x,ll n){ll r=1;wh(n>0){if(n&1)r=r*x%MOD;x=x*x%MOD;n>>=1;}re r;}

struct UnionFind{
    vl par,sz;
    UnionFind(ll n):par(n),sz(n,1){rep(i,n) par[i]=i;}
    ll rot(ll x){
        if(par[x]==x) re x;
        re par[x]=rot(par[x]);
    }
    void uni(ll x,ll y){
        x=rot(x),y=rot(y);
        if(x==y) re;
        if(sz[x]<sz[y]) swap(x,y);
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool eql(ll x,ll y){re rot(x)==rot(y);}
    ll siz(ll x){re sz[rot(x)];}
};

struct IOSetup{
    IOSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(10);
    }
}iosetup;

#pragma endregion

signed main(){
    ll x,y; in(x,y);

    if(x==y) out(x);
    else{
        if(x==1){
            if(y==0) out(2);
            else out(0);
        }
        if(x==2){
            if(y==0) out(1);
            else out(0);
        }
        if(x==0){
            if(y==1) out(2);
            else out(1);
        }
    }
}

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=998244353;
LL a[500010],b[500010],ans;
int n,m,k;
LL pw(LL x,LL y){
    LL t=1;
    for (;y;y>>=1){
        if (y&1) t=t*x%MO;
        x=x*x%MO;
    }
    return t;
}
int main(){
    cin>>n>>m>>k;
    if (n==1 || m==1){
        ans=pw(k,n*m);
        ans=(ans%MO+MO)%MO;
        cout<<ans<<endl;
        return 0;
    }
    FOR(i,1,k) a[i]=(pw(i,n)-pw(i-1,n))%MO;
    FOR(i,1,k) b[i]=(pw(k-i+1,m)-pw(k-i,m))%MO;
    FORD(i,k,1) (b[i]+=b[i+1])%=MO;
    FOR(i,1,k) (ans+=a[i]*b[i])%=MO;
    ans=(ans%MO+MO)%MO;
    cout<<ans<<endl;
    return 0;
}


//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
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 T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
template<typename T>void rearrange(vector<ll>&ord, vector<T>&v){
  auto tmp = v;
  for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<ll>&ord,Head&& head, Tail&&... tail){
  rearrange(ord, head);
  rearrange(ord, tail...);
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  string s,t;cin>>s>>t;
  vector<ll>l,r;
  rep(i,0,n)if(s[i]=='1')l.PB(i);
  rep(i,0,n)if(t[i]=='1')r.PB(i);
  ll idx=0;
  rep(i,0,l.size()){
    if(idx==r.size()||l[i]<r[idx]){
      if(i+2>l.size()){
        judge=false;
        break;
      }
      res+=l[i+1]-l[i];
      i++;
    }
    else{
      res+=l[i]-r[idx];
      idx++;
    }
    //cout<<i spa res<<endl;
  }
  if(idx!=r.size())judge=false;
  ans(judge,res,-1);
  return 0;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<climits>
#include<utility>
#include<vector>
#include<queue>
#define int long long
using namespace std;
const int MaxN = 500005;
int n, ans;
char s[MaxN], t[MaxN];
queue<int> pos;

inline int Read(){
	int num = 0, op = 1;
	char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-') op = -1;
		ch = getchar();
	}
	while(isdigit(ch)){
		num = num * 10 + ch - '0';
		ch = getchar();
	}
	return num * op;
}

signed main(){
	n = Read();
	scanf("%s%s", s+1, t+1);
	for(int i=1; i<=n; i++)
		if(s[i] == '1') pos.push(i);
	for(int i=1; i<=n; i++){
		if(s[i] == t[i]){
			if(s[i] == '1') pos.pop();
			continue;
		}
		else if(s[i] == '1' && t[i] == '0'){
			if(pos.empty()){
				printf("-1");
				return 0;
			}
			int p1 = pos.front();
			pos.pop();
			if(pos.empty()){
				printf("-1");
				return 0;
			}
			int p2 = pos.front();
			pos.pop();
			ans += (p2 - p1);
			s[p1] = s[p2] = '0';
		}
		else if(s[i] == '0' && t[i] == '1'){
			if(pos.empty()){
				printf("-1");
				return 0;
			}
			int p = pos.front();
			pos.pop();
			ans += (p - i);
			s[p] = '0', s[i] = '1';
		}
	}
	printf("%lld", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

#define MAX_N 200005

class UnionFind
{
public:
  int par[MAX_N];
  int depth[MAX_N];
  int nGroup[MAX_N];

  UnionFind(int n) {
    init(n);
  }

  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }

  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  UnionFind uf(200001);
  rep(i, n) {
    uf.unite(A[i], A[n-1-i]);
  }
  ll ans = 0;
  rep(i, 200001) {
    if(uf.root(i) == i) {
      ans += uf.nGroup[i]-1;
    }
  }
  cout << ans << endk;
  return 0;
}

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

const int N=110000;
int n,L,a[N],b[N],c[N],d[N];
long long ans;
int main() {
	cin>>n>>L;
	for(int i=1;i<=n;++i) cin>>a[i], c[i]=a[i]-a[i-1]-1; c[n+1]=L-a[n];
	for(int i=1;i<=n;++i) cin>>b[i], d[i]=b[i]-b[i-1]-1; d[n+1]=L-b[n];
	for(int i=1,j=1;i<=n+1;++i) if(d[i]) {
		int sum=0,las=j;
		while(c[las] == 0) ++las;
		j=las;
		while(sum<d[i]) sum += c[j], ++j;
		if(sum != d[i]) puts("-1"), exit(0);
		ans += max(i-las,0)+max(j-i-1,0);
	}
	cout<<ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*............................................................................*/
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/* find_by_order(x) give iterator of the index x
   order_by_key(x) give the position where x will be placed*/
#define int long long
#define lop(i,a,b,c) for (int i=a;i<b;i+=c)
#define rlop(i,a,b,c) for (int i=a-1;i>=b;i-=c)
#define prii pair <int,int>
#define PB push_back
#define S second
#define F first
#define B begin()
#define E end()
#define count_1(x) __builtin_popcount(x)

/*......................................................................*/

void solve(){
	int t,n;cin>>t>>n;
	int lw=1;int hg=1e15;int md;int ans;
	while (lw<=hg){
		md=(lw+hg)/2;
		int z=(md*t)/100;
		if (z<n){
			ans=md;lw=md+1;
		}
		else hg=md-1;
	}ans+=n;cout<<ans<<"\n"; return ;
	if (n%t==0){
		int a=n/t;a--;
		int b=100+t;b=b*a;
		cout<<b+t*ans<<"\n";return ;
	}
	int a=n/t;
		int b=100+t;b=b*a;
		cout<<b+(n%t)*ans<<"\n";return ;
}
int32_t main(){
	int t;t=1;
	//cin>>t;
	while (t--){
		solve();
	}
	return 0;
}

#include<cstdio>
long long a,b;
int main(){
	scanf("%lld%lld",&a,&b);
	printf("%lld %lld\n",(a+b)/2,(a-b)/2);
	return 0;
}


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

int main() {

  int64_t N;
  cin >> N;

  int d = to_string(N).length();

  int M = 1;
  for (int i = 0; i < d/2; i++) {
    M *= 10;
  }

  if (d%2 == 0) {
    if (N/M <= N%M) cout << N/M << endl;
    else  cout << N/M - 1 << endl;
  }
  else {
    cout << M - 1 << endl;
  }

return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int maxN = 1e6 + 5;
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	ll n;
	cin >> n;

	auto get_num = [] (string s) -> ll {
		ll res = 0;
		for(char &c : s) {
			res *= 10;
			res += (c - '0');
		}
		return res;
	};

	int ans = 0;
	for(int i = 1; i < maxN; i++) {
		string s = to_string(i);
		s += s;
		if(get_num(s) > n) continue;
		++ans;
	}
	cout << ans;
}


#include <bits/stdc++.h>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

using pll = pair<ll, ll>;
using Edge = pair<double, pll>;

void solve(ll N, std::vector<ll> X, std::vector<ll> Y) {
  auto dist = [&](ll i, ll j) -> double {
    return sqrt(pow(X.at(i) - X.at(j), 2) + pow(Y.at(i) - Y.at(j), 2));
  };

  vector<Edge> edges;
  ll s = N, t = N + 1;
  rep(i, N) {
    edges.push_back(Edge(100.0 - Y.at(i), {s, i}));
    edges.push_back(Edge(Y.at(i) + 100.0, {t, i}));
    FOR(j, i + 1, N) { edges.push_back(Edge(dist(i, j), {i, j})); }
  }
  sort(all(edges));
  UnionFind uf(N + 2);
  double r = 0.0;
  for (auto &[d, p] : edges) {
    uf.unite(p.first, p.second);
    if (uf.same(s, t)) {
      r = d / 2.0;
      break;
    }
  }
  cout << r << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  std::vector<ll> x(N);
  std::vector<ll> y(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &x[i]);
    scanf("%lld", &y[i]);
  }
  solve(N, std::move(x), std::move(y));
  return 0;
}

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

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecdouble vector<double>
#define vecchar vector<char>
#define vecstr vector<string>
#define vec2str vector<vector<string>>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define pairll pair<ll,ll>
#define vecpairll vector<pair<long long,long long>>
#define vec2pairll vector<vector<pair<long long,long long>>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

#define INF 1000000000000
#define Pi 3.1415926535897932384626

ll gcd(ll a, ll b)
{
	if (min(a, b) == 0)
		return max(a, b);

	return gcd(min(a, b), max(a, b) % min(a, b));
}

ll lcm(ll a, ll b)
{
	ll buf = gcd(a, b);

	return abs(a*b) / buf;
}

int main() {
	ll n, m, ans = 0;
	string s = "No";
	bool flag = false;

	cin >> n;

	vecll a(n), b(n);

	forll(i, 0, n)
		cin >> a[i];

	forll(i, 0, n)
		cin >> b[i];

	forll(i, 0, n)
	{
		ans += a[i] * b[i];
	}

	if (ans == 0)
		s = "Yes";

	cout << s;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <vector>

#pragma region macros
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) _range(i, 0, n)
#define _range(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload(__VA_ARGS__, _range, _rep, )(__VA_ARGS__)
#define _rrep(i, n) _rrange(i, n, 0)
#define _rrange(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)
#define rrep(...) _overload(__VA_ARGS__, _rrange, _rrep, )(__VA_ARGS__)
#pragma endregion macros

using namespace std;

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

using ll    = long long;
using R     = long double;
const R EPS = 1e-9L;  // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R &r) {
    return (r > EPS) - (r < -EPS);
}
inline R sq(R x) {
    return sqrt(max(x, 0.0L));
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void) {
    int t;
    cin >> t;
    rep(loop, t) {
        int n;
        cin >> n;
        string s1, s2, s3;
        cin >> s1 >> s2 >> s3;
        cout << string(n, '1') + string(n, '0') + "1" << endl;
    }
    return 0;
}

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

// シグマの式変形
// ソートすることで絶対値を外せる

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

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

  vector<ll> s(n + 1, 0);
  rep(i, n) s[i + 1] = s[i] + a[i];

  ll ans = 0;
  rep(i, n) ans += a[i] * i - s[i];

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


#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (n-1) << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
const int MOD = 1000000007;

void solve(){
	int n;
	cin>>n;
	int ans = n/100;
	if(n%100 != 0){
		ans++;
	}
	cout<<ans<<endl;
}

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

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

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


#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <stdio.h>

constexpr int HeighestDim = 505000;

int n, m, k;
long long int res[101];
int dim_a = 0, dim_b = 0;
int A[HeighestDim + 1], B[HeighestDim];

void mult_a(int v){
    for(int i = dim_a, j = i - v; j >= 0; --i, --j){ A[i] -= A[j]; if(A[i] < 0) A[i] += m; }
}
void div_a(int v){
    for(int i = v, j = 0; i <= dim_a; ++i, ++j){
        A[i] += A[j]; if(A[i] >= m) A[i] -= m;
    }
}

void mult_b(int v){
    dim_b += v;
    for(int i = dim_b, j = i - v; j >= 0; --i, --j){
        B[i] -= B[j]; if(B[i] < 0) B[i] += m;
    }
}
void div_b(int v){
    for(int i = v, j = 0; i <= dim_b; ++i, ++j){
        B[i] += B[j]; if(B[i] >= m) B[i] -= m;
    }
}

int len = 0;
char Buffer[20];
char Output[1500];

int main(void){
    A[0] = 1; B[0] = 1;
    scanf("%d%d%d", &n, &k, &m);
    if(n == 1){ printf("%d\n", k); return 0; }
    else if(n == 2){ printf("%d\n%d\n", k, k); return 0; }
    else if(n == 3){
        printf("%d\n%d\n%d\n", k, k * static_cast<long long int>(k + 2) % m, k);
        return 0;
    }
    res[1] = k; res[n] = k; ++k;
    const int hd = (n >> 1) + (n & 1);
    const int nmt = n - 2;
    {
        int i, j;
        for(i = 1, j = k; i <= hd; ++i, j += k){ dim_a += j; mult_a(j); div_a(i); }
        for(; i <= nmt; ++i, j += k){ mult_a(j); div_a(i); }
        mult_b(k); div_b(1);
    }
    for(int i = 2, j = n - 1, I = 2 * k, J = k * (n - 2); ; I += k, J -= k){
        long long int res_v = 0;
        for(int d = 0; d <= dim_b; ++d) res_v += static_cast<long long int>(A[d]) * B[d] % m;
        if(res_v) res_v = (k * res_v - 1) % m; else res_v = m - 1;
        res[i] = res_v; res[j--] = res_v;
        if(i + 1 > j) break;
        mult_a(j); div_a(J);
        mult_b(I); div_b(i++);
    }

    for(int i = 1; i <= n; ++i){
        if(res[i]){
            int l = 0;
            do { Buffer[l++] = res[i] % 10; res[i] /= 10; } while(res[i]);
            while(l--) Output[len++] = Buffer[l] ^ '0';
        }
        else Output[len++] = '0';
        Output[len++] = '\n';
    }
    fwrite(Output, 1, len, stdout);
    return 0;
}

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

using namespace std;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    int N, K, M;
    cin >> N >> K >> M;

    int MX = N * (N + 1) / 2 * K;

    vector<vector<long long>> dp(N + 1, vector<long long>(MX + 1, 0));
    dp[0][0] = 1;

    vector<long long> cnts(N + 1, 0);
    for (int i = 1; i <= N; ++i) {
        fill(cnts.begin(), cnts.end(), 0);

        for (int j = 0; j <= MX; ++j) {
            int x = j % i;
            (cnts[x] += dp[i - 1][j]) %= M;
            if (j - (K + 1) * i >= 0) {
                (cnts[x] += M - dp[i - 1][j - (K + 1) * i]) %= M;
            }
            dp[i][j] = cnts[x];
        }
    }

    for (int i = 1; i <= N; ++i) {
        long long res = 0;
        for (int j = 0; j <= MX; ++j) {
            (res += dp[i - 1][j] * dp[N - i][j]) %= M;
        }
        (res *= K + 1) %= M;
        (res += M - 1) %= M;

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

    return 0;
}


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

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

  long long n;
  cin >> n;

  long long s3 = 3, s5 = 5;
  for (int i = 1; s3 < 1e18; ++i) {
    s5 = 5;
    for (int j = 1; s5 < 1e18; ++j) {
      if (s3 + s5 == n) {
        cout << i << " " << j << '\n';
        return 0;
      }
      s5 *= 5;
    }
    s3 *= 3;
  }

  cout << -1 << "\n";
}

// Author: Vinay Khilwani
// Language: C++

// @vok8: Codeforces, AtCoder, LeetCode, HackerEarth, TopCoder, Google, FB, CSES, Spoj, GitHub
// @vok_8: CodeChef, GFG
// @vok8_khilwani: HackerRank

// Never Stop Trying.
// Trying to be Better than Myself.

// while(true)
// {
//     if(AC)
//     {
//         break;
//     }
//     else if(Contest Over)
//     {
//         Try.
//         Check out Editorial.
//         Understand.
//         Find out your Mistake.
//         Learn the topic (if new).
//         Solve Problems on that topic (if new).
//         Upsolve that problem.
//         break;
//     }
//     else
//     {
//         Try.
//         Use Pen-Paper.
//         Find errors, edge cases, etc.
//         continue;
//     }
// }

// Optimizations
// #pragma GCC optimize("O2")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx2")
// #pragma GCC optimize("Os")

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

// Debugging
#define dbg(a) cerr<<a<<"\n";
#define debug_a(a) for(auto x:a) {cerr<<x<<" ";} cerr<<"\n";
#define debug_b(a) for(auto x:a) {cerr<<"["<<x.first<<", "<<x.second<<"]"<<"\n";} cerr<<"\n";
#define debug_c(a) for(auto x:a) {debug_a(x)} cerr<<"\n";
#define debug_d(a) for(auto x:a) {debug_b(x)} cerr<<"\n";
#define debug_e(a) cerr<<"["<<a.first<<", "<<a.second<<"]"<<"\n";

// Defines
#define fast ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define fr(i,a,n,b) for(int i=a; i<n; i+=b)
#define rfr(i,a,n,b) for(int i=a; i>=n; i-=b)
#define IN cin>>
#define OUT cout<<
#define nl "\n"
#define sz(a) int(a.size())
#define all(a) (a).begin(),(a).end()
#define each(a,b) for(auto &a:b)
#define pb push_back
#define set_bits(a) __builtin_popcountll(a)
#define ar array
#define write(a) for(auto x:a) {OUT x<<" ";} OUT endl;
#define read(a) for(auto &x:a) {IN x;}
// #define oset tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
using ll=long long int;
using ld=long double;
using pll=pair<ll,ll>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vi=vector<int>;
const ll mod=(ll)(1e9)+7LL;
const ll M=998244353LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ld pi=acos(-1);

// General Functions
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo) //Fast Power
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll get_rand(ll l, ll r)
{
    uniform_int_distribution<ll> uid(l,r);
    return uid(rng);
}
void vok()
{
    fast
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("error.txt","w",stderr);
    #endif
}

// Global Variables
const int mxN=int(1e5)+100;

// Solver Function(s)
void solve()
{
    string s;
    IN s;
    OUT s[1]<<s[2]<<s[0]<<nl;
}

// Main Function
int main()
{
    vok();
    int t=1;
    // IN t;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

signed  main(){
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);
	if(A * A + B * B < C * C){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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

#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__ << " = "; debug_print(__VA_ARGS__); } while(false)
template<typename T, typename... Ts> void debug_print(const T &t, const Ts &...ts) { cerr << t; ((cerr << ", " << ts), ...); cerr << endl; }
#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, const T& b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, const T& b) { if (a < b) {a = b; return true; } return false; }
template<typename T, typename... Ts> void print(const T& t, const Ts&... ts) { cout << t; ((cout << ' ' << ts), ...); cout << '\n'; }
template<typename... Ts> void input(Ts&... ts) { (cin >> ... >> ts); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    input(a, b, c);
    print(a * a + b * b < c * c ? "Yes" : "No");
    return 0;
}


#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int a[22];
    int st[22];
    int orr[22];
    int xorr;
    int cnt;
    int temp;
    long long min;
    int aa = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < (1 << (n-1)); i++){
        cnt = 0;
        for (int j = 0; j < (n-1); j++){
            if (i >> j & 1){
                st[j] = 1;
                cnt++;
            } else{
                st[j] = 0;
            }
        }
        for (int j = 0; j < n; j++){
            orr[j] = 0;
        }
        temp = 0;
        aa  = 1;
        for (int j = 0; j < n; j++){
            if (aa != 1){
                orr[temp] = a[j] | orr[temp];
            } else{
                orr[temp] = a[j];
                aa = 0;
            }
            if (st[j] == 1) {
                temp++;
                aa = 1;
            }
        }
        xorr = orr[0];
        for (int j = 1; j <= cnt; j++){
           xorr = xorr ^ orr[j];
        }
        if (i == 0){
            min = xorr;
        } else{
            if (min > xorr) {
                min = xorr;
            }
        }
    }
    printf("%lld", min);
}

/**
*    author:  Takeda Takumi
*    created: 30.03.2021 16:14:34
**/

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

int main() {

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) cin >> a[i];
   int ans = 1<<30;
   rep(s, 0, 1<<(n-1))
   {
       int now = 0;
       int o = 0;
       rep(i,0,n)
       {
           o |= a[i];
           if(s>>i&1){
               now ^= o;
               o = 0;
           }
       }
       now ^= o;
       ans = min(ans, now);
   }
   cout << ans << endl;
   return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
// #define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()

/*** Define fues ***/
#define mx 200005
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 100005
const char nl = '\n';

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, fue) memset(name, fue, sizeof(name))

/*** STLs ***/
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a, pll b) { if (a.ff == b.ff)return a.ss < b.ss; return a.ff > b.ff; }

#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": "

/*** Functions
ll BigMod(ll base, ll pow, ll modfue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modfue);ll total = ((ans % modfue) * (ans % modfue)) % modfue;  if(pow % 2 == 0) return total; else{ return (total * (base % modfue) ) % modfue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool checkprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
ll sumofdigit(ll n){ll sum=0;while(n){sum=sum+n%10;n=n/10;}return sum;}
ll countDigit(ll n) { if (n == 0) return 0; return 1 + countDigit(n / 10); }
ll countDigit(ll n) { return floor(log10(n) + 1); } //only positive
 ***/

template <class T> inline T gcd(T a, T b) {if (b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b, T p) {ll ans = 1; while (p--) ans *= b; return ans;}

void solve()
{
	string s;
	cin>>s;
	string find="ZONe";
	ll n=s.size();

	if(n<4)
	{
		cout<<0;
		return;
	}
	ll c=0;
	loop(i,0,n-3)
	{
		string r=s.substr(i,4);
		// cout<<i<<" "<<r<<nl;

		if(r==find)c++;
	}

	cout<<c;
}

int main()
{

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

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

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

}

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

int main() {
  string s;
  cin >> s;
  int count=0;
  for(int i=0;i<9;i++){
    if(s.at(i)=='Z'){
      if(s.at(i+1)=='O'){
        if(s.at(i+2)=='N'){
          if(s.at(i+3)=='e'){
            count++;
          }

        }
      }
    }
  }
  cout << count << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;

mt19937 rand_mt;
const int XYMAX = 10000;

class xyr{
public:
    int x;
    int y;
    int r;
    int index;

    int a;
    int b;
    int c;
    int d;

    void print(){
        cout << a << " "
             << b << " "
             << c << " "
             << d << endl;
    }

    void read(){
        cin >> x >> y >> r;
    }

    void initialize(){
        a = x;
        b = y;
        c = x+1;
        d = y+1;
    }

    bool overlap(xyr& other){
        if(a < other.c && c > other.a && d > other.b && b < other.d) return true;
        return false;
    }

    bool isValid(){
        if(a < 0 || a >= c)     return false;
        if(b < 0 || b >= d)     return false;
        if(c < a || c >= XYMAX) return false;
        if(d < b || d >= XYMAX) return false;
        return true;
    }

    void update_1();
    void update_2();
};

void xyr::update_1(){
    auto i_change = rand_mt() % 4;
    if     (i_change == 0){ a--;}
    else if(i_change == 1){ b--;}
    else if(i_change == 2){ c++;}
    else if(i_change == 3){ d++;}
}

void xyr::update_2(){
    auto i_change = rand_mt() % 4;
    if     (i_change == 0){ a = rand_mt() % a;}
    else if(i_change == 1){ b = rand_mt() % b;}
    else if(i_change == 2){ c = rand_mt() % c;}
    else if(i_change == 3){ d = rand_mt() % d;}
}

int main()
{
    // Input
    int n;
    cin >> n;
    vector<xyr> XYR(n);
    for(int i=0; i<n; i++){
        XYR[i].read();
        XYR[i].index = i;
        XYR[i].initialize();
    }
    // sort(XYR.begin(), XYR.end(), [](xyr& a, xyr& b){return a.r < b.r;});

    for(int i_try=0; i_try<100000; i_try++){
        auto& p = XYR[i_try%n];
        auto prev = p;
        p.update_1();
        bool isValid = p.isValid();
        for(int j=0; j<n && isValid; j++){
            if(p.index == XYR[j].index) continue;
            if(p.overlap(XYR[j])) isValid = false;
        }
        if(!isValid) p = prev;
    }

    // Output
    if (1){
    sort(XYR.begin(), XYR.end(), [](xyr& a, xyr& b){return a.index < b.index;});
    for(int i=0;i<n;i++){
        XYR[i].print();
    }
    }

    return 0;
}

#include<bits/stdc++.h>
#define w(x)            int x; cin>>x; for(int tc=1;tc<=x;tc++)
#define trace(x) 		cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb push_back
#define pqg priority_queue<int>
#define pqs priority_queue<int,vector<int>,greater<int>>
#define mpii map<int,int>
#define endl "\n"
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define mod 1000000007
#define inp(x) cin>>x;

using namespace std;
void solve(int tc) {
	int a, b, c;
	cin >> a >> b >> c;
	int ans;
	if (c == 0) {
		if (a > b) {
			ans = 1;
		} else
			ans = 0;
	} else {
		if (b > a) {
			ans = 0;
		} else {
			ans = 1;
		}
	}
	if (ans == 1) {
		cout << "Takahashi" << endl;
	} else {
		cout << "Aoki" << endl;
	}

}

int32_t main() {
	FIO
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	// w(x){
	solve(1);
	// }
	return 0;
}


#include<iostream>
#include<vector>

using i64 = int64_t;
template<i64 MOD>
struct modint{
  i64 val;
  modint():val(0){}
  modint(i64 v):val(v<0?(-v)%MOD:v%MOD){}
  operator i64(){return val;}
  modint &operator += (modint other){this->val+=other.val;if(this->val>=MOD)this->val-=MOD;return *this;}
  modint &operator -= (modint other){this->val-=other.val;if(this->val<0)this->val+=MOD;return *this;}
  modint &operator *= (modint other){this->val*=other.val;if(this->val>=MOD)this->val%=MOD;return *this;}
  modint &operator /= (modint other){this->val*=other.inverse();if(this->val>=MOD)this->val%=MOD;return *this;}
  modint operator + (modint other)const{return modint(val)+=other;}
  modint operator - (modint other)const{return modint(val)-=other;}
  modint operator * (modint other)const{return modint(val)*=other;}
  modint operator / (modint other)const{return modint(val)/=other;}
  template<class T>modint operator + (T other)const{return modint(val)+=(modint)other;}
  template<class T>modint operator - (T other)const{return modint(val)-=(modint)other;}
  template<class T>modint operator * (T other)const{return modint(val)*=(modint)other;}
  template<class T>modint operator / (T other)const{return modint(val)/=(modint)other;}
  template<class T>
  modint mpow(T _n)const{i64 n = _n;modint res(1),base(val);while(n){if(n&1)res*=base;base *= base;n >>= 1;}return res;}
  template<class T,class U>
  static modint mpow(T t,U u){return modint(t).mpow(u);}
  modint inverse()const{return mpow(val,MOD-2);}
  friend std::ostream &operator << (std::ostream& os,modint mo){return os<<mo.val;}
  friend std::istream &operator >> (std::istream& is,modint& mo){return is>>mo.val;}
};
constexpr int MOD = 998244353;
using mint = modint<MOD>;
mint operator""_m(unsigned long long x){return (mint)x;}

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

signed main(){

  int n,k;
  std::cin>>n>>k;
  std::vector<mint> a(n);
  for(auto& ai:a)std::cin>>ai;

  std::vector<mint> fac(k+1),inv(k+1),finv(k+1);
  fac[1]=inv[1]=finv[0]=finv[1]=1;
  for(int i=2;i<=k;++i){
    fac[i]=fac[i-1]*i;
    inv[i]=MOD-inv[MOD%i]*(MOD/i);
    finv[i]=finv[i-1]*inv[i];
  }
  std::vector<mint> ushi(k+1);
  rep(j,k+1)rep(i,n)ushi[j]+=(a[i]*2_m).mpow(j);
  std::vector<mint> tapu(k+1);
  rep(j,k+1)rep(i,n)tapu[j]+=a[i].mpow(j)*finv[j];

  auto solve = [&](i64 x){
    mint ans = 0;
    for(int k=0;k<=x;++k){
      ans += tapu[k]*tapu[x-k];
    }
    ans *= fac[x];
    ans -= ushi[x];
    ans /= 2;
    return ans;
  };
  for(int x=1;x<=k;++x)
    std::cout<<solve(x)<<'\n';

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n;
	cin>>n;
	int l,r,ans=0;
	while(n--){
		cin>>l>>r;
		ans+=(l+r)*(r-l+1)/2;
	}
	cout<<ans;
	return 0;
}

#include<bits/stdc++.h>
#define DONTSYNC ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now!
#define TEST unsigned long long T; cin>>T; while(T--)  //loop over each testcase
#define endl "\n"
#define fori(a,start,end) for(int a=start;a<end;a++)
#define forll(a,start,end) for(long long a=start;a<end;a++)
#define forull(a,start,end) for(unsigned long long a=start;a<end;a++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

void solve(){
    /* code */
    double sx,sy,gx,gy; cin>>sx>>sy>>gx>>gy;
    cout<<fixed<<setprecision(9)<< sx+sy*(gx-sx)/(gy+sy);
}

int main()
{
    DONTSYNC;
    // TEST{
        solve();
    // }
    return 0;
}


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

int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    char X[66];
    ll M;
    scanf("%s",X);cin>>M;
    int n=strlen(X);
    int max=0;
    for(int i=0;i<n;i++){
      if(X[i]-'0'>max)max=X[i]-'0';
    }

    ll count=0;

    // for(int base=max+1;;base++){
    //   //cout<<base<<endl;
    //   ll res=0;
    //   int flag=0;
    //   for(int i=0;i<n;i++){
    //     res=res*base+X[i]-'0';
    //     if(res>M){break;flag=1;}
    //   }
    //   //cout<<res<<endl;
    //   if(flag==0){
    //     if(res<=M)count++;else break;
    //   }else break;
    // }
    if(n==1) {
    ll base=max+1;
    __int128 res=0;
      int flag=0;
      for(int i=0;i<1;i++){
        res=res*base+X[i]-'0';
        if(res>M){flag=1;break;}
      }
      //cout<<res<<endl;
      if(flag==0){
        if(res<=M)count++;else {cout<<0;return 0;}
      }else {cout<<0;return 0;}
      cout<<1;

    }
    else
    {ll base=max+1;
    __int128 res=0;
      int flag=0;
      for(int i=0;i<n;i++){
        res=res*base+X[i]-'0';
        if(res>M){flag=1;break;}
      }
      //cout<<res<<endl;
      if(flag==0){
        if(res<=M)count++;else {cout<<0;return 0;}
      }else {cout<<0;return 0;}
    ll l=max,r=M+1;
    while(l<=r){
      ll mid=l+r>>1;
      ll base=mid;
      __int128 res=0;
      int flag=0;
      for(int i=0;i<n;i++){
        res=res*base+X[i]-'0';
        if(res>M){flag=1;break;}
      }
      //cout<<res<<endl;
      if(flag==0){
        if(res<=M)l=mid+1;else {r=mid-1;}
      }else {r=mid-1;}
    }
    count+=(r-max-1);
    cout<<count;}
}

//{{{
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VLL = vector<LL>;
using vi = vector<int>;
using pii = pair<int, int>;
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

string x;
LL m;

bool check(LL base)
{
    __int128 b = base;
    __int128 v = 1;
    __int128 res = 0;
    __int128 mm = __int128(m);

    int n = sz(x);
    for (int i = 0; i < n; i++)
    {
        __int128 dig = x[i] - '0';
        if (v > m) return false;

        res += dig * v;
        v *= b;
    }

    return res <= mm;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> x >> m)
    {
        int mx = -1;
        reverse(all(x));
        for (auto ch : x)
        {
            int d = ch - '0';
            mx = max(mx, d);
        }

        if (check(mx + 1) == false)
        {
            cout << 0 << endl;
            continue;
        }

        LL lo = mx + 1, hi = 3e18 + 100;
        while (lo + 1 < hi)
        {
            LL mid = lo + (hi - lo) / 2;
            bool ok = check(mid);
            if (ok) lo = mid;
            else
                hi = mid;
        }

        debug(lo, hi);

        if (lo >= 2e18)
        {
            cout << 1 << endl;
        }
        else
        {
            cout << lo - (mx + 1) + 1 << endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int N = 1e5 + 5;
#define int long long int

int32_t main() {
    IOS ;
    // int t ; cin >> t ; while(t--) {}
   int n ; cin >> n ; char c ;
   int dp[4][n+1] ;
   for(int i=0; i<4; i++) dp[i][0] = 0 ;
   for(int i=1; i<=n; i++) {
       cin >> c ;
       dp[0][i] = dp[0][i-1] ;
       dp[1][i] = dp[1][i-1] ;
       dp[2][i] = dp[2][i-1] ;
       dp[3][i] = dp[3][i-1] ;

       if(c == 'A') dp[0][i]++ ;
       else if(c == 'T') dp[1][i]++ ;
       else if(c == 'C') dp[2][i]++ ;
       else dp[3][i]++ ;
    }

    int cnt = 0 ;
    for(int i=2; i<=n; i++) {
        for(int j=1; j<i; j++) {
            int x = dp[0][i] - dp[0][j-1] ;
            int y = dp[1][i] - dp[1][j-1] ;
            int z = dp[2][i] - dp[2][j-1] ;
            int w = dp[3][i] - dp[3][j-1] ;

            if(x == y and z == w) cnt++ ;
        }
    }

    cout << cnt ;

    return 0 ;
}

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

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

  ll n;
  string ans;
  cin >> n;
  vl a(2*n);
  rep(i, 2*n) cin >> a[i];
  vpl vec(2*n);
  rep(i, 2*n) vec[i] = pl(a[i], i);
  sort(all(vec));
  vb plus(2*n, 1);
  rep(i, n) plus[vec[i].second] = 0;
  ll cnt = 0;
  rep(i, 2*n) {
    if(plus[i]) {
      if(cnt >= 0) ans += '(';
      else ans += ')';
      cnt++;
    }else {
      if(cnt <= 0) ans += '(';
      else ans += ')';
      cnt--;
    }
  }
  cout << ans << newl;
  return 0;
}


#include <bits/stdc++.h>
#include <climits>
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <map>

#define rep(i,s,n) for (ll i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;

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

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int d = min(a,b);
     a -= d;
     b -= d;
    if(c==0){
        if(a-1<0) cout << "Aoki" << endl;
        else cout << "Takahashi" << endl;
    }
    if(c==1){
        if(b-1<0) cout << "Takahashi" << endl;
        else cout << "Aoki" << endl;
    }
}


#pragma GCC optimize "-O3"

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

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

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

    int H, W, N, M;
    cin >> H >> W >> N >> M;
    vector<vector<bool>> fi(H, vector<bool>(W, true));
    queue<tuple<int, int, int>> q;
    vector<int> A(N), B(N);
    vector<int> C(M), D(M);
    rep(i,N){
        cin >> A[i] >> B[i];
        --A[i], --B[i];
    }
    rep(i,M){
        cin >> C[i] >> D[i];
        --C[i], --D[i];
        fi[C[i]][D[i]] = false;
    }
std::chrono::system_clock::time_point chrono_start =std::chrono::system_clock::now();

    vector<vector<vector<bool>>> used(4, vector<vector<bool>>(H, vector<bool>(W)));
    rep(i,N){
        used[0][A[i]][B[i]] = true;
        used[1][A[i]][B[i]] = true;
        used[2][A[i]][B[i]] = true;
        used[3][A[i]][B[i]] = true;
        rep(d,4){
            int nh = A[i] + dx[d], nw = B[i] + dy[d];
            if(nh < 0 or nh >= H or nw < 0 or nw >= W or !fi[nh][nw]) continue;
            q.emplace(d, nh, nw);
        }
    }
    int cnt = 0;
    while(!q.empty()){
      cnt++;
        auto [dir, h, w] = q.front(); q.pop();
        if(used[dir][h][w]) continue;
        used[dir][h][w] = true;
        int nh = h + dx[dir], nw = w + dy[dir];
        if(nh < 0 or nh >= H or nw < 0 or nw >= W or !fi[nh][nw]) continue;
        if(used[dir][nh][nw]) continue;
        q.emplace(dir, nh, nw);
    }
    int ans = 0;
    rep(i,H) rep(j,W){
        bool ok = false;
        rep(k,4) if(used[k][i][j]) ok = true;
        if(ok) ans++;
    }
    cout << ans << endl;
  auto chrono_end = std::chrono::system_clock::now();
  cerr << fixed << setprecision(5);
  cerr << std::chrono::duration_cast<std::chrono::milliseconds>(chrono_end - chrono_start).count() << " ms" << endl;

  return 0;

}

#include <bits/stdc++.h>

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const ll _INF = 1e18;
const int N = 1507;

int a[N][N];
bool vld[N][N];

int main(){
	setIO();
	int h, w, n, m;
	cin >> h >> w >> n >> m;
	for (int i = 0; i < n; i++){
		int r, c;
		cin >> r >> c;
		a[r][c] = 1;
	}
	for (int i = 0; i < m; i++){
		int r, c;
		cin >> r >> c;
		a[r][c] = -1;
	}
	// right
	for (int i = 1; i <= h; i++){
		bool ok = 0;
		for (int j = 1; j <= w; j++){
			if (a[i][j] == 1) ok = 1;
			else if (a[i][j] == -1) ok = 0;
			vld[i][j] |= ok;
		}
	}
	// left
	for (int i = 1; i <= h; i++){
		bool ok = 0;
		for (int j = w; j >= 1; j--){
			if (a[i][j] == 1) ok = 1;
			else if (a[i][j] == -1) ok = 0;
			vld[i][j] |= ok;
		}
	}
	// down
	for (int i = 1; i <= w; i++){
		bool ok = 0;
		for (int j = 1; j <= h; j++){
			if (a[j][i] == 1) ok = 1;
			else if (a[j][i] == -1) ok = 0;
			vld[j][i] |= ok;
		}
	}
	// up
	for (int i = 1; i <= w; i++){
		bool ok = 0;
		for (int j = h; j >= 1; j--){
			if (a[j][i] == 1) ok = 1;
			else if (a[j][i] == -1) ok = 0;
			vld[j][i] |= ok;
		}
	}
	int ans = 0;
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			if (vld[i][j]) ans++;
		}
	}
	cout << ans << endl;
}