#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
#define pow(n,m) powl(n,m)
#define sqrt(n) sqrtl(n)
const ll MAX = 5000000000000000000;
const ll MOD = 1000000007;
//998244353;
void randinit(){srand((unsigned)time(NULL));}
int main(){
    ll t,N;
    cin >> t >> N;
    ll c = 0;
    ll q;
    vector<ll> seen(300,0);
    for(ll i = 1;i <= 100;i++){
        seen[i * (100 + t) / 100] = 1;
    }
    for(ll i = 1;i < 100 + t;i++){
        if(seen[i] == 0){
            q = i;
            c++;
        }
    }
    ll p;
    ll d = 0;
    if(N % c == 0){
        cout << (100 + t) * (N / c - 1) + q << endl;
        return 0;
    }
    for(ll i = 1;i < 100 + t;i++){
        if(seen[i] == 0){
            d++;
            if(d == N % c) p = i;
        }
    }
    cout << p + (100 + t) * (N / c) << endl;
}

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

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

    for (int i = 0; i < k; i++)
    {
        if (n % 200 == 0)
            n /= 200;
        else
            n = n * 1000 + 200;
    }

    cout << n << endl;

    return 0;
}


#define MOD_TYPE 2

#pragma region Macros

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

#if 0
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
#endif
#if 1
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-7;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

struct io_init
{
  io_init()
  {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(30) << setiosflags(ios::fixed);
  };
} io_init;
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int h, w;
  cin >> h >> w;
  string s[10];
  rep(i, h) cin >> s[i];
  int cnt = 0;
  rep(i, h - 1) rep(j, w - 1)
  {
    int t = 0;
    t += s[i][j] == '#';
    t += s[i][j + 1] == '#';
    t += s[i + 1][j] == '#';
    t += s[i + 1][j + 1] == '#';
    if (t == 1 or t == 3)
      cnt++;
  }
  cout << cnt << "\n";
}

int main()
{
  solve();
}

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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i,h)rep(j,w) cin >> s[i][j];
    int ans =0;
    for(int i=1; i<h;i++)for(int j=1; j<w; j++){
        int cnt = 0;
        if(s[i][j]=='#') cnt++;
        if(s[i-1][j]=='#') cnt++;
        if(s[i][j-1]=='#') cnt++;
        if(s[i-1][j-1]=='#') cnt++;

        if(cnt%2==1)ans++;
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vector<vector<T>>
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

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

struct Solver{
    // 最大公約数
    int gcd(int a, int b){
    if (a%b == 0) return(b);
    else return(gcd(b, a%b));
    }

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

        map<int,int> mp;

        auto mpadd = [&](int ai, int xi){
            int p = mp[xi];
            mp[xi] = gcd(p,ai);
        };

        int amin=iINF;
        rep(i,N){
            int A; cin >> A;
            chmin(amin,A);
            for(int x=1; x*x <=A ; x++){
                if(A%x) continue;
                mpadd(A,x);
                mpadd(A,A/x);
            }
        }

        int ans = 0;
        for(auto mi:mp){
            if(mi.first <= amin && mi.first == mi.second ) ans++;
        }
        cout << ans << endl;

    }
};

int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define M  100000000000000000
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265
#define pb push_back
#define LLMX LONG_LONG_MAX
#define LLMN LONG_LONG_MIN
#define double long double
int n ;
vector < int > arr ;
signed main()
{
  fastio ;
  cin >> n ;
  set < int > st ;
  for(int x = 0 ; x <= n-1 ; x++)
  {
    int t;
    cin >> t ;
    arr.pb(t)  ;
  }
  sort(arr.begin() , arr.end())  ;
  int small = arr[0] ;
  map < int , int > dp ;
  int ans = 1 ;
  for(int x = 0 ; x <= n-1 ; x++)
  {
    for(int i = 1 ;  i <= sqrt(arr[x]) ; i++)
    {
      if( arr[x] % i !=0)
      continue ;
      if( i < small)
      {
        st.insert(i) ;
        if( dp[i] == 0)
        dp[i] = arr[x] ;
        else
        dp[i] = __gcd( dp[i] , arr[x]) ;
       // cout << i << " " << dp[i] << "\n" ;
      }
      if( arr[x]/i < small)
      {
        st.insert( arr[x]/i) ;
        if( dp[arr[x]/i] == 0)
        dp[arr[x]/i] = arr[x] ;
        else
        dp[arr[x]/i] = __gcd( dp[arr[x]/i] , arr[x]) ;
        //cout << i << " " << dp[i] << "\n" ;

      }
    }
  }
  for(auto it = st.begin() ; it != st.end() ; it++)
  {
    if( dp[*it] == *it)
    ans++ ;
  }
  cout << ans << "\n" ;

}


//yjy is sb
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register int
#define fr first
#define sd second
#define pa pair<int,int>
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define MEM(a) memset(a,0,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
inline int lowbit(int x){return x&(-x);}
int n,m,S;
const int mod=1e9+7;
inline int ksm(int a,int b)
{
	int ans=1;
	while(b){if(b&1)ans=1LL*ans*a%mod;b>>=1;a=1LL*a*a%mod;}
	return ans;
}
inline int C(int n,int m)
{
	int ans=1;
	for(re i=1,j=n;i<=m;i++,j--)ans=1LL*ans*j%mod*ksm(i,mod-2)%mod;
	return ans;
}
int main()
{
	//ios::sync_with_stdio(false);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),m=read();
	FOR(i,1,n){int A=read();S+=A;}
	cout<<C(m+n,n+S)<<'\n';
	return 0;
}

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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

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

    while (N % 2 == 0) {
        N /= 2;
    }

    const auto &pf = prime_factorize(N);
    long long res = 1;
    for (auto p : pf) res *= p.second + 1;
    cout << 2 * res << endl;
}


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

int main()
{
    int n; cin >> n;
    vector<P> xy(n);
    for (int i = 0; i < n; i++) cin >> xy[i].first >> xy[i].second;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            double kata = (double)abs(xy[j].second - xy[i].second) / abs(xy[j].first - xy[i].first);
            if (abs(kata) <= 1) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

// URL:

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vs = vector<string>;

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n)? "YES": "NO") << endl
#define Yes(n) cout << ((n)? "Yes": "No") << endl

#define rept(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fore(x, a) for(auto& (x) : (a))

#define reptll(i, a, b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define repll(i, n) for (ll i = 0; i < (ll)(n); i++)

#define ALL(a) (a).begin(), (a).end()

#define VECCIN(x) for(auto& youso_: (x)) cin >> youso_
#define VECCOUT(x) for(auto& youso_: (x)) cout << youso_ << " ";cout << endl

#define pb push_back
#define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)

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

const ll INFL = numeric_limits<ll>::max() / 4;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
  optimize_cin();

  ll N;
  cin >> N;

  vll A(N);
  vll C(N + 1);
  map<ll, ll> D;

  C[0] = 0;
  rep(i, N){
    cin >> A[i];
    C[i + 1] = C[i] + (i % 2 == 0? A[i] : - A[i] );
  }

  ll cnt = 0;
  rep(i, N + 1) {
    cnt += D[C[i]];
    D[C[i]]++;
  }

  cout << cnt << endl;

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define ub upper_bound
#define lb lower_bound
const ll m=1000000007;
#define inf 1000000000000000000
#define infn -1000000000000000000
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll power(ll x,ll n,ll m){if(n==0)return 1;else if(n%2==0)return (power(((x%m)*(x%m))%m,n/2,m))%m;else return ((x%m)*power(x,n-1,m)%m);}
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m==1)return 0;while(a>1){
ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}
// std::rotate(vec.begin(), vec.begin()+rotL, vec.end());//rotl=no of left ro
// std::rotate(vec.begin(), vec.begin()+vec.size()-rotR, vec.end());
//str.substr(1,3); // takes(0 based indexing all from [1,3])
//transform(str.begin(),str.end(),str.begin(),::tolower);//also "toupper"
// to_string(ll),stoll(string)
string binary(ll n){
if(n==0)
return "0";
string ans;
while(n>0){
if(n&1)
ans.pb('1');
else
ans.pb('0');
n=n>>1;
}
reverse(ans.begin(),ans.end());
return ans;
}
bool is_prime(ll n){
if(n==1)
return 0;
for(ll i=2; i*i<=n; i++){
if(n%i==0)
return 0;
}
return 1;
}
ll sum_digit(ll n){
ll ans=0;
while(n>0){
ans+=(n%10);
n/=10;
}
return ans;
}
ll binary_to_decimal(string str){
ll ans=0,d=1;
for(int i=str.length()-1; i>=0; i--){
ans+=d*(str[i]-48);
d*=2;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL),cout.tie(NULL);
ll t,n;
cin>>t;
while(t--){
cin>>n;
if(n&1)
cout<<"Odd\n";
else{
if((n/2)&1)
cout<<"Same\n";
else
cout<<"Even\n";
}
}
return 0;
}

/*Rabbi Zidni Ilma*/

#include<bits/stdc++.h>
using namespace std;
#define   ll        long long
#define   scl(n)    scanf("%lld",&n)
#define   scll(n,m) scanf("%lld %lld",&n,&m)
#define   pb        push_back
#define   mp        make_pair
#define   frs       first
#define   scn       second
#define   mod       1000000007
#define   read      freopen("input.txt","r",stdin)
#define   write     freopen("output.txt","w",stdout)

int main()
{
    ll tc,n,i,j,mn,mx;
    scl(tc);
    while(tc--)
    {
       scl(n);
       if(n%2!=0)
       printf("Odd\n");
       else
       {
       	    if((n/2)%2==0)
			printf("Even\n");
			else
			printf("Same\n");
	   }
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto& x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << '\n'; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

const int INF = 0x3F3F3F3F;
const int MAXN = (int) 1e6;
const int MOD = (int) 1e9+7;

//=========================

void run_test() {
	int n, m; read(n, m);
	vi a(n), b(m);
	rep(i, n) read(a[i]);
	rep(i, m) read(b[i]);
	if(n > m) swap(a, b), swap(n, m);

	int dp[n+1][m+1];
	ini(dp, 0x3f);
	dp[0][0] = 0;

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

	println(dp[n][m]);
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;
}

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

#define ff              first
#define ss              second
#define ll              long long int
#define fo(i,a,n)       for(ll i=a;i<n;i++)
#define rfo(i,a,n)      for(ll i=n-1;i>=a;i--)
#define all(a)          a.begin(),a.end()
#define pb              push_back
#define mp              make_pair
#define vll             vector<ll>
#define pll             pair<ll,ll>
#define mll             map<ll,ll>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define ri              reverse_iterator
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ite(a)          for(auto &x : a)
#define read(a)         ite(a) cin>>x;
#define fast            ios_base::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL);
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

//function
// ll expo(ll a, ll b, ll mod) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
// void google(int t) {cout << "Case #" << t << ": ";}
// vector<ll> sieve(int n) {int*arr = new int[n + 1](); vector<ll> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
// ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
// ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
// ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
// ll ceiling(ll n,ll m) {if(n%m==0)return n/m; else return n/m+1;}
// ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i;return res;}
// ll nCr(ll n, ll r){return fact(n) / (fact(r) * fact(n - r));}
// bool isprime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0){return 0;}}return 1;}

void r_p_p()
{
    #ifndef ONLINE_JUDGE
        freopen("input1f.txt", "r", stdin);
        freopen("output1f.txt", "w", stdout);
    #endif
}

void solve()
{
    ll TC=1;
    // cin>>TC;
    while(TC--)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        ll sqa = a*a;
        ll sqb = b*b;
        ll sqc = c*c;
        if(sqa+sqb<sqc)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    }
}

int32_t main()
{
    r_p_p();
    fast;
    solve();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define manytests int TT;cin >> TT; while (TT--)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORd(i,a,b) for (int i = (a); i >= (b); --i)

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

#define ll long long
#define ld long double
#define fi first
#define se second
#define rev reverse

#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define vd vector<double>
#define vs vector<string>
#define vld vector<ld>
#define vb vector<bool>
#define vvi vector<vi>
#define pii pair<int, int>
#define pl pair<ll, ll>
#define pld pair<ld, ld>
#define vpi vector<pii>
#define vpl vector<pl>
#define vpld vector<pld>

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a-d, b-c) << "\n";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll           long long int
#define vint         vector<int>
#define vll          vector<ll>
#define vstr         vector<string>
#define vvint        vector<vector<int> >
#define vvll         vector<vector<ll> >
#define vip          vector<pair<int,int> >
#define vlp          vector<pair<ll,ll> >
#define input(arr)   for(auto &x:arr) cin>>x;
#define all(x)       (x).begin(), (x).end()
#define rall(x)      (x).rbegin(), (x).rend()

const int N = 100005;
const ll mod = 1000000007;
const ll inf = 1e17;
const long double pi = (acos(-1));

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c,d; cin >> a >> b >> c >> d;
    if(c*d-b<=0){
        cout << "-1";
        return 0;
    }
    ll diff = c*d-b;
    ll ans = (a+diff-1) / diff;
    cout << ans;
}

#define debug(...)
#include <bits/stdc++.h>
using namespace std;
void solve();

#define ll long long

int main() {

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

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

	cerr << "time taken : " << (float)clock()/CLOCKS_PER_SEC << " secs" << "\n";
	return 0;
}

void solve() {

	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	if (b - c*d >= 0){
		cout << -1;
		return;
	}

	else cout << (a + (c*d - b - 1)) / (c*d - b);

}


#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, k, x, y, z;
  cin >> n >> k;
  n--;
  vvl dp(4, vl(3*n+1)), sum = dp;
  dp[0][0] = 1;
  sum[0] = vl(3*n+1, 1);
  rep(i, 3) {
    sum[i+1][0] = 1;
    rep(j, 3*n+1) {
      dp[i+1][j] = sum[i][j];
      if(j > n) dp[i+1][j] -= sum[i][j-n-1];
      if(j > 0) sum[i+1][j] = sum[i+1][j-1] + dp[i+1][j];
    }
  }
  ll d = -1, u = 3*n;
  while(u-d > 1) {
    ll m = (d+u)/2;
    if(k <= sum[3][m]) u = m;
    else d = m;
  }
  if(u > 0) k -= sum[3][u-1];
  ll D = -1, U = n;
  while(U-D > 1) {
    ll M = (D+U)/2;
    if(k <= sum[2][u] - (u-M-1 >= 0 ? sum[2][u-M-1] : 0LL)) U = M;
    else D = M;
  }
  k -= (sum[2][u] - (u-U >= 0 ? sum[2][u-U] : 0LL));
  x = U;
  if(u-U <= n) y = k-1;
  else y = n - dp[2][u-U] + k;
  z = u-x-y;
  printf("%lld %lld %lld\n", x+1, y+1, z+1);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define Rep(i,j,n) for (ll i=(ll)(j);i<=(ll)(n);++i)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int mod = 998244353;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

/*
ll ti=clock();
cout<<("Execution Time: %.4lf sec", 1.0 * (clock() - ti) / CLOCKS_PER_SEC)<<endl;
*/

int main(){
  ll n,m,q;
  cin>>n>>m>>q;
  vl w(n),v(n);
  vector<Pll> bag;
  rep(i,n){
      cin>>w[i]>>v[i];
      bag.emplace_back(v[i],w[i]);
  }
  sort(all(bag),greater<Pll>());
  vl x(m);
  rep(i,m){
      cin>>x[i];
  }
  rep(i,q){
      ll l,r;
      cin>>l>>r;
      vl tmp;
      rep(i,m){
          if(i==l-1){
              i=r;
              if(r==m){
                  break;
              }
          }
          tmp.eb(x[i]);
      }
      sort(all(tmp));
      vector<bool> empty(sz(tmp),true);
      ll sum=0;
      rep(i,n){
          rep(j,sz(tmp)){
              if(bag[i].S<=tmp[j]&&empty[j]){
                  sum+=bag[i].F;
                  empty[j]=false;
                  break;
              }
          }
      }
      print(sum);
  }
}


#include <bits/stdc++.h>

using namespace std;

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

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

#define popcount __builtin_popcount
#define next __next
#define prev __prev

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

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

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

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

template <class T>
using MaxHeap = priority_queue<T>;

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

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

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

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

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

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

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

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

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

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

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

template <class TupleTy, size_t... I>
void dump_tuple(ostream &os, const TupleTy t, std::index_sequence<I...>) {
  (..., (os << (I == 0 ? "" : ",") << std::get<I>(t)));
}

template <class... Args>
ostream &operator<<(ostream &os, const tuple<Args...> &t) {
  os << "(";
  dump_tuple(os, t, std::make_index_sequence<sizeof...(Args)>());
  return os << ")";
}

void dump_str_rec(ostringstream &) {}

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

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

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

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

// ------------------ ACL --------------------

// #include <atcoder/modint>
// constexpr int MOD = 998244353;
// constexpr int MOD = 1000000007;
// using mint = atcoder::static_modint<MOD>;
// ostream &operator<<(ostream &os, const mint &v) {
//   return os << v.val();
// }

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

#define endl "\n"
using ll = long long;
using pii = pair<int, int>;

const bool multitest = false;

void solve() {
  ll N;
  int K;
  cin >> N >> K;
  for (int i = 0; i < K; i++) {
    if (N % 200 == 0)
      N /= 200;
    else {
      N *= 1000;
      N += 200;
    }
  }
  cout << N << endl;
  return;
}

int main() {
  fastio();
  if (!multitest) {
    solve();
  } else {
    cerr << "[Warning] Multi testcase mode on" << endl;
    int t;
    cin >> t;
    while (t--) solve();
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
typedef pair<int,int> pp;
bool com(pp x,pp y){
    if(x.ff==y.ff) return x.ss<y.ss;
    return x.ff<y.ff;
}
ll power(ll x,ll y){
    ll prod=1;
    while(y){
        if(y&1) prod=(prod*x)%mod;
        x=(x*x)%mod;
        y/=2;
    }
    return prod;
}
const int N=2e3+7;
vector<int> vtx[N];
int k=0;
bool vis[N];
void dfs(int u){
    vis[u]=1;
    k++;
    for(auto v:vtx[u]) if(vis[v]==0) dfs(v);
}
void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        vtx[u].pb(v);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        k=0;
        dfs(i);
        ans+=k;
        for(int j=1;j<=n;j++) vis[j]=0;
    }
    cout<<ans;
}
int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	    solve();
	return 0;
}
/*
*/


#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

ll calc(ll no,ll n)
{
    if(no<=n)
    {
        return no-1;
    }
    else
    {
        ll start=no-n;
        ll end=no/2;

        if(no%2)
        {
            return (end-start+1)*2;
        }
        else
        {
            return (end-start)*2+1;
        }

    }

}

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        ll n,k;
        cin>>n>>k;

        ll ans=0;

        // cout<<calc(14,10)<<endl;

        for(ll i=2*n;i>=2;i--)
        {
            ll f=i;
            ll b=f-k;

            if(b>=2 && b<=2*n)
            {
                // cout<<f<<' '<<b<<endl;
                ll no1=calc(f,n);
                ll no2=calc(b,n);

                ans+=(no1*no2);
            }
        }

        cout<<ans;
    }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long D;
D n,k,ans;
D f(D x){
	return x<2||x>2*n?0:min(n-(x-n)+1,x-1);
}
int main(){
	cin>>n>>k;
	for(D i=2;i<=n*2;i++)ans+=f(i)*f(i-k);
	printf("%lld\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e18;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

int main(){
  double sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;

  double x1 = (sy*gx+gy*sx)/(gy+sy);
  double x2 = (-sy*gx+gy*sx)/(gy-sy);
  if((sx <= x1 && x1 <= gx) || (gx <= x1 && x1 <= sx)){
    cout <<std::fixed << std::setprecision(15) << x1 << endl;
  }else{
    cout << std::fixed << std::setprecision(15) <<x2 << endl;
  }

  return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  cout<<fixed<<setprecision(10)<<(double)((x1*y2)+(x2*y1))/(y1+y2);
}


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

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

ll dp[N][20], k, num[N];
char s[N];

ll dfs(int pos, bool limit, bool lead, int cnt, ll state){
	if(!pos)	return cnt == k;
	if(cnt > k)	return 0;
	if(!limit && !lead && ~dp[pos][cnt])	return dp[pos][cnt];
	ll ans = 0;
	int up = limit ? num[pos] : 15;
	for(int i = 0; i <= up; ++ i){
		if(lead && !i)	ans = (ans + dfs(pos - 1, limit && i == up, true, 0, 0)) % mod;
		else{
			if((state >> i) & 1)	ans = (ans + dfs(pos - 1, limit && i == up, false, cnt, state)) % mod;
			else	ans = (ans + dfs(pos - 1, limit && i == up, false, cnt + 1, state | (1 << i))) % mod;
		}
	}
	if(!limit && !lead)	dp[pos][cnt] = ans;
	return ans;
}

ll solve(){
	int len = strlen(s + 1);
	for(int i = 1, j = len; i < j; ++ i, -- j)	swap(s[i], s[j]);
	for(int i = 1; i <= len; ++ i){
		if(s[i] >= '0' && s[i] <= '9')	num[i] = s[i] - '0';
		else	num[i] = s[i] - 'A' + 10;
	}
	return dfs(len, true, true, 0, 0);
}

int main(){
	scanf("%s", s + 1);
	cin >> k;
	memset(dp, -1, sizeof dp);
	cout << solve();
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define INF LONG_MAX/3
#define DIV 1000000007
//#define DIV 998244353

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 dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

long long kaidan[10000000];

void kaical(long long n){
	kaidan[0] = 1;
	for(long long i = 1; i < n; i++){
		kaidan[i] = kaidan[i-1] * i;
		kaidan[i] %= DIV;
	}
}

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

//nCk
long long combination(long long n, long long k){
	if(n == 0 && k == 0)return 1;
	if(n < k || n < 0)return 0;
	long long n_kai = kaidan[n];
	long long k_kai = kaidan[k];
	long long nmk_kai = kaidan[n-k];

	long long ans = n_kai * modpow(k_kai, DIV - 2);
	ans %= DIV;
	ans *= modpow(nmk_kai, DIV-2);
	ans %= DIV;
	return ans;
}

ll tonum(char ch) {
	if(ch >= '0' && ch <= '9') return ch - '0';
	return ch - 'A' + 10;
}

string S;
ll K;

//すでに使った、これからつかう、残り長さ
ll cal(ll idx, ll num) {
	ll used = num;
	ll willuse = K - used;
	ll leng = S.size() - idx;

	//if(willuse == 0) return 1;
	if(used > K) return 0;
	if(willuse < 0) return 0;
	if(willuse > leng) return 0;

	ll ret = 0;
	rep(unused, willuse + 1) {
		if(unused%2 == 0) {
			ret += modpow(K - unused, leng) * combination(willuse, unused);
			ret %= DIV;
			ret += DIV;
			ret %= DIV;
		} else {
			ret -= modpow(K - unused, leng) * combination(willuse, unused);
			ret %= DIV;
			ret += DIV;
			ret %= DIV;
		}
	}

	//will useの選び方
	ret *= combination(16 - used, willuse);
	ret %= DIV;
	ret += DIV;
	ret %= DIV;

	//cout << "ret " << ret << endl;
	return ret;
}

ll memo[200005][20];

ll cal2(ll idx, ll num) {
	if(memo[idx][num] >= 0) return memo[idx][num];

	if(idx == S.size()) {
		if(num == K) return 1;
		return 0;
	}

	ll newnum = 16 - num;
	ll ret = 0;
	//同じのとる
	ret += num * cal2(idx+1, num);
	ret %= DIV;

	//新しいのとる
	if(newnum > 0) {
		ret += newnum * cal2(idx+1, num + 1);
		ret %= DIV;
	}
	memo[idx][num] = ret;
	return ret;
}

int main(){
	cin >> S >> K;

	kaical(20);
	rep(i,200005) rep(j, 20) memo[i][j] = -1;

	ll ans = 0;
	set<ll> used;
	rep(i, S.size()) {
		ll num = tonum(S[i]);

		//ここまでゼロでここから始まる
		if(i != 0) {
			ans += 15 * cal(i + 1, 1);
			ans %= DIV;
		}

		//ここで下回る
		rep(use, num) {
			//0から始めるのはなし
			if(use == 0 && i == 0) continue;
			if(used.count(use)) {
				ans += cal(i+1, used.size());
			} else {
				ans += cal(i+1, used.size()+1);
			}
			ans %= DIV;
			//cout << "curans = " << ans << endl;
		}
		//cout << endl;

		//ギリギリをいく
		used.insert(tonum(S[i]));
		//if(used.size() > K) {
		//	break;
		//}
	}

	if(used.size() == K) {
		ans++;
	}
	ans %= DIV;
	ans += DIV;
	ans %= DIV;

	cout << ans << endl;
}


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

int main() {
    string s[3];
    int n[3] = {};
    int f[26] = {};
    rep(i,3){
        cin >> s[i];
        n[i] = s[i].size();
        rep(j,n[i]) f[s[i][j]-'a'] = 1;
    }
    int cnt = 0;
    rep(i,26) cnt += f[i];
    if(cnt > 10){
        cout << "UNSOLVABLE" << endl;
        return 0;
    }

    int g[256] = {};
    int now = 0;
    rep(i,26){
        if(f[i]){
            g[i+'a'] = now;
            now++;
        }
    }

    const int N = 10;
    vector<int> v(N);
    iota(v.begin(), v.end(), 0);       // v に 0, 1, 2, ... N-1 を設定
    do {
        int ng = 0;
        ll x[3] = {};
        rep(i,3){
            rep(j,n[i]){
                if(j == 0 && v[g[s[i][j]]] == 0){
                    ng = 1;
                    break;
                }
                x[i] *= 10;
                x[i] += v[g[s[i][j]]];
            }
            if(ng) break;
        }
        if(ng == 0 && x[0]+x[1]==x[2]){
            rep(i,3){
                rep(j,n[i]) cout << v[g[s[i][j]]];
                cout << endl;
            }
            return 0;
        }
    } while( next_permutation(v.begin(), v.end()) );     // 次の順列を生成
    cout << "UNSOLVABLE" << endl;
    return 0;
}

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

template<typename T>
bool vector_match(T t, vector<T> vec) {
	for (T v : vec) {
		if (v == t)return true;
	}
	return false;
}

vector<char> getUsedChar(string str) {
	vector<char> used;
	for (char c : str) {
		if (!vector_match(c, used)) used.push_back(c);
	}
	return used;
}

bool isLess10char(vector<char> used) {
	if (used.size() <= 10) return true;
	else return false;
}

string replaceChar(string str, char change, char changed) {
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == change) str[i] = changed;
	}
	return str;
}

vector<int> solve(const int& depth, const vector<char>& usedc, const vector<int>& usedi, string s1, string s2, string s3) {
	if (depth != usedc.size()) {
		for (int i = '0' + 0; i < '0' + 10; i++) {
			if (i == '0' && (s1[0] == usedc[depth] || s2[0] == usedc[depth] || s3[0] == usedc[depth])) continue;
			vector<int> new_usedi = usedi;
			if (!vector_match(i, usedi)) {
				new_usedi.push_back(i);
				vector<int> ans = solve(depth + 1, usedc, new_usedi, replaceChar(s1, usedc[depth], i), replaceChar(s2, usedc[depth], i), replaceChar(s3, usedc[depth], i));
				if (ans.size() != 0) return ans;
			}
		}
	}
	else {
		if (stol(s1) + stol(s2) == stol(s3)) return usedi;
		else return vector<int>();
	}
	return vector<int>();
}

int main() {

	string S[3];

	cin >> S[0] >> S[1] >> S[2];

	vector<char> used = getUsedChar(S[0] + S[1] + S[2]);
	vector<int> ans;
	if (!isLess10char(used)) cout << "UNSOLVABLE" << endl;
	else {
		ans = solve(0, used, vector<int>(), S[0], S[1], S[2]);
		if (ans.size() == 0) cout << "UNSOLVABLE" << endl;
		else {
			for (int i = 0; i < ans.size(); i++) {
				S[0] = replaceChar(S[0], used[i], ans[i]);
				S[1] = replaceChar(S[1], used[i], ans[i]);
				S[2] = replaceChar(S[2], used[i], ans[i]);
			}
			cout << S[0] << endl << S[1] << endl << S[2] << endl;
		}
	}
	return 0;

}


    #include<bits/stdc++.h>
    #include<vector>
    #define ll long long
    #define ld long double
    #define F first
    #define S second
    #define MAXN   1000005
    #define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
    using namespace std;
    #define rep(i,n)  for(int i=0;i<n;++i)

    int main() {
        string s;
        cin>>s;
        int t=s.size();
        char a;
        bool b=true;
        for(int i=1;i<t;i++){
            a=s[0];
            if(a==s[i]){
                b=true;

            }else{
                b=false;
                break;
            }

        }
        if(b){
            cout<<"Won";

        }else{
            cout<<"Lost";
        }
        return 0;

     }

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll n;
  cin>>n;
  vector<vector<ll>> c(n, vector<ll>(n));
  vector<ll> a(n, 1LL<<60), b(n);
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      cin>>c[i][j];
      a[i] = min(a[i], c[i][j]);
    }
    b[i] = c[i][i] - a[i];
  }
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      if (c[i][j] != a[i]+b[j]) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  for (int i = 0; i < n; ++i)
  {
    cout << a[i] << " ";
  }
  cout << "\n";
  for (int i = 0; i < n; ++i)
  {
    cout << b[i] << " ";
  }
}


#include<bits/stdc++.h>

typedef long long int lli;
typedef long double lld;
typedef long long ll;
#define int long long
//Fast Input I/O
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL);
//Datatype
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vvlli vector<vector<long long int>>
#define ppi pair<int, int>
#define rppi pair<int, pair<int, int>>
#define lppi pair<pair<int, int>, int>
#define vppi vector<pair<int, int>>
#define sppi stack<pair<int int>>
#define qppi queue<pair<int, int>>
//function
#define f first
#define s second
#define pb(x) push_back(x)
#define mkp(i, j) make_pair(i, j)
#define lmkp(i,j,k) make_pair(make_pair(i,j),k)
#define rmkp(i,j,k) make_pair(i,make_pair(j,k))
//loop
#define loop(i,n) for (i = 0; i < n; ++i)
#define loops(i,k,n) for (i = k; i <= n; ++i)
#define looprev(i,k,n) for (i = k; i >= n; --i)
//Const
#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//Print
#define prd(n) printf("%d", n)
#define prl(n) printf("%lld", n)
#define prdn(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define prf(n) printf("%f", n)
//Scan
#define scd(n) scanf("%d", &n)
#define scd2(a, b) scanf("%d %d", &a, &b)
#define scd3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scl(n) scanf("%lld", &n)
#define scl2(a, b) scanf("%lld %lld", &a, &b)
#define scl3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define scf(n) scanf("%f", &n)
#define all(x) (x).begin(), (x).end()
#define mod 998244353
const long long N = 200005;

using namespace std;

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

int power(int a, int b, int p)
{
	if (a == 0)
		return 0;
	int res = 1;
	a %= p;
	while (b > 0)
	{
		if (b & 1)
			res = (res * a) % p;
		b >>= 1;
		a = (a * a) % p;
	}
	return res;
}

vector<int> primes[N];
vector<int> f(2 * N, 0);
void process() {
	for (int i = 2; i < N; i++) {
		if (primes[i].size()) continue;
		for (int j = i; j < N; j += i) {
			primes[j].pb(i);
		}
	}

	f[0] = f[1] = 1;
	for (int i = 2; i < 2 * N; i++) {
		f[i] = (i * f[i - 1]) % mod;
	}
}

int inv(int a) {
	return power(a, mod - 2, mod);
}

int choose(int n , int r) {
	return (((f[n] * inv(f[n - r])) % mod) * inv(f[r])) % mod;
}

void solve() {
	process();
	int n, m;
	cin >> n >> m;
	int ans = 0;
	for (int i = 1; i <= m; i++) {
		int res = 1;
		for (auto j : primes[i]) {
			int cnt = n;
			int c = i;
			while (c > 0 && c % j == 0) {
				c /= j;
				cnt++;
			}
			res *= choose(cnt - 1, n - 1);
			res %= mod;
		}
		ans += res;
		ans %= mod;
	}
	cout << ans;
}

int32_t main() {
	fio;
	online_judge();
	lli t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define deb(k) cerr << #k << ": " << k << "\n";
#define size(a) (int)a.size()
#define fastcin cin.tie(0)->sync_with_stdio(0);
#define st first
#define nd second
#define pb push_back
#define mk make_pair
#define int long long
typedef long double ldbl;
typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef vector<int> vint;
#define MAX 300100
#define MAXLG 20
const int inf = 0x3f3f3f3f;
const ll mod = 998244353;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int N = 300100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll fat[MAX+100];
ll ifat[MAX+100];

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

void init(){
	fat[0] = 1;
	fat[1] = 1;
	for(ll i=2;i<=MAX;i++){
	  fat[i] = (fat[i-1]*i)%mod;
	}
	ifat[MAX] = power(fat[MAX], mod-2, mod);
	for(ll i=MAX-1;i>=0;i--) ifat[i] = (ifat[i+1]*(i+1))%mod;
}

int choose(int x, int y){
	if(y < 0 || y > x || x < 0) return 0;
	return fat[x]*(ifat[y]*ifat[x-y]%mod)%mod;
}

int dp[N][20];
bool vis[N][20];
int n, m;

int sol(int x, int y){
	if(vis[x][y]) return dp[x][y];
	vis[x][y] = 1;
	int &c = dp[x][y];
	c = choose(n-1, y-1);
	for(int i=2;i<=m;i++){
		if(x*i > m) break;
		c = (c + sol(x*i, y+1))%mod;
	}
	return c;
}

void solve(){
	init();
	cin>>n>>m;
	int ans = 0;
	for(int i=1;i<=m;i++) ans = (ans + sol(i, 1))%mod;
	cout<<ans<<"\n";

	// Have you read the problem again?
	// Maybe you understood the wrong problem
}

int32_t main(){
	fastcin;
	int t_ = 1;
	//cin>>t_;
	while(t_--)
		solve();
	return 0;
}


#include <iostream>
#include <queue>
using namespace std;
using ll = long long;

int n;
priority_queue<ll> q;

void solve()
{
    q.push(0);
    ll res = 1, before = q.top(), now;
    q.pop();
    while (q.size() > 0)
    {
        now = q.top();
        q.pop();
        if (before > now)
        {
            res = res * (before - now + 1) % (1000000007);
            before = now;
        }
    }
    cout << res << '\n';
}

int main()
{
    ll qtemp;
    cin >> n;
    for (int i=0; i<n; i++)
    {
        cin >> qtemp;
        q.push(qtemp);
    }

    solve();

    return 0;
}

/*pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-7;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

// MOD確認

ll N;
ll A[10010];
ll B[10010];
ll C[10010];

int main(){
  cin >> N;
  rep(i,N) cin >> A[i];
  rep(i,N){
    FOR(j,i,N){
      if(A[i] <= A[j]) B[i]++;
      else break;
    }
    RFOR(j,0,i){
      if(A[i] <= A[j]) C[i]++;
      else break;
    }
  }
  ll ans = 0;
  rep(i,N){
    ans = max(ans,A[i] * (B[i] + C[i]));
  }
  cout << ans << endl;
}


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

typedef long long ll;

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

#define mp make_pair
#define fr first
#define sc second

void solve() {
    int N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    int cnt = count(S.begin(), S.end(), '0');
    if (cnt != count(T.begin(), T.end(), '0')) {
        cout << -1 << '\n';
        return;
    }
    vector<int> p1, p2;
    for (int i = 0; i < N; i++) {
        if (S[i] == '0') {
            p1.push_back(i);
        }
        if (T[i] == '0') {
            p2.push_back(i);
        }
    }
    int ans = 1e6;
    for (int ite = 0; ite < 2; ite++) {
        int reg = 0;
        for (int i = cnt - 1; i >= 0; i--) {
            reg += (p1[i] != p2[i]);
        }
        ans = min(ans, reg);
        reverse(p1.begin(), p1.end());
        reverse(p2.begin(), p2.end());
    }
    cout << ans << '\n';
}

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

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

    return 0;
}

#include <iostream>
#include <cstdio>
#define maxn 105
using namespace std;
int n, k;
int f[maxn][maxn];//2^i以j开始
char s[maxn];
int cf[maxn];
int match(int x, int y)
{
	if(x < y) swap(x, y);
	if(x == 2 && y == 0) return y;
	else return x;
}
int main()
{
	scanf("%d%d%s", &n, &k, s);
	cf[0] = 1;
	for (int i = 1; i < maxn; i++)
	{
		cf[i] = cf[i - 1] * 2 % n;
	}
	for (int i = 0; i < n; i++)
	{
		if(s[i] == 'R') f[0][i] = 0;
		if(s[i] == 'P') f[0][i] = 1;
		if(s[i] == 'S') f[0][i] = 2;
	}
	for (int i = 1; i <= k; i++)
	{
		for (int j = 0; j < n; j++)
		{
			int x = f[i - 1][j];
			int y = f[i - 1][(j + cf[i - 1]) % n];
			f[i][j] = match(x, y);
		}
	}
	if(f[k][0] == 0) printf("R");
	if(f[k][0] == 1) printf("P");
	if(f[k][0] == 2) printf("S");
	return 0;
}


#include<bits/stdc++.h>

#define rep(i, n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;

int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    string str[2];
    str[0] = s.substr(0, n);
    str[1] = s.substr(n, n);
    rep(i, q) {
        int t, a, b;
        cin >> t >> a >> b;
        a--;
        b--;
        if (t == 1) {
            swap(str[a / n][a % n], str[b / n][b % n]);
        } else {
            swap(str[0], str[1]);
        }
    }
    cout << str[0] + str[1] << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define readlist(a, n) for(int _i=0; _i<(n); _i++) {cin >> (a)[_i];}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n; string s; cin >> s;
	// cout << "s: " << s << endl;
	int q; cin >> q;
	// cout << "Q" << q << endl;
	int flip = 0;
	for(int i =0; i < q; i++) {
		int t, a, b;
		cin >> t >> a >> b;
		if (t==1)	{
			a--;
			b--;
			if (flip) {
				a = (a >= n)?(a-n):(a+n);
				b = (b >= n)?(b-n):(b+n);
			}
			swap(s[a], s[b]);
		}
		if(t==2) {
			flip = 1 - flip;
		}
	}
	if (flip) for(int i = 0; i <n; i++) swap(s[i], s[n+i]);
	cout << s << endl;
	return 0;
}


/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define urep(i,n)     for(int i=n-1;i>=0;i--)
#define urep1(i,n)    for(int i=n;i>=1;i--)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const int mod = 998244353;
const int inf = INT_MAX;
int main() {
	int a, b; cin >> a >> b;
	cout << 2*a+100-b;
	system("pause");
	return 0;
}


#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
using namespace std;

int main(){
    ll n;cin>>n;
    vector<ll> vec(n), vecmax, vecall, vecminus;
    ll kaka=0, ka=0, choudoii=0;
    for(int i=0;i<n;i++){cin>>vec.at(i);kaka=max(vec.at(i), kaka);vecmax.push_back(kaka);ka+=vec.at(i);vecall.push_back(ka);choudoii-=vec.at(i)*(i+1);vecminus.push_back(choudoii);}
    for(int i=0;i<n;i++){
        ll ans=(i+2)*vecall.at(i)+(i+1)*vecmax.at(i)+vecminus.at(i);
        cout<<ans<<endl;
    }
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
	long long l, res = 0, cval = 0, mod = 998244353;
	vector<long long> v;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> l;
		v.push_back(l);
	}

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

	for(auto l = v.begin(); l != v.end(); ++l) {
		res = (res + (cval + *l) * *l) % mod;
		cval = (2*cval + *l) % mod;
	}

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


#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <iomanip>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <cassert>
#include <stack>
#include <climits>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <memory>
#include <functional>
#include <cfloat>
#include <numeric>
#include <random>
#include <sstream>
#include <bitset>

struct Edge {
	int to, color, id;
};
int main() {
	int n, m; std::cin >> n >> m;
	std::vector<std::vector<Edge>> nodes(n);
	for (auto i = 0; i < m; ++i) {
		int u, v, c; std::cin >> u >> v >> c; --u; --v;
		nodes[u].push_back(Edge{ v, c, i });
		nodes[v].push_back(Edge{ u, c, i });
	}
	std::stack<std::pair<int, int>> stack;
	std::vector<int> parent(n, -1);
	std::vector<int> color_from_parent(n, -1);
	std::vector<bool> is_in_tree(m, false);
	parent[0] = 0;
	stack.emplace(0, 0);
	while (!stack.empty()) {
		const auto [prev, current] = stack.top(); stack.pop();
		for (const auto [to, color, id] : nodes[current]) {
			if (to == prev || parent[to] != -1) continue;
			is_in_tree[id] = true;
			parent[to] = current;
			color_from_parent[to] = (color == color_from_parent[current] ? -1 : color);
			stack.emplace(current, to);
		}
	}
	for (auto i = 0; i < n; ++i) {
		if (color_from_parent[i] == -1) {
			std::vector<int> colors;
			for (const auto [to, color, id] : nodes[i]) {
				if (is_in_tree[id]) {
					colors.push_back(color);
				}
			}
			std::sort(colors.begin(), colors.end());
			colors.erase(std::unique(colors.begin(), colors.end()), colors.end());
			int color = 1;
			for (const auto c : colors) {
				if (c == color) ++color;
				else break;
			}
			color_from_parent[i] = color;
		}
	}
	for (const auto c : color_from_parent) {
		std::cout << c << '\n';
	}
}

#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#endif
#if __has_include(<atcoder/all>)
#include <atcoder/all>
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, ll>;
#define rep(i, a, b) for(int i = (int)(a); i <= (int)(b); i++)
#define rrep(i, a, b) for(int i = (int)(a); i >= (int)(b); i--)
const int MOD = 1000000007;
const int MOD2 = 998244353;
const ll INF = 1e18;
const ld PI = acos(-1);

vector<int> G[200000];
int ans;

ll bfs(int v,int D,int p=-1){
    ll mn=INF;
    ll mx=-INF;
    for(auto to:G[v]){
        if(to==p) continue;
        ll z=bfs(to,D,v)-1;
        mn=min(mn,z);
        mx=max(mx,z);
    }
    if(mn+mx>=1){
        mn=mx;
    }
    else if(v==0){
        ans++;
    }
    if(G[v].size()==1&&p!=-1){
        mn=0;
    }
    else if(v!=0&&mn==-D){
        ans++;
        mn=D+1;
    }
    return mn;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    rep(i,0,N-2){
        int u,v;
        cin >> u >> v;
        u--;v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int ok=N,ng=0;
    while(abs(ok-ng)>1){
        ans=0;
        int mid=(ok+ng)/2;
        int L=bfs(0,mid);
        if(ans>K){
            ng=mid;
        }
        else{
            ok=mid;
        }
    }
    cout << ok << endl;
}


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

struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
int main()
{
	int n, m, t; cin >> n >> m >> t;
	int latest = 0;
	int a, b;
	int now_battery = n;
	while (m--)
	{
		cin >> a >> b;
		now_battery -= a - latest;
		if (now_battery <= 0)
			break ;
		now_battery = min(n, now_battery + b - a);
		latest = b;
	}
	now_battery -= t - latest;
	if (now_battery <= 0)
		cout << "No";
	else
		cout << "Yes";
	cout << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (ll i = s; i < e; i++)
#define rrep(i, s, e) for (ll i = s; i > e; i--)

int main() {
  ll t;
  cin >> t;
  rep(i, 0, t) {
    ll l, r;
    cin >> l >> r;
    if (2 * l > r) cout << 0 << endl;
    else cout << ((r - 2 * l + 2) * (r - 2 * l + 1)) / 2 << endl;
  }
}


////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
#define fi 2*acos(0.0)
#define ee 2.71828
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl printf("\n")
#define infinity 1e16
#define mod 1000000007
#define cn continue
#define csprint1 printf("Case %lld: ", cs++)
#define csprint2 printf("Case %lld:\n", cs++)
#define sf(a) scanf("%lld", &a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define all(v) v.begin(),v.end()
#define pfn(a) printf("%lld\n",a)
#define pfs(a) printf("%lld ",a)

// using namespace __gnu_pbds;
using namespace std;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<pl> vpi;
typedef vector<pl> vpl;
// typedef tree<pair<ll, int> , null_type, less<pair<ll, int> >, rb_tree_tag, tree_order_statistics_node_update> ost;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

///=====================================///
const long long maX =1e5+10;
int main(){FIO;
    ll n;
    ll ans=0;
    cin>>n;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j*i<=n;j++){
            ans+=n/(i*j);
        }
    }
    cout<<ans<<endl;
return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,m;
int a[N],b[N];
int main(){
	int i,j;
	cin>>n;
	for(i=1;i<=n;i++){
		for(j=i;j<=n;j+=i) b[j]++;
	}
	ll ans=0;
	for(i=1;i<=n;i++)
		ans+=b[i]*ll(n/i);
	cout<<ans;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1000005;
struct node{
	int c,id,val;
}s[N];
bool cmp1(node a,node b){return a.val<b.val;}
bool cmp2(node a,node b){return a.id<b.id;}
int st[N],top;
int main(){
	int n;
	scanf("%d",&n);n<<=1;
	for(int i=1;i<=n;i++) scanf("%d",&s[i].val),s[i].c=0,s[i].id=i;
	sort(s+1,s+n+1,cmp1);
	for(int i=n/2+1;i<=n;i++) s[i].c=1;
	sort(s+1,s+n+1,cmp2);
	int nl=-1;
	for(int i=1;i<=n;i++){
		if(nl==-1) nl=s[i].c,putchar('('),st[++top]=s[i].id;
		else if(s[i].c==nl) putchar('('),st[++top]=s[i].id;
		else putchar(')'),st[top--]=0;
		if(!top) nl=-1;
	}
	putchar('\n');
}

//#define NDEBUG

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

  using i32 = std::int32_t;
  using i64 = std::int64_t;
  using u32 = std::uint32_t;
  using u64 = std::uint64_t;
  using isize = std::ptrdiff_t;
  using usize = std::size_t;

  struct rep {
    struct itr {
      usize i;
      constexpr itr(const usize i) noexcept : i(i) {}
      void operator++() noexcept { ++i; }
      constexpr usize operator*() const noexcept { return i; }
      constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
    };
    const itr f, l;
    constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
    constexpr auto begin() const noexcept { return f; }
    constexpr auto end() const noexcept { return l; }
  };
  struct revrep {
    struct itr {
      usize i;
      constexpr itr(const usize i) noexcept : i(i) {}
      void operator++() noexcept { --i; }
      constexpr usize operator*() const noexcept { return i; }
      constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
    };
    const itr f, l;
    constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
    constexpr auto begin() const noexcept { return f; }
    constexpr auto end() const noexcept { return l; }
  };
  template <class T> auto md_vec(const usize n, const T& value) {
    return std::vector<T>(n, value);
  }
  template <class... Args> auto md_vec(const usize n, Args... args) {
    return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
  }
  template <class T> constexpr T difference(const T& a, const T& b) noexcept {
    return a < b ? b - a : a - b;
  }
  template <class T> void chmin(T& a, const T& b) noexcept {
    if (b < a)
      a = b;
  }
  template <class T> void chmax(T& a, const T& b) noexcept {
    if (a < b)
      a = b;
  }
  template <class F> class rec_lambda {
    F f;

  public:
    rec_lambda(F&& f) : f(std::move(f)) {}
    template <class... Args> auto operator()(Args&&... args) const {
      return f(*this, std::forward<Args>(args)...);
    }
  };
  template <class F> auto make_rec(F&& f) { return rec_lambda<F>(std::move(f)); }
  template <class T> T scan() {
    T ret;
    std::cin >> ret;
    return ret;
  }
  constexpr char eoln = '\n';
  template <class T> T ceildiv(const T& l, const T& r) {
    return l / r + (l % r != 0 ? 1 : 0);
  }

} // namespace n91

#include <numeric>

namespace n91 {

  void main_() {
    /*
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    //*/
    const usize n = scan<usize>();
    std::vector<i64> a(n), b(n);
    i64 base = 0;
    std::vector<i64> c(n);
    for (auto& e : a) {
      std::cin >> e;
    }
    for (auto& e : b) {
      std::cin >> e;
    }
    for (const usize i : rep(0, n)) {
      i64 x = a[i], y = b[i];
      if (i % 2 == 1) {
        std::swap(x, y);
      }
      base += x;
      c[i] = y - x;
    }
    std::nth_element(c.begin(), c.begin() + n / 2, c.end(), std::greater<i64>());
    base += std::accumulate(c.begin(), c.begin() + n / 2, i64(0));
    std::cout << base << eoln;
  }

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


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

const int INF = 1001001001;

int main()
{
	int ans = INF;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int a, p, x;
		cin >> a >> p >> x;
		if(a < x) ans = min(ans, p);
	}
	if(ans == INF) ans = -1;
	cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define mem(a) memset(a, 0, sizeof(a))
#define dbg(x) cout << #x << " = " << x << endl
#define fi(i, l, r) for (int i = l; i < r; i++)
#define cd(a) scanf("%d", &a)
typedef long long ll;

int main()
{
    int N;
    cin >> N;
    bool ifCan = false;
    int m = 1e9 + 1;
    while (N--)
    {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        if (a < c)
        {
            ifCan = true;
            m = min(m, b);
        }
    }
    if (ifCan)
        printf("%d\n", m);
    else
        printf("-1\n");
    return 0;
}


#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	int x=0;
	bool flag=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
			flag=0;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return (flag?x:~(x-1));
}
struct node{
	int to,nxt,v1,v2;
} edge[200001];
struct que{
	int to,val;
	bool operator<(const que& x)const
	{
		return val>x.val;
	}
};
int n,m,cnt,head[100001],dis[100001],vis[100001];
void add(int a,int b,int c,int d)
{
	edge[++cnt].to=b;
	edge[cnt].v1=c;
	edge[cnt].v2=d;
	edge[cnt].nxt=head[a];
	head[a]=cnt;
}
priority_queue<que> q;
void dij()
{
	for(int i=2;i<=n;i++)
		dis[i]=2e18;
	q.push({1,0});
	while(!q.empty())
	{
		int t=q.top().to;
		q.pop();
		if(vis[t])
			continue;
		vis[t]=1;
		for(int i=head[t];i;i=edge[i].nxt)
		{
			int adj=edge[i].to,minn;
			int qr=sqrt(edge[i].v2);
			if(dis[t]>=qr)
				minn=dis[t]+edge[i].v1+edge[i].v2/(dis[t]+1);
			else
				minn=qr+edge[i].v1+edge[i].v2/(qr+1);
			/*
			for(int l=dis[t];l<=sqrt(edge[i].v2)+5;l++)
				minn=min(minn,l+edge[i].v1+edge[i].v2/(l+1));
			for(int l=max(edge[i].v2/(dis[t]+1),sqrt(edge[i].v2)+1);l>=0;l--)
				minn=min(minn,l+edge[i].v1+edge[i].v2/(l+1));
			*/
			if(minn<dis[adj])
			{
				dis[adj]=minn;
				q.push({adj,minn});
			}
		}
	}
}
signed main()
{
	n=read();
	m=read();
	while(m--)
	{
		int a=read(),b=read(),c=read(),d=read();
		add(a,b,c,d);
		add(b,a,c,d);
	}
	dij();
	if(dis[n]==2e18)
		puts("-1");
	else
		cout<<dis[n];
	return 0;
}

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

int n, m;
int cnt[2];

int main() {
	scanf("%d %d", &n, &m);
	while (n--) {
		char s[30], sum = 0; scanf("%s", s);
		for (int j = 0; j < m; ++j)
			sum ^= s[j] ^ '0';
		++cnt[sum];
	}
	printf("%lld\n", 1ll * cnt[0] * cnt[1]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
	int n, m = 0; cin >> n;
	for(; m < n; m=m*2+1);
	rep(i,n){
		int t = i*2, u = t+1;
		while(t >= n) t -= 1 << (31 - __builtin_clz(t));
		while(u >= n) u -= 1 << (31 - __builtin_clz(u));
		cout << t+1 << " " << u+1 << "\n";
	}
}

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    auto f = [&n](int x) {
      return (x - 1) % n + 1;
    };
    cout << f(i * 2) << " " << f(i * 2 + 1) << endl;
  }
}


 #include <bits/stdc++.h>

 #define FIXED_FLOAT(x)  std::fixed <<std::setprecision(20) << (x)
 #define all(v) (v).begin(), (v).end()
 using namespace  std;
 #define forn(i,n) for (int i = 0; i < (n); ++i)
 #define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
 using ll = long long;
 int mod = (ll)1e9 + 7;
 #define PI acos(-1)
 typedef pair<int, int> pairs;

 const int INF = 1e9 + 1;
 const int N = 2e5 + 100;
 const double eps = 1e-7;

 template <class T> using V = vector<T>;  // from yosupo
 template <class T> using VV = V<V<T>>;  // from yosupo

 template <typename XPAX>
 void ckma(XPAX &x, XPAX y) {
     x = (x < y ? y : x);
 }
 template <typename XPAX>
 void ckmi(XPAX &x, XPAX y) {
     x = (x > y ? y : x);
 }
 set<int> s;
 void __print(int x) {cerr << x;}
 void __print(long x) {cerr << x;}
 void __print(long long x) {cerr << x;}
 void __print(unsigned x) {cerr << x;}
 void __print(unsigned long x) {cerr << x;}
 void __print(unsigned long long x) {cerr << x;}
 void __print(float x) {cerr << x;}
 void __print(double x) {cerr << x;}
 void __print(long double x) {cerr << x;}
 void __print(char x) {cerr << '\'' << x << '\'';}
 void __print(const char *x) {cerr << '\"' << x << '\"';}
 void __print(const string &x) {cerr << '\"' << x << '\"';}
 void __print(bool x) {cerr << (x ? "true" : "false");}

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

 	int n;
 	cin >> n;
 	int iter = 0;
 	VV<int> g(n);
 	forn(i, n - 1) {
 		int x;
 		cin >> x;
 		--x;
 		g[x].push_back(i + 1);
 	}

 	V<int> tin(n), tout(n), ord(n);

 	int T = 0;
 	V<int> dep(n);
 	auto dfs = [&](auto &&self, int v, int de) -> void {
 		ord[T] = v;
 		tin[v] = T++;
 		dep[v] = de;
 		for(auto c : g[v]) {
 			self(self, c, de + 1);
 		}
 		tout[v] = T;
 	};
 	dfs(dfs, 0, 0);
 	VV<int> ps(n);
 	forn(i, n) {
 		int v = ord[i];
 		ps[dep[v]].push_back(i);
 	}

 	int q;
 	cin >> q;
 	while(q--) {
 		int u, d;
 		cin >> u >> d;
 		--u;
 		int L = tin[u];
 		int R = tout[u];
 		auto it1 = lower_bound(all(ps[d]), L);
 		auto it2 = lower_bound(all(ps[d]), R);
 		cout << (it2 - it1) << '\n';
 	}

 }
 void test_case() {
     int t;
     cin >> t;
     forn(p, t) {

         //cout << "Case #" << p + 1 << ": ";
         solve();
     }
 }
 int main() {

     ios::sync_with_stdio(false);
     cin.tie(nullptr);
     cout.tie(nullptr);

     solve();

 }

#include <bits/stdc++.h>
#define int long long int
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    map<string  , pair<int , int> > mp;
    int n;
    cin>>n;
    for(int x = 0;x<n;x++){
        string s;
        cin>>s;
        if(s[0] == '!' ){
            string a = "";
            for(int i = 1;i<s.length();i++ ){
                a.push_back(s[i] );
            }
            mp[a].second++;
        }
        else{
            mp[s].first++;
        }
    }
    bool sas = true;string ans;
    map<string  , pair<int , int> > :: iterator it;
    for(it = mp.begin() ; it!= mp.end();it++){
        if((it->second.first)&& (it->second.second) ){
            ans = it->first;sas = false; ;break;
        }
    }
    if(sas ){
        cout<<"satisfiable";
    }
    else{
        cout<<ans;
    }
}


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

  class graph{
  public:
    map<int,vector<int>> map1;
    void edges(int a,int b){
        map1[a].push_back(b);
    }
    void tour_helper(int n,map<int,bool> &visited,int &count){
        visited[n]=true;
        for(auto it:map1[n]){
            if(visited[it]==false){
                count++;
                tour_helper(it,visited,count);
            }
        }
    }
    void tour(int n){
        map<int,bool> visited;
        for(auto it:map1)
            visited[it.first]=false;

        int ans=0;
        for(auto it:map1){
            tour_helper(it.first,visited,ans);
            for(auto it:map1)
                visited[it.first]=false;

        }

        cout<<ans+n<<endl;
     }
  };
int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    graph g;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        g.edges(a,b);
    }
    g.tour(n);

}

#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

long long N, K;
long long A[1 << 18], B[1 << 18];

bool used[1 << 18];
bool forced[1 << 18];
long long dp[1 << 18];
vector<int> X[1 << 18];

void dfs(int pos, int border) {
	used[pos] = true;

	vector<long long> vec;
	for (int i : X[pos]) {
		if (used[i] == true) continue;
		dfs(i, border);
		vec.push_back(dp[i] + 1);
	}
	sort(vec.begin(), vec.end());

	if (vec.size() == 0) {
		dp[pos] = 0;
		return;
	}

	if (vec[0] + vec[vec.size() - 1] <= -1) {
		dp[pos] = vec[0];
		return;
	}
	else if (vec[vec.size() - 1] == border) {
		forced[pos] = true;
		dp[pos] = -(border + 1);
		return;
	}
	else {
		dp[pos] = vec[vec.size() - 1];
		return;
	}
}

bool solve(int border) {
	for (int i = 1; i <= N; i++) dp[i] = 0;
	for (int i = 1; i <= N; i++) used[i] = false;
	for (int i = 1; i <= N; i++) forced[i] = false;
	dfs(1, border);

	int cnts = 0;
	if (dp[1] >= 0 || forced[1] == true) cnts++;
	for (int i = 2; i <= N; i++) {
		if (forced[i] == true) cnts++;
	}
	if (cnts > K) return false;
	return true;
}

int main() {
	cin >> N >> K;
	for (int i = 1; i <= N - 1; i++) {
		cin >> A[i] >> B[i];
		X[A[i]].push_back(B[i]);
		X[B[i]].push_back(A[i]);
	}

	long long cl = 1, cr = N + 1, cm, minx = (1 << 30);
	for (int i = 0; i < 22; i++) {
		cm = (cl + cr) / 2;
		bool I = solve(cm);
		if (I == true) { cr = cm; minx = min(minx, cm); }
		else { cl = cm; }
	}
	cout << minx << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define reps(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repit(i,C) for (auto i = (C).begin(); i != (C).end(); i++)
#define pr(a) cout << a
#define prl(a) cout << (a) << endl
#define prld(a) cout << setprecision(15)<< (a) << endl
#define allrange(a) a.begin(),a.end()

bool solve_translated(vector<pair<int,int>> &S,vector<pair<int,int>> &T){
    int N = S.size();
    int dx = S[0].first-T[0].first;
    int dy = S[0].second-T[0].second;
    bool flg = true;
    reps(i,1,N){
        if(!((S[i].first==T[i].first+dx) && (S[i].second==T[i].second+dy))){flg = false; break;}
    }
    return flg;
}
/*ピタゴラ三角形
    5	12	13
    8	15	17
    3	4	5
*/
vector<pair<int,int>> Pitagora_rot(vector<pair<int,int>> &S,int a, int b , int c){
    int N = S.size();
    vector<pair<int,int>> PS(N);
    auto pt0 = S[0];
    PS[0] = pt0;
    bool flg = true;
    reps(i,1,N){
        int dx = S[i].first - pt0.first;
        int dy = S[i].second - pt0.second;
        if(((dx*b+dy*a)%c)!=0 || ((dx*a-dy*b)%c)!=0) {flg = false; break;}
        PS[i] = make_pair((dx*a-dy*b)/c+pt0.first, (dx*b+dy*a)/c+pt0.second);
    }
    if(flg) return PS;
    else return vector<pair<int,int>>();
}

int main(){
    std::cin.tie(0); // cinとcoutの同期を解除
    std::ios::sync_with_stdio(false);
    int N;cin >> N;
    bool flg=true;

    vector<pair<int,int>> S(N),T(N);
    rep(i,N)
    {
        int x,y;
        cin >> x >> y;
        S[i].first = x;S[i].second = y;
    }

    rep(i,N)
    {
        int x,y;
        cin >> x >> y;
        T[i].first = x;
        T[i].second = y;
    }
    sort(allrange(T));

/*ピタゴラ三角形
    5	12	13
    8	15	17
    3	4	5
*/
    vector<vector<int>> tri(0);
    tri.push_back(vector<int>({5, 12, 13}));
 //   tri.push_back(vector<int>({12, 5, 13}));
 //   tri.push_back(vector<int>({8,15,17}));
 //   tri.push_back(vector<int>({15,8,17}));
    tri.push_back(vector<int>({3,4,5}));
    tri.push_back(vector<int>({4,3,5}));
    tri.push_back(vector<int>({0,1,1}));
    tri.push_back(vector<int>({-1,0,1}));
    tri.push_back(vector<int>({0,-1,1}));
    tri.push_back(vector<int>({1,0,1}));
   //tri.push_back(vector<int>({-5, 12, 13}));
  //  tri.push_back(vector<int>({-12, 5, 13}));
  //  tri.push_back(vector<int>({-8,15,17}));
  //  tri.push_back(vector<int>({-15,8,17}));
    tri.push_back(vector<int>({-3,4,5}));
    tri.push_back(vector<int>({-4,3,5}));
 //   tri.push_back(vector<int>({-5, -12, 13}));
 //   tri.push_back(vector<int>({-12, -5, 13}));
 //   tri.push_back(vector<int>({-8,-15,17}));
 //   tri.push_back(vector<int>({-15,-8,17}));
    tri.push_back(vector<int>({-3,-4,5}));
    tri.push_back(vector<int>({-4,-3,5}));
 //   tri.push_back(vector<int>({5, -12, 13}));
 //   tri.push_back(vector<int>({12, -5, 13}));
 //   tri.push_back(vector<int>({8,-15,17}));
    tri.push_back(vector<int>({15,-8,17}));
    tri.push_back(vector<int>({3,-4,5}));
    tri.push_back(vector<int>({4,-3,5}));

    flg=false;

    if(S.size()==2 && T.size()==2){
        auto sx = S[0].first-S[1].first;
        auto sy = S[0].second-S[1].second;
        auto tx = T[0].first-T[1].first;
        auto ty = T[0].second-T[1].second;
        flg= (sx*sx+sy*sy==tx*tx+ty*ty);
    } else {
        rep(j,tri.size()){
            auto S2 = Pitagora_rot(S,tri[j][0],tri[j][1],tri[j][2]);
            if(S2.empty()) continue;
            sort(allrange(S2));
            flg = solve_translated(S2,T);
            if(flg) break;
        }
    }
    if(flg) prl("Yes"); else prl("No");
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()
struct point{
    ll x,y,idx;
};
bool srt1(point & p1, point & p2){
    return p1.x<p2.x;
}
bool srt2(point & p1, point & p2){
    return p1.y<p2.y;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<point> arr(n);
    REP(i,n){
        cin>>arr[i].x>>arr[i].y;
        arr[i].idx=i;
    }
    sort(all(arr),srt1);
    map<pair<ll,ll>,ll> m;
    m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]=max(arr[n-1].x-arr[0].x,m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]);

    m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]=max(arr[n-1].x-arr[1].x,m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]);

    m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]=max(arr[n-2].x-arr[0].x,m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]);

    sort(all(arr),srt2);

    m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]=max(arr[n-1].y-arr[0].y,m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]);

    m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]=max(arr[n-1].y-arr[1].y,m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]);

     m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]=max(arr[n-2].y-arr[0].y,m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]);
     vector<ll> aux;
     for(auto & [x,y]:m){
        aux.pb(y);
     }
     sort(all(aux));
     reverse(all(aux));
     cout<<aux[1]<<endl;

}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

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

const ll maxn = 4e5 + 5, inf = 1e18, mod = 998244353;
ll n, q, ps[maxn], h[maxn], a[maxn], b[maxn];
vector <ll> adj[maxn];
void dfs(ll u, ll par){
	ps[u] += ps[par];
	for(ll j : adj[u]){
		if(j == par)continue;
		h[j] = h[u] + 1;
		dfs(j, u);
	}
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for(ll i = 1; i < n; i ++){
		cin >> a[i] >> b[i];
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	dfs(1, 0);
	cin >> q;
	while(q --){
		ll t, e, x;
		cin >> t >> e >> x;
		if(t == 1){
			if(h[a[e]] > h[b[e]])ps[a[e]] += x;
			else{
				ps[b[e]] -= x;
				ps[1] += x;
			}
		}
		else{
			if(h[b[e]] > h[a[e]])ps[b[e]] += x;
			else{
				ps[1] += x;
				ps[a[e]] -= x;
			}
		}
	}
	dfs(1, 0);
	for(ll i = 1; i <= n; i ++)cout << ps[i] << "\n";
}

#include <bits/stdc++.h>

using namespace std;
#define ll long long int
#define pb push_back
#define endl "\n"

void dfs(vector<vector<ll>> &adj , vector<bool> &vis ,ll &edges , ll &root , ll start , ll &nov){
	vis[start]=true;
	nov++;
	if(start==root){
		edges += adj[start].size();
	}
	else{
		edges += adj[start].size() - 1;
	}
	for(auto x:adj[start]){

		if(vis[x]==false){
			dfs(adj , vis , edges ,root ,  x , nov);
		}
	}
}

int main() {

    //forItachiOfTheLeaf
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin>>n;
    vector<vector<ll>> adj(400004);
    ll i,x,y;
    for(i=0;i<n;i++){
    	cin>>x>>y;
    	adj[x].pb(y);
    	adj[y].pb(x);
    }
    vector<bool> vis(400004 , false);

    ll ans = 0;
    for(i=1;i<=400000;i++){
    	if(vis[i]==false&&adj[i].size()>=1){
    		ll edges = 0 , root = i,nov = 0;
    		dfs(adj , vis , edges , i , i , nov);
    		if(nov==edges+1){
    			ans += nov-1;
    		}
    		else{
    			ans += nov;
    		}

    	}
    }
    cout<<ans<<endl;

}


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

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

    vector<int> F;
    for (int f=2; f<=72; f++)
    {
        bool ok = true;
        for (int i=2; i<f; i++)
            if (f%i==0)
                ok = false;
        if (ok)
            F.push_back(f);
    }
    int n = (int)F.size();

    vector<long long> T(1<<n);
    T[0] = 1;

    for (long long c=A; c<=B; c++)
    {
        vector<long long> P = T;
        int b = 0;
        for (int i=0; i<n; i++)
            if (c%F[i]==0)
                b |= 1<<i;

        for (int i=0; i<1<<n; i++)
            if ((b&i)==0)
                T[b|i] += P[i];
    }
    long long ans = 0;
    for (long long t: T)
        ans += t;
    cout<<ans<<endl;
}

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

#define ll long long

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

const int M = 19;
const int BIT = (1<<M);

int cc[BIT],op[BIT],cc2[BIT],dp[BIT];

void solve2() {
  ll x,y;
  cin>>x>>y;
  ll ret = 0;
  if(y-x+1<=10) {
    ll v[10];
    for(ll i=x;i<=y;++i) {
      v[i-x] = i;
    }
    int len = y-x+1,B = (1<<len);
    for(int bit=0;bit<B;++bit) {
      bool isGood = true;
      for(int i=0;i<len && isGood;++i) {
        if(bit&(1<<i)) {
          for(int j=0;j<len;++j) {
            if( (bit&(1<<j)) && j!=i) {
              if(gcd(v[j],v[i])!=1) {
                isGood = false;
                break;
              }
            }
          }
        }
      }
      ret += isGood;
    }
  } else {
    ll even[50];
    int e_pos = 0;
    even[e_pos++] = 1;
    vector<ll> v[2];
    for(ll i=x;i<=y;++i) {
      if(i%2==0) {
        even[e_pos++] = i;
      } else {
        v[v[0].size()<M ? 0 : 1].push_back(i);
      }
    }
    vector<pair<int,int> > g;

    for(int i=0;i<v[0].size();++i) {
      int bit = 0;
      for(int j=0;j<v[0].size();++j) {
        if(i!=j && gcd(v[0][j],v[0][i])!=1) {
          bit |= (1<<j);
        }
      }
      int bit2 = 0;
      for(int j=0;j<v[1].size();++j) {
        if(gcd(v[1][j],v[0][i])!=1) {
          bit2 |= (1<<j);
        }
      }
      g.push_back({bit,bit2});
    }
    int B = (1<<v[0].size());
    for(int bit=0;bit<B;++bit) {
      bool isGood = true;
      for(int i=0;i<v[0].size();++i) {
        if(bit&(1<<i)) {
          isGood &= (g[i].first&bit) ==0;
          op[bit] |= g[i].second;
        }
      }
      cc[bit] = isGood ? 1 : 0;
    }
    g.clear();
    for(int i=0;i<v[1].size();++i) {
      int bit = 0;
      for(int j=0;j<v[1].size();++j) {
        if(i!=j && gcd(v[1][j],v[1][i])!=1) {
          bit |= (1<<j);
        }
      }
      g.push_back({bit,0});
    }

    int B2 = (1<<v[1].size());
    for(int bit=0;bit<B2;++bit) {
      bool isGood = true;
      for(int i=0;i<v[1].size();++i) {
        if(bit&(1<<i)) {
          isGood &= (g[i].first&bit) ==0;
        }
      }
      cc2[bit] = isGood ? 1 : 0;
    }

    for(int iter=0;iter<e_pos;++iter) {
      ll cur_value = even[iter];
      memset(dp,0,sizeof(dp));
      int bit1 = 0,bit2=0;
      for(int i=0;i<v[0].size();++i) {
        if(gcd(cur_value,v[0][i])!=1) bit1 |= (1<<i);
      }
      for(int i=0;i<v[1].size();++i) {
        if(gcd(cur_value,v[1][i])!=1) bit2 |= (1<<i);
      }
      for(int bit=0;bit<B2;++bit) {
        dp[bit] = cc2[bit] >0 && ( (bit&bit2)==0);
      }
      for(int b=0;b<v[1].size();++b) {
        for(int bit=0;bit<B2;++bit) {
          if(bit&(1<<b)) {
            dp[bit] += dp[bit^(1<<b)];
          }
        }
      }
      int x = B2-1;
      for(int bit=0;bit<B;++bit) {
        if(bit&bit1) continue;
        if(cc[bit]==0) continue;
        ret += dp[x^op[bit]];
      }
    }
  }
  printf("%lld\n", ret);
}

void solve() {
    solve2();
}

inline bool exists_test0 (const std::string& name);
inline bool exists_test1 (const std::string& name);
int main() {
#ifdef LOCAL
  string file_name = "input.txt";
  assert(exists_test0(file_name));
  assert(exists_test1(file_name));
  freopen("input.txt","r",stdin);
#endif
  solve();
  return 0;
}

/*
0. Enough array size? Enough array size? Integer overflow?

1. Think TWICE, Code ONCE!
Are there any counterexamples to your algo?

2. Be careful about the BOUNDARIES!
N=1? P=1? Something about 0?

3. Do not make STUPID MISTAKES!
Time complexity? Memory usage? Precision error?

4. Be careful to use wrong variable.
*/
inline bool exists_test0 (const std::string& name) {
    ifstream f(name.c_str());
    return f.good();
}

inline bool exists_test1 (const std::string& name) {
    if (FILE *file = fopen(name.c_str(), "r")) {
        fclose(file);
        return true;
    } else {
        return false;
    }
}


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

#define fio 					ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) 				cout << (#x) << " is " << (x) << endl
#define f(t) 					for(ll i=0;i<t;i++)
#define ll 						long long int
#define ld 						long double
#define umpl 					unordered_map<ll,ll>
#define vl 						vector<ll>
#define vld 					vector<ld>
#define vvl 					vector<vl>
#define pb 						push_back
#define pll 					pair<ll,ll>
#define inf 					1e18
#define pcout(x,p) 				cout<<fixed<<setprecision(p)<<x
#define all(a) 					a.begin(),a.end()
#define endl 					"\n"

const ll mod = 1e9 + 7;
inline ll mul(ll a, ll b) { ll c = (a * 1ll * b) % mod; if (c < 0) c += mod; return c; }
inline ll sub(ll a, ll b) { ll c = a - b; if (c < 0) c += mod; return c; }
inline ll add(ll a, ll b) { ll c = a + b; if (c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b) {return a > b ? a : b;}
inline ll min(ll a, ll b) {return a < b ? a : b;}
inline ll ceil(ll a, ll b) {return (a % b == 0) ? (a / b) : (a / b + 1);}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fio;
	ll a, b, c; cin >> a >> b >> c;
	if (c == 0) {
		if (a > b) {
			cout << "Takahashi" << endl;
		} else {
			cout << "Aoki" << endl;
		}
	} else {
		if (a < b) {
			cout << "Aoki" << endl;
		} else {
			cout << "Takahashi" << endl;
		}
	}
}

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#define Debug(in) cout<<#in<<"="<<(in)<<endl
#define mm(a,x) memset(a,x,sizeof(a))
#define mkp(a,b) make_pair(a,b)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
int main(void)
{
    sync;
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=b-c) cout<<"Aoki"<<endl;
    else cout<<"Takahashi"<<endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
const double pi = acos(-1);
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;

const int maxn = 1e3 + 10;
int a[100][100];
int n, t;
const ll m = 998244353;
int fa[100];

int find(int x)
{
    while (x != fa[x]) x = fa[x] = fa[fa[x]];
    return x;
}

int main()
{
    scanf("%d%d", &n, &t);
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j)
            scanf("%d", &a[i][j]);
    for (int i = 1; i <= n; ++i) fa[i] = i;
    for (int i = 1; i <= n; ++i)
        for (int j = i+1; j <= n; ++j)
        {
            bool flag = true;
            for (int k = 1; k <= n; ++k)
                if (a[i][k] + a[j][k] > t) flag = false;
            if (flag) fa[find(i)] = find(j);
        }

    ll ans = 1;
    map<int, int> mp;
    for (int i = 1; i <= n; ++i) ++mp[find(i)];
    for (auto p = mp.begin(); p != mp.end(); ++p)
        for (int i = 1; i <= p->second; ++i) ans = ans*i%m;

    for (int i = 1; i <= n; ++i) fa[i] = i;
    for (int i = 1; i <= n; ++i)
        for (int j = i+1; j <= n; ++j)
        {
            bool flag = true;
            for (int k = 1; k <= n; ++k)
                if (a[k][i] + a[k][j] > t) flag = false;
            if (flag) fa[find(i)] = find(j);
        }

    mp.clear();
    for (int i = 1; i <= n; ++i) ++mp[find(i)];
    for (auto p = mp.begin(); p != mp.end(); ++p)
        for (int i = 1; i <= p->second; ++i) ans = ans*i%m;

    printf("%lld\n", ans);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 998244353;
const ll len = 15;

// nCr (mod p) 計算量 O(3*10^5*logp)
const ll Maximum = 5500;
ll Fac[Maximum+1], iFac[Maximum+1];
bool made_Fac = false;
// x^n (mod p) 計算量 O(logn)
ll powmodp(ll x, ll n) {
    if (n==0) return 1;
    else if (n%2==0) {
        ll ans = powmodp(x,n/2);
        return ans*ans % mod;
    }
    else return x * powmodp(x,n-1) % mod;
}
// nCr (mod p) 計算量 O(3*10^5*logp)
void make_Fac() {
    Fac[0] = 1;
    iFac[0] = 1;
    for (ll i=0; i<Maximum; i++) {
        Fac[i+1] = Fac[i] * (i+1) % mod;
        iFac[i+1] = iFac[i] * powmodp(i+1,mod-2) % mod;
    }
}
ll nCrmodp(ll n, ll r) {
    if (!made_Fac) {
        make_Fac();
        made_Fac = true;
    }
    r = min(r,n-r);
    if (n==0 or r==0) return 1;
    ll tmp = iFac[n-r] * iFac[r] % mod;
    return tmp * Fac[n] % mod;
}

vector<ll> to_bin(ll X) {
    vector<ll> res(len);
    rep(i,len) {
        res[i] = X % 2;
        X /= 2;
    }
    return res;
}

int main() {
    ll N, M; cin >> N >> M;

    if (M%2) Cout(0);

    vector<ll> S = to_bin(M);

    vector<vector<ll>> dp(len,vector<ll>(N+1));
    for (ll cnt=0; cnt<=N; cnt+=2) dp[0][cnt/2] = nCrmodp(N,cnt);
    for (ll i=1; i<len; i++) {
        for (ll cnt=0; cnt<=N; cnt+=2) {
            rep(j,N) {
                if (j%2!=S[i]) continue;
                ll tmp = cnt + j;
                dp[i][tmp/2] += dp[i-1][j] * nCrmodp(N,cnt) % mod;
                dp[i][tmp/2] %= mod;
            }
        }
    }

    ll ans = dp[len-1][0];

    cout << ans << endl;
}


#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <math.h>
#include <complex>

using namespace std;

#define rep(i, n) for (long long int i = 0; i < (long long int)(n); i++)
#define irep(i, n) for (long long int i = 1; i <= (long long int)(n); i++)
#define drep(i, n, diff) for (long long int i = 0; i < (long long int)(n); i += diff)
#define mod 1000000007
#define INF 1001001001001001011
#define ld(val) printf("%s : %lld\n", #val, val);
#define sd(val) printf("%s : %s\n", #val, val.c_str());

typedef long long int ll;
typedef pair<ll, ll> P;
typedef pair<P, P> PP;
typedef tuple<ll, ll, ll> TP;

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

#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

#define LL long long

const LL inf = 1000000000000000000ll;
LL fib[150],m,n,nn;
int main(){
	int i;	cin >> n;nn=n;
	fib[0] = 1,fib[1] = 1; m = 1;
	while (fib[m] + fib[m-1] <= n){
		fib[m+1] = fib[m] + fib[m-1];
		++m;
	}
//	cerr<<m<<'\n';

	int ops = 0;

	for (i = 0; i <= m; ++i){
		if (i){
			++ops;
		}
		if (fib[m - i] <= n){
			n -= fib[m - i];
			++ops;
		}
	}
	n=nn;
	cout << ops << '\n';

	LL x = 0,y = 0;
	for (i = 0; i <= m; ++i){
		if (i){
			if ((m-i-1) & 1) cout << 3 << '\n',x+=y;
			else cout << 4 << '\n',y+=x;
		}
		if (fib[m - i] <= n){
			n -= fib[m - i];
			if ((m-i) & 1) cout << 2 << '\n',++y;
			else cout << 1 << '\n',++x;
		}
	}
//	cerr << "final " << x << ' ' << y << '\n';
	assert(x == nn);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = 998244353;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}

const int N = 5050;
int n, m;
int pw[N][N];

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

	for (int x = 0; x < N; x++) {
		pw[x][0] = 1;
		for (int i = 1; i < N; i++)
			pw[x][i] = mult(pw[x][i - 1], x);
	}
	scanf("%d%d", &n, &m);
	int ans = 0;
	for (int i = 0; i < n; i++)
		for (int x = 1; x <= m; x++) {
			ans = add(ans, mult(pw[m - x][i], pw[m][n - 1 - i]));
		}
	for (int d = 1; d < n; d++)
		for (int x = 1; x <= m; x++) {
			ans = add(ans, mult(mult(n - d, x - 1), mult(pw[m - x][d - 1], pw[m][n - 1 - d])));
		}
	printf("%d\n", ans);

	return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

using LL = long long;
using LD = long double;
using ordered_set = tree<LL,null_type,less<LL>,rb_tree_tag,tree_order_statistics_node_update>;

void fastio() {
	cin.tie(nullptr);
	cin.sync_with_stdio(false);
}

const LL MOD = 998244353;
const LL INF = 1e18;
const LL N = 2e5+10;

#define S second
#define F first
#define vt vector

vt<LL> fac(N), ifac(N);

LL bpow(LL x, LL p, LL m) {
	x %= m;
	LL r = 1;
	while (p) {
		if (p&1) {
			r = r*x%m;
		}
		p>>=1;
		x = x*x %m;
	}
	return r;
}

LL binom (LL n, LL r, LL m) {
	if (r > n) {
		return 0;
	}
	LL res = fac[n]*ifac[r]%m * ifac[n-r]%m;
	return res;
}

int main() {
	fastio();

	fac[0] = 1;
	for (LL i = 1; i < N; ++i) {
		fac[i] = i*fac[i-1]%MOD;
	}
	ifac[N-1] = bpow(fac[N-1], MOD-2, MOD);

	for (LL i = N-2; i >= 0; --i) {
		ifac[i] = ifac[i+1]*(i+1)%MOD;
	}

	LL n, m, k;
	cin >> n >> m >> k;

	if (n == 1 || m == 1) {
		LL mx = max(n, m);
		LL ans = 0;
		for (LL i = 1; i <= k; ++i) {
			LL l = 1;
			LL r = bpow(k-i+1, mx, MOD) - bpow (k-i, mx, MOD);
			//cerr << l << " " << r << "\n";
			ans = (ans + l*r% MOD + MOD) % MOD;
		}
		cout << ans << "\n";
		return 0;

	}

	LL ans = 0;
	for (LL i = 1; i <= k; ++i) {
		LL l = bpow(i, n, MOD) - bpow (i-1, n, MOD);
		LL r = bpow(k-i+1, m, MOD);
		//cerr << l << " " << r << "\n";
		ans = (ans + l*r% MOD + MOD) % MOD;
	}
	cout << ans << "\n";

}