#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ar array
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define endl "\n"
#define fo(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define precision cout<<fixed<<setprecision(10)
#define w(t) ll t;cin>>t;while(t--)
#define setbits(x) __builtin_popcountll(x)
const double pi=3.1415926535897932384626;
//const ll mod = 998244353;
const ll mod=1e9+7;
int main()
{
  IOS
  ll x,y,a,b;
  cin>>x>>y>>a>>b;
  ll c=0;
  while(1){
    if(x>1e9) break;
    if(x*a>x+b||(x*a)>=y)
        break;
    c++;
    x=x*a;
  }
  if(x>=y)
    cout<<c<<endl;
  else{
    ll p=(y-x);
    if(p%b==0)
        c+=(p/b-1);
    else
        c+=(p/b);
    cout<<c;
  }
  return 0;
}

#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n=1000,i,j,sx,sy,gx,gy,d;
	for(i=0; i<n; ++i){
		std::cin >> sx >> sy >> gx >> gy;
		if(gx > sx){
			for(j=sx; j<gx; ++j){
				std::cout << "D";
			}
		}else{
			for(j=gx; j<sx; ++j){
				std::cout << "U";
			}
		}
		if(gy > sy){
			for(j=sy; j<gy; ++j){
				std::cout << "R";
			}
		}else{
			for(j=gy; j<sy; ++j){
				std::cout << "L";
			}
		}
		std::cout << std::endl;
		std::cin >> d;
	}
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int q,n,k;
	bool flag;
	std::string s;
	std::cin >> q;
	while(q--){
		std::cin >> s;
		flag = false;
		n = s.l_ength();
		if(s > "atcoder"){
			std::cout << 0 << std::endl;
			continue;
		}
		for(k=1; k<n; ++k){
			if(s[k]>'a'){
				flag = true;
				break;
			}
		}
		if(!flag){
			std::cout << (-1) << std::endl;
			continue;
		}
		if(s[k]>'t'){
			std::cout << k-1 << std::endl;
		}else{
			std::cout << k << std::endl;
		}
	}
	return 0;
}

#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pf push_front
#define F first
#define S second
#define SS stringstream
#define sqr(x) ((x)*(x))
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define CC(x) cout << (x) << endl
#define AL(x) x.begin(),x.end()
#define pw(x) (1ull<<(x))
#define NMSL cout << "NMSL" << endl;
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define debug3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define debug4(a, b, c, d) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define fio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in128 __int128_t
using namespace std;
const int N = 1e5+10;
const int INF = 0x7f7f7f7f;
const double EPS = 1e-3;
const long double PI = 3.14159265358979323846;
int a[N];
signed main()
{
    fio
    int T;
    string ss;
    string at="atcoder";
    cin>>T;
    while(T--)
    {
        cin>>ss;
        string sk=ss;
        sort(sk.begin(),sk.end());
        reverse(sk.begin(),sk.end());
        if(sk<=at)
        {
            cout<<-1<<endl;
            continue;
        }
        int ans=INF;
        if(ss>at)ans=0;
        else if(ss==at)ans=1;
        else
        {
            for(int i=0;i<ss.length();++i)
            {
                for(int j=i+1;j<ss.length();++j)if(ss[j]>at[i]){ans=min(ans,j-i);break;}
                if(ss[i]<at[i])break;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>

int main()
{
  int h = 0, w = 0, futon_counter = 0;
  std::string room = "";
  std::cin >> h >> w;
  for(int i = 0; i < h; ++i)
  {
    std::string tmp = "";
    std::cin >> tmp;
    room += tmp;
  }
  for(int i = 0; i < h * w; ++i)
  {
    if(room[i] == '#') continue;
    if(room[i + 1] == '.' && ( i + 1 < h * w) && ((i + 1) % w != 0)) ++futon_counter;
    if(room[i + w] == '.' && (i + w < h * w)) ++futon_counter;
  }
  std::cout << futon_counter << std::endl;
  return 0;
}


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

int main() {
  ll N; cin>>N;
  ll ans=LLONG_MAX;
  ll b=0;
  ll pow2=1;
  while(pow2<=N) {
    ans=min(ans,N/pow2+N%pow2+b);
    pow2*=2;
    b++;
  }
  cout<<ans<<endl;
}

#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='6')cout<<9;
		else if(s[i]=='9')cout<<6;
		else cout<<s[i];
	}
}


// author: Halit
#include <bits/stdc++.h>

int main() {
  std::string str; int k;
  std::cin >> str >> k;

  auto is_multiple_of_200 = [&]() {
    int size = str.size();

    if (size < 3) {
      return false;

    } if (str[size-1] != '0' || str[size-2] != '0') {
      return false;

    } if ( int(str[size-3]-'0')&1) {
      return false;

    } else return true;
  };

  for (int i = 0;i < k; ++i) {
    if (is_multiple_of_200()) {
      str.pop_back(); str.pop_back();
      str = std::to_string(std::stoll(str)/2);
    } else str += "200";
  }

  std::cout << str;
}

#include <iostream>
using namespace std;

long int N,K;

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

}


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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define getchar_unlocked getchar

int A[100005];
int B[100005];
int offset[100005];
int minLevel1[100005];
int minLevel2[100005];
int N, L;

inline int nextInt(){
    int x=0;
    char ch=0;
    do{
        ch=getchar_unlocked();
    }while(ch<'0'||ch>'9');
    while(ch>='0'&&ch<='9'){
        x=10*x+(ch-'0');
        ch=getchar_unlocked();
    }
    return x;
}

int main(){
    N = nextInt();
    L = nextInt();
    for(int i = 1; i <= N; i ++){
        A[i] = nextInt();
        offset[i] = A[i]-i;
    }
    for(int i = 1; i <= N; i ++){
        B[i] = nextInt();
    }

    for(int i = 1; i <= N; i ++){
        minLevel1[i] = 0;
        minLevel2[i] = 0;
        //printf("offset[%d]=%d\n", i, offset[i]);
    }

    long long ans = 0;
    int lo = 1;
    int hi2 = 1;
    for(int i = 1; i <= N; i ++){
        if(A[i] == B[i]){continue;}
        if(B[i] == i || B[i] == L-N+i){
            ans ++;
        }else{
            while(lo < N+2 && offset[lo] < B[i]-i){
                lo ++;
            }

            if((lo == N+2) || (offset[lo] != B[i]-i)){
                printf("-1");
                return 0;
            }

            hi2 = max(hi2, lo);
            while(hi2 < N+2 && offset[hi2] <= B[i]-i){
                hi2 ++;
            }

            int hi = hi2-1;
            //int hi = upper_bound(offset+1, offset+(1+N), B[i]-i) - offset - 1;

            if(lo > i){
                minLevel2[lo] = max(minLevel2[lo], lo - i);
            }else{
                minLevel1[hi] = max(minLevel1[hi], i - hi);
            }

            //printf("i=%d [%d, %d]\n", i, lo, hi);
            //ans += min(abs(lo - i), abs(hi - i));
        }
    }

    for(int i = 1; i <= N; i ++){
        ans += minLevel1[i] + minLevel2[i];
    }

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

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=1e5+5;
int n,m,tp[N],a[N],b[N];
long long ans;

void GG(){
	write(-1);
	exit(0);
}

signed main(){
	read(n,m);
	for(int i=1;i<=n;i++) read(tp[i]),a[i]=tp[i]-tp[i-1]-1;a[n+1]=m-tp[n];
	for(int i=1;i<=n;i++) read(tp[i]),b[i]=tp[i]-tp[i-1]-1;b[n+1]=m-tp[n];n++;
	for(int i=1,j=1;i<=n;i++) if(b[i]){
		while(!a[j]) j++;
		int cur=0,l=j;
		while(j<=n&&cur<b[i]) cur+=a[j++];
		if(cur>b[i]) GG();
		ans+=max(i-l,0)+max(j-1-i,0);
	}
	write(ans);
}


#include <bits/stdc++.h>
#include <random>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef long double ld; typedef pair<lint, lint> plint; typedef pair<ld, ld> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;++i)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;--i)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
#define fi first
#define se second
struct fast_ios { fast_ios() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_;
template<class T> auto add = [](T a, T b) -> T { return a + b; };
template<class T> auto f_max = [](T a, T b) -> T { return max(a, b); };
template<class T> auto f_min = [](T a, T b) -> T { return min(a, b); };
template<class T> using V = vector<T>;
using Vl = V<lint>; using VVl = V<Vl>;
template< typename T > ostream& operator<<(ostream& os, const vector< T >& v) {
	for (int i = 0; i < (int)v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : "");
	return os;
}
template< typename T >istream& operator>>(istream& is, vector< T >& v) {
	for (T& in : v) is >> in;
	return is;
}
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; }
lint gcd(lint a, lint b) { if (b == 0) return a; else return gcd(b, a % b); }
lint ceil(lint a, lint b) { return (a + b - 1) / b; }
lint digit(lint a) { return (lint)log10(a); }
lint e_dist(plint a, plint b) { return abs(a.fi - b.fi) * abs(a.fi - b.fi) + abs(a.se - b.se) * abs(a.se - b.se); }
lint m_dist(plint a, plint b) { return abs(a.fi - b.fi) + abs(a.se - b.se); }
void Worshall_Floyd(VVl& g) { REP(k, SZ(g)) REP(i, SZ(g)) REP(j, SZ(g)) chmin(g[i][j], g[i][k] + g[k][j]); }
const lint MOD1000000007 = 1000000007, MOD998244353 = 998244353, INF = 1e18;
lint dx[8] = { 1, 0, -1, 0, 1, -1, 1, -1 }, dy[8] = { 0, 1, 0, -1, -1, -1, 1, 1 };
bool YN(bool flag) { cout << (flag ? "YES" : "NO") << endk; return flag; } bool yn(bool flag) { cout << (flag ? "Yes" : "No") << endk; return flag; }
struct Edge {
	lint from, to;
	lint cost;
	Edge(lint u, lint v, lint c) {
		cost = c;
		from = u;
		to = v;
	}
	bool operator<(const Edge& e) const {
		return cost < e.cost;
	}
};
struct WeightedEdge {
	lint to;
	lint cost;
	WeightedEdge(lint v, lint c = 1) {
		to = v;
		cost = c;
	}
	bool operator<(const WeightedEdge& e) const {
		return cost < e.cost;
	}
};
using WeightedGraph = V<V<WeightedEdge>>;
typedef pair<lint, plint> tlint;
typedef pair<plint, tlint> qlint;
typedef pair<string, lint> valstring;

lint A, B, C, D;
int main() {
	cin >> A >> B >> C >> D;
	yn(!(A * B <= D && D <= A * C));
}

#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
using namespace std;

// printf("%d\n", x); =>
// cout << x << "\n";

// scanf("%d", &x); =>
// cin >> x;

int main(int argc, char **argv) {
	int v, t, s, d;
	scanf("%d%d%d%d", &v, &t, &s, &d);
	if (d >= v * t && d <= v * s) {
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define endl "\n"
# define int long long
#define pb push_back
const int N = 3005,mod = 1e9 + 7;
 int n;
 int a[20];
 int help(int id,int orr,int xr)
 {
     if(id==n)
        return (xr^orr);
     int op1=1e12,op2=1e12;
     op1 = help(id+1,(orr|a[id]),xr);
     op2 = help(id+1,a[id],(xr^orr));
     return min(op1,op2);
 }
signed main(){
	gok

     cin>>n;

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

     cout<<help(0,0,0);

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
// #define LOCAL // 提出時はコメントアウト
#define DEBUG_

typedef long long ll;
const double EPS = 1e-9;
const ll INF = ((1LL<<62)-(1LL<<31));
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;
template<typename T> using uset = unordered_set<T>;
template<typename T, typename U> using mapv = map<T,vector<U>>;
template<typename T, typename U> using umap = unordered_map<T,U>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define sz(x) (ll)x.size()
ll llceil(ll a,ll b) { return (a+b-1)/b; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> vector<vector<T>> genarr(ll n, ll m, T init) { return vector<vector<T>>(n,vector<T>(m,init)); }

///// DEBUG
#define DUMPOUT cerr
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
template<typename T>istream&operator>>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<typename T,typename U>ostream&operator<<(ostream&os,pair<T,U>&pair_var){os<<"("<<pair_var.first<<", "<<pair_var.second<<")";return os;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&vec){os<<"{";for(int i=0;i<vec.size();i++){os<<vec[i]<<(i+1==vec.size()?"":", ");}
os<<"}";return os;}
template<typename T,typename U>ostream&operator<<(ostream&os,map<T,U>&map_var){os<<"{";repi(itr,map_var){os<<*itr;itr++;if(itr!=map_var.end())os<<", ";itr--;}
os<<"}";return os;}
template<typename T>ostream&operator<<(ostream&os,set<T>&set_var){os<<"{";repi(itr,set_var){os<<*itr;itr++;if(itr!=set_var.end())os<<", ";itr--;}
os<<"}";return os;}
void dump_func(){DUMPOUT<<endl;}
template<class Head,class...Tail>void dump_func(Head&&head,Tail&&...tail){DUMPOUT<<head;if(sizeof...(Tail)>0){DUMPOUT<<", ";}
dump_func(std::move(tail)...);}
#ifndef LOCAL
#undef DEBUG_
#endif
#ifdef DEBUG_
#define DEB
#define dump(...)                                                          \
DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
        << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
        << endl                                                            \
        << "    ",                                                         \
    dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

//////////

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

int solve(ostringstream &cout) {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif

    ll N;
    cin>>N;

    ll ans = 0;
    vecl A(N);
    rep(i,N) cin>>A[i], ans ^= A[i];

    dump(ans);
    if (N == 1) {
        cout << ans << endl;
        return 0;
    }

    ll e = 0;
    // ll ans = INF;
    rep(i,1<<(N-1)) {
        if (i == 0) continue;
        ll s = 0;
        vecl OR;
        ll current = e;
        rep(j,N-1) {
            if (i & (1<<j)) { // i - i + 1
                current = current | A[j];
                OR.push_back(current);
                current = e;
                s = i + 1;
            }
            else {
                current = current | A[j];
            }
        }

        OR.push_back(current | A[N-1]);

        ll sub = 0;
        for (auto x : OR) sub ^= x;
        dump(i,sub,OR);
        chmin(ans,sub);
    }

    cout << ans << endl;

    return 0;
}

int main() {
    ostringstream oss;
    int res = solve(oss);

    cout << oss.str();
    return res;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>
#include<chrono>
#include<iomanip>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

namespace {
    struct custom_hash {
        static uint64_t splitmix64(uint64_t x) {
            // http://xorshift.di.unimi.it/splitmix64.c
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }

        size_t operator()(uint64_t x) const {
            static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }
    };

    template<typename T, typename F>
    using HashMap = unordered_map<T, F, custom_hash>;

    template<typename T>
    using HashSet = unordered_set<T, custom_hash>;
}

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
    ll gcd(ll a, ll b) {
        return (a == 0 ? b : gcd(b % a, a));
    }
    ll gcdex(ll a, ll b, ll& x, ll& y) {
        if (a == 0) {
            x = 0; y = 1;
            return b;
        }
        ll x1, y1;
        ll d = gcdex(b % a, a, x1, y1);
        x = y1 - (b / a) * x1;
        y = x1;
        return d;
    }

    ll inv_eu(ll a, ll m) {
        ll x, y;
        ll g = gcdex(a, m, x, y);
        if (g != 1)
            assert(0);
        else {
            x = (x % m + m) % m;
            return x;
        }
    }
}

ll const inf = 1e11 + 9;
ll const maxk = 22;
ll const maxn = 3e5 + 5;

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

    ld sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;

    ld len = gx - sx;

    cout << fixed << setprecision(15);

    cout << (sx + len / (1 + gy / sy));
    return 0;
}

/*
1
8
1 2 7 3 2 1 2 3

1
7
4 1 5 2 6 3 7

*/

/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;

/****** Template of some basic operations *****/
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
/**********************************************/

/****** Template of Fast I/O Methods *********/
template <typename T> inline void write(T x)
{
	int i = 20;
	char buf[21];
	// buf[10] = 0;
	buf[20] = '\n';

	do
	{
		buf[--i] = x % 10 + '0';
		x/= 10;
	}while(x);
	do
	{
		putchar(buf[i]);
	} while (buf[i++] != '\n');
}

template <typename T> inline T readInt()
{
	T n=0,s=1;
	char p=getchar();
	if(p=='-')
		s=-1;
	while((p<'0'||p>'9')&&p!=EOF&&p!='-')
		p=getchar();
	if(p=='-')
		s=-1,p=getchar();
	while(p>='0'&&p<='9') {
		n = (n<< 3) + (n<< 1) + (p - '0');
		p=getchar();
	}

	return n*s;
}
/************************************/

/******* Debugging Class Template *******/
#define DEBUG

#ifdef DEBUG

    #define debug(args...)     (Debugger()) , args

    class Debugger
    {
        public:
        Debugger(const std::string& _separator = " - ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std:cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std:cerr << endl;}

        private:
        bool first;
        std::string separator;
    };

#else
    #define debug(args...)                  // Just strip off all debug tokens
#endif

#define ll long long
#define MAX_PRIME 100005

vector<int> primes;

void sieve(){
	bool composite[MAX_PRIME];
	composite[0] = true;
	composite[1] = true;
	for(int i=2; i*i<MAX_PRIME; i++){
		if(!composite[i]){
			primes.push_back(i);
			for(int j=2*i; j<MAX_PRIME; j+=i) composite[j]=true;
		}
	}
}

void solve(){
	ll sx, sy, gx, gy;
	cin>>sx>>sy>>gx>>gy;
	double ans=(double)(sy*gx+gy*sx)/(double)(sy+gy);
	cout<<std::fixed;
	cout.precision(9);
	cout<<ans<<"\n";
}

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


#include<bits/stdc++.h>
using namespace std;
int fn(int ii)
{
    int a=0;
    for(int i=0;i<20;i++)
    {
        if(((1 << i) & ii)!=0)
         a++;
    }
    return a;
}
int gn(map<int,int> mp,int i)
{
    vector<int> vc;
    for(int j=0;j<20;j++)
    {
        if(((1 << j) & i)!=0)
         vc.push_back(j+1);
    }
    for(auto ii : mp)
    {
        int k=0;
        for(int j=0;j<vc.size();j++)
        {
            if(vc[j]<=ii.first) k++;
        }
        if(k>ii.second)
        return 0;
    }
    return 1;
}
int main()
{
       ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     int n,m;
     cin>>n>>m;
     map<int,int> a[n];
     for(int i=0;i<m;i++)
     {
         int x,y,z;
         cin>>x>>y>>z;
         x--;
         if(a[x].find(y)==a[x].end())
         a[x][y]=z;
         else a[x][y]=min(a[x][y],z);
     }
     int sz=(1 << n);
     long long int dp[sz];
     for(int i=0;i<sz;i++)
      dp[i]=0;
     dp[0]=1;
     for(int i=1;i<sz;i++)
     {
         //to arrange bit'th no of elemnts
         int k=fn(i);
         if(gn(a[k-1],i)==1)//has conditions
         {
             for(int j=0;j<n;j++)
             {
                 if(((1 << j) & i)!=0)
                 dp[i]+=dp[i-(1 << j)];
             }
         }
     }
     cout<<dp[sz-1];
    return 0;
}

#pragma region
#ifdef LOCAL
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif

// debug
template<typename ... Types>
void __read(Types& ... args) {
  ((std::cin >> args), ...);
}
#define read(type, ...) type  __VA_ARGS__; __read(__VA_ARGS__)

template <typename Type, typename... Types>
auto print(Type const &arg, Types const &... args) {
  std::cout << arg, ((std::cout << " " << args), ...), std::cout << std::endl;
}
template <typename Type, typename... Types>
auto print_debug(Type const &arg, Types const &... args) {
  std::cout << arg, ((std::cout << " | " << args), ...), std::cout << std::endl;
}
#ifdef LOCAL
#define debug(...) do{std::cout <<  __LINE__ << ": [" << #__VA_ARGS__ << "]: ", print_debug(__VA_ARGS__);}while(0)
#else
#define debug(...) 1
#endif

#define __DEF_PRINTER(container)                                          \
template<typename T>                                                      \
std::ostream& operator<<(std::ostream& out, container<T> const& a)        \
{                                                                         \
  size_t len = a.size();                                                  \
  for(auto x : a) out << x << " \n"[len--==0];                            \
  return out;                                                             \
}

__DEF_PRINTER(std::vector)
__DEF_PRINTER(std::set)
__DEF_PRINTER(std::unordered_set)
// end debug

#define ALL(container) std::begin(container), std::end(container)
#define RANGE(container, lo, hi) std::begin(container)+(lo), std::begin(container)+(hi)

const char nl = '\n';
using std::cout;
using std::cin;

template <typename T>
void minmax(T k1, T k2, T& min, T& max) {
  min = std::min(k1, k2);
  max = std::max(k1, k2);
}

std::vector<int> iota(int size) {
  std::vector<int> res(size);
  std::iota(res.begin(), res.end(), 0);
  return res;
}

template <typename Iter>
auto counter(Iter from, Iter to) {
  std::map<typename Iter::value_type, int> res;
  while(from != to) res[*from++]++;
  return res;
}

const long long mod = 1e9+7;
long long reduce_mod(long long a) {
  return (a % mod + mod) % mod;
}
long long add(long long a, long long b) {
  return reduce_mod(a + b);
}
long long mult(long long a, long long b) {
  return reduce_mod(a * b);
}

std::string yn(bool yes) {
  return yes ? "yes" : "no";
}

#pragma endregion

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

  read(int, n, m);

  std::vector<int> x(m), y(m), z(m);
  for(int i = 0; i < m; i++) {
    read(int, xi, yi, zi);
    x[i] = xi, y[i] = yi, z[i] = zi;
  }

  std::vector<long long> dp(1<<n);
  dp[0] = 1;
  for (int mask = 0; mask < 1<<n; mask++) {
    int c = __builtin_popcount(mask);
#if 1 // v2
    int rest = (((1<<n)-1) & ~mask);
    while(rest) {
      int mask2 = mask|(rest&-rest);
      rest-=rest&-rest;
      int valid = 1;
      for (int k = 0; k < m; k++) {
        if (x[k] == c+1 && __builtin_popcount(mask2 & ((1<<y[k])-1)) > z[k]) {
          valid = 0;
          break;
        }
      }
      if (valid) {
        dp[mask2] += dp[mask];
      }
    }
#else
    for (int j = 0; j < n; j++) {
      if (mask&(1<<j)) continue;
      int mask2 = mask|(1<<j);
      int valid = 1;
      for (int k = 0; k < m; k++) {
        if (x[k] == c+1 && __builtin_popcount(mask2 & ((1<<y[k])-1)) > z[k]) {
          valid = 0;
          break;
        }
      }
      if (valid) {
        dp[mask2] += dp[mask];
      }
    }
#endif
  }
  print(dp[(1<<n)-1]);
}


#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define all(x) (x).begin(),(x).end()
ll power(ll x , ll n,ll mod){
    if(n == 0) return 1ll;
    ll cur = power(x, n >> 1,mod);
    if(n & 1) return (cur % mod * cur % mod  * x) % mod ;
    return (cur % mod * cur % mod) % mod ;
}
const int maxx = 200005;
const int mod = 1000000007;
ll a[maxx];
void solve()
{
    ll n , m ; cin >> n >> m;
    if(m == 0){
        cout << 1;
        return ;
    }
    for(ll i = 1; i <= m ; ++i) cin >> a[i];
    sort(a + 1,a + 1 + m);
    ll ans = ((a[1] - 1) == 0  ? 1e9 : a[1] - 1);
    for(ll i = 2; i <= m ; ++i){
        if(a[i] - a[i - 1] - 1 != 0)ans = min(ans , a[i] - a[i - 1] - 1);
    }
    if(n - a[m] != 0) ans = min(ans,n - a[m]);
    if(n == m){
        cout << 0;
        return ;
    }
    //cout << ans << '\n';
    ll res = ( (a[1] - 1ll) % ans == 0 ? (a[1] - 1ll) / ans : (a[1] - 1ll) / ans + 1);
    for(ll i = 2; i <= m ; ++i){
        ll cur = (a[i] - a[i - 1] - 1ll) / ans;
        res += ( (a[i] - a[i - 1] - 1ll) % ans == 0 ? cur : cur + 1);
    }
    res += ( (n - a[m]) % ans == 0 ? (n - a[m]) / ans : (n - a[m]) / ans + 1);
    cout << res;
}
signed main()
{

    //freopen("t.inp","r",stdin);freopen("t.out","w",stdout);
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    solve();
    return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{

	int N, M;
	cin >> N >> M;
	vec(A);
	pb(A, 0);
	pb(A, N + 1);
	fx(M) {
		vecp(A);
	}

	sorts(A);

	int k = INT_MAX;
	fx(A.size()-1) {
		if (A[x + 1] - A[x] - 1==0) {
			continue;
		}
		k = min(k, max(A[x + 1] - A[x]-1,1));
	}
	int ans = 0;
	fx(A.size()-1) {
		ans += (A[x + 1] - A[x] + k - 2) / k;
	}
	ce(ans)
    return 0;
}


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

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

#include "bits/stdc++.h"
using namespace std;
using ll=int64_t;
using ld=long double;
using ull=unsigned long long;
template <class T>
using grid=vector<vector<T>>;
#define ALL(x) x.begin(),x.end()
#define rep(iter,from,to) for(ll iter=from;iter<to;++iter)

const ll MOD=1e9+7;
const ll INF=1e17;
//#######################################################################
vector<vector<ll>> input(ll N, ll width){
    string str;
    vector<vector<ll>> vec(N,vector<ll>(width));
    for(ll i=0;i<N;++i){
        cin>>str;
        reverse(ALL(str));
        for(ll j=0;j<width;++j){
            vec[i][j]=str.back();
            str.pop_back();
        }
    }
    return vec;
}
void op(vector<ll> vec){
    ll size=(ll)vec.size();
    for(ll i=0;i<size-1;++i) cout<<vec[i]<<" ";
    cout<<vec.back()<<endl;
}

void op(vector<vector<ll>> vec){
    ll height=(ll)vec.size();
    ll width=(ll)vec[0].size();
    for(ll i=0;i<height;++i) {
        for(ll j=0;j<width-1;++j) cout<<vec[i][j]<<" ";
        cout<<vec[i].back()<<endl;
    }
}
//########################################################################

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

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


#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stdio.h>
//eolibraries
#define lnf 3999999999999999999
#define inf 999999999
#define PI 3.14159265359
#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ll long long
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define mkp(a,b) make_pair(a,b)
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define rsz(a,n) a.resize(n)
#define pii pair <int,int>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define drep(i,n) for(int i = n-1 ; i >= 0 ; i--)
#define crep(i,x,n) for(int i = x ; i < n ; i++)
#define vi vector <int>
#define vec(s) vector<s>
#define rsz(a,n) a.resize(n)
#define rszv(a,n,v) a.resize(n,v)
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//eodefine

const int max_n = 300000;

using namespace std;

void slv(vi a){

	int n=sz(a);

	int op=1;

	vi ans;

	rep(t,max_n){

		int x=0,j=0;

		rep(i,n-1) {
			if(a[i]>a[i+1]){ x=max(x,a[i]); j=i;}
		}

		if(x==0) break;

		std::function<void(int)> odo1 = [&](int idx){
			swap(a[idx],a[idx+1]);
			ans.pb(idx);
			op++;
		};

		std::function<void(int)> odo2 = [&](int idx){
			int v = a[idx];
			crep(k,idx,n-1) {
				if(a[k+1]>v) break;
				odo1(k);
			}
		};

		std::function<void(int)> inodo1 = [&](int idx){
			odo1(idx-1);
			odo1(idx);
			odo1(idx-1);
			odo2(idx);
		};

		std::function<void(int)> inodo2 = [&](int idx){
			odo1(idx+1);
			odo1(idx);
			odo2(idx+1);
		};

		if(op%2!=0) {
			if(j%2==0) {
				odo2(j);
			} else {
				if(j-1>=0 and j+1<n) inodo1(j);
				else if(j+2<n) inodo2(j);
				else { odo1(j-1); inodo2(j-1); }
			}
		} else {
			if(j%2==0) {
				if(j-1>=0 and j+1<n) inodo1(j);
				else if(j+2<n) inodo2(j);
				else { odo1(j-1); inodo2(j-1); }
			} else {
				odo2(j);
			}
		}
		//dbgstrt
		// cout << x << " " << j << "\n";
		// for(auto y : a) cout << y << " ";
		// cout<<"\n\n";
		// if(t==3) break;
		//dbgend
	}

	cout << sz(ans) << "\n";
	for(auto x : ans) cout << x + 1 << " ";
	cout << "\n";

}

// bool ok(pair <int,vi> p) {
// 	if(p.fi > sz(p.se)*sz(p.se)) return 0;
// 	vi tmp=p.se;
// 	sort(all(tmp));
// 	if(tmp!=p.se)return 0;
// 	return 1;
// }

int main(){
fcin;

	int t;
	cin>>t;
	rep(_,t){
		int n;
		cin>>n;
		vi a;
		rep(i,n){int x;cin>>x;a.pb(x);}
		slv(a);
	}

	// srand(time(NULL));
	// while(true) {
	// 	int n=20;
	// 	vi usd(510,0);
	// 	vi a;
	// 	rep(i,n) {
	// 		int x=0;
	// 		while(true) {
	// 			x=rand()%n+1;
	// 			if(usd[x]==1) continue;
	// 			else break;
	// 		}
	// 		usd[x]=1;
	// 		a.pb(x);
	// 	}
	// 	cout << n << "\n";
	// 	for(auto x : a) cout << x << " ";
	// 	cout<<"\n";
	// 	slv(a);
	// 	// if(ok(slv(a)) == 0) {
	// 	// 	cout << "whaaat\n";
	// 	// 	return 0;
	// 	// }
	// }

/*
*/

    return 0;
}

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

//mint
using ll = long long ;
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int N ;
    cin >> N ;
    vector<long long> A(N) ;
    for(int i = 0 ; i < N ; i++) cin >> A.at(i) ;
    A.insert(A.begin(),0) ;
    mint cnt = 1 ;
    sort(A.begin() , A.end()) ;
    for(int i = 0 ; i < N ; i++){
      cnt *= A.at(i+1) - A.at(i) + 1  ;
    }

    cout << cnt << endl;

}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ma = 0;
    ll ans = 0;
    for(ll i = 2; i <= 1000; i++){
        ll cnt = 0;
        rep(j, n){
            if(a[j] % i == 0) cnt++;
        }
        if(ma < cnt){
            ma = cnt;
            ans = i;
        }
    }

    cout << ans << endl;
}

#pragma region my_template
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

#define range(i, l, r) for(int i = (int)(l); i < (int)(r); i++)
#define rrange(i, l, r) for(int i = (int)(r)-1; i >= (int)(l); i--)
#define rep(i, n) range(i, 0, n)
#define rrep(i, n) rrange(i, 0, n)
#define len(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sum(a) accumulate(all(a), 0)
#define uni(a) (a).erase(unique(all(a)), (a).end());
#define append push_back
#define mp make_pair
#define elif else if

constexpr int MOD = 1e9+7;
//constexpr int MOD = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }
#pragma endregion

constexpr int K = 1000;

void solve() {
    rep(i, K) {
        int sy, sx, ty, tx;
        cin >> sy >> sx >> ty >> tx;
        string ans;

        if (sy > ty) {
            rep(_, sy-ty) ans.append('U');
        } else {
            rep(_, ty-sy) ans.append('D');
        }
        if (sx > tx) {
            rep(_, sx-tx) ans.append('L');
        } else {
            rep(_, tx-sx) ans.append('R');
        }

        cout << ans << endl;
        int t; cin >> t;

    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    solve();
    return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
//#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define SIZE 5005
#define MOD 998244353

ll dp[SIZE][SIZE];
char base_map[SIZE][SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;

}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

int main(){

	ll H,W,K;
	scanf("%lld %lld %lld",&H,&W,&K);

	for(ll row = 0; row < H; row++){
		for(ll col = 0; col < W; col++){

			base_map[row][col] ='@';

			dp[row][col] = 0;
		}
	}

	int tmp_row,tmp_col;
	char buf[2];

	for(ll i = 0; i < K; i++){

		scanf("%d %d %s",&tmp_row,&tmp_col,buf);
		tmp_row--;
		tmp_col--;

		base_map[tmp_row][tmp_col] = buf[0];
	}

	ll MULT = 2*mod_inverse(3,MOD);
	MULT %= MOD;

	dp[0][0] = 1;

	for(ll row = 0; row < H; row++){
		for(ll col = 0; col < W; col++){
			if(row-1 >= 0 && base_map[row-1][col] != 'R'){

				if(base_map[row-1][col] == '@'){

					dp[row][col] += dp[row-1][col]*MULT;
					dp[row][col] %= MOD;

				}else{

					dp[row][col] += dp[row-1][col];
					dp[row][col] %= MOD;
				}
			}

			if(col-1 >= 0 && base_map[row][col-1] != 'D'){

				if(base_map[row][col-1] == '@'){

					dp[row][col] += dp[row][col-1]*MULT;
					dp[row][col] %= MOD;

				}else{

					dp[row][col] += dp[row][col-1];
					dp[row][col] %= MOD;
				}
			}

		}
	}

	printf("%lld\n",(dp[H-1][W-1]*mod_pow(3,H*W-K,MOD))%MOD);

	return 0;
}

#include <bits/stdc++.h>
// #include <atcoder/all> // NOTE: AtCoderライブラリ
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr << #x << ": " << x << ", " << #y << ": " << y << endl;
#define dbg3(x, y, z) cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;
#define nl() cout << "========================================" << endl;
using namespace std;
// using namespace atcoder; // NOTE: AtCoderライブラリ
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }
#define yn { puts("Yes"); } else{ puts("No"); } // 使い方: if (条件) yn;

// 拡張ユークリッドの互除法
ll extGcd(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1; y = 0;
        return a;
    }
    ll s, t;
    ll d = extGcd(b, a % b, s, t);
    x = t;
    y = s - a / b * x;
    return d;
}

// aの逆元(mod p)
ll modinv(ll a, ll p) {
    ll x, y;
    extGcd(a, p, x, y);
    while (x < 0) x += p;
    x %= p;
    return x;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;

        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const ll MOD = 998244353;

int main() {
    ll H, W, K; cin >> H >> W >> K;
    vector<vc> G(H, vc(W, '?'));
    rep(i, K) {
        int x, y; cin >> x >> y; char c; cin >> c;
        x--; y--;
        G[x][y] = c;
    }

    vvl dp(H, vl(W, 0));
    dp[0][0] = 1;

    rep(i, H) {
        rep(j, W) {
            switch (G[i][j]) {
                case 'D':
                    if (i + 1 < H) {
                        dp[i + 1][j] += dp[i][j];
                        dp[i + 1][j] %= MOD;
                    }

                    break;
                case 'R':
                    if (j + 1 < W) {
                        dp[i][j + 1] += dp[i][j];
                        dp[i][j + 1] %= MOD;
                    }

                    break;
                case 'X':
                    if (i + 1 < H) {
                        dp[i + 1][j] += dp[i][j];
                        dp[i + 1][j] %= MOD;
                    }
                    if (j + 1 < W) {
                        dp[i][j + 1] += dp[i][j];
                        dp[i][j + 1] %= MOD;
                    }

                    break;
                default:
                    if (i + 1 < H) {
                        dp[i + 1][j] += 2 * dp[i][j] * modinv(3, MOD);
                        dp[i + 1][j] %= MOD;
                    }
                    if (j + 1 < W) {
                        dp[i][j + 1] += 2 * dp[i][j] * modinv(3, MOD);
                        dp[i][j + 1] %= MOD;
                    }
            }
        }
    }

    ll res = modpow(3, H * W - K, MOD) * dp[H - 1][W - 1] % MOD;
    cout << res << endl;
}


#include <bits/stdc++.h>

using namespace std;
using namespace std::chrono;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)

#define ceil(x) static_cast<ll>(ceil(x))
#define floor(x) static_cast<ll>(floor(x))
#define pow(x, y) static_cast<ll>(pow(x, y))
#define gcd(x, y) static_cast<ll>(__gcd(x, y))
#define lcm(x, y) static_cast<ll>(a * (b / gcd(x, y)))

#define F first
#define S second
#define eb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define FI(i, a, b) for (ll i{a}; i <= b; i++)
#define FD(i, a, b) for (ll i{a}; i >= b; i--)

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

const ll mod{static_cast<ll>(1e9) + 7};
const ld Pi{3.14159265358979323846};

auto int_from(istream &in) -> int
{
    int x;
    in >> x;
    return x;
}

auto lng_from(istream &in) -> ll
{
    ll x;
    in >> x;
    return x;
}

auto str_from(istream &in) -> string
{
    string x;
    in >> x;
    return x;
}

auto chr_from(istream &in) -> char
{
    char x;
    in >> x;
    return x;
}

int main()
{
    IOS;
    ll a{lng_from(cin)}, b{lng_from(cin)}, c{lng_from(cin)};
    if (c % 2)
    {
        if (a > b)
        {
            cout << ">\n";
        }
        else if (a < b)
        {
            cout << "<\n";
        }
        else
        {
            cout << "=\n";
        }
    }
    else
    {
        a = abs(a);
        b = abs(b);
        if (a > b)
        {
            cout << ">\n";
        }
        else if (a < b)
        {
            cout << "<\n";
        }
        else
        {
            cout << "=\n";
        }
    }
    return 0;
}

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

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

}


#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
// #define int long long
struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(3);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

using Int = __int128_t;
using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T&b){if(a<b)return(a=b,1);return 0;}
template<class T>bool chmin(T &a, const T&b){if(b<a)return(a=b,1);return 0;}

signed main() {

    int a, b, c, d;

    cin >> a >> b >> c >> d;

    cout << a * d - b * c << endl;

    return 0;
}

///Code by: Luis Alejandro
///Handle: Sekai
///Country: Cuba

#include <bits/stdc++.h>
#define endl '\n'

///Pragmas:
/*
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")
*/

using namespace std;

///Red-Black-Tree:
///*name.find_by_order(k-th position)
///name.order_of_key(key)
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,int,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_statistics;
*/

typedef unsigned long long ull;
typedef long long lld;
typedef long double ld;
typedef pair<int,int> pii;

const int MAXN=1e5+5;
const int MOD=1e9+7;
const int INF=1e9;
const ld PI=acos(-1);
const ld EPS=1e-9;

#define logx(a,b) (log(a)/log(b))
#define lcm(a,b) a/__gcd(a,b)*b
#define lg2(x) __lg(x)

int mod_pow(int a, int b){
    if(!b)return 1;
    if(b&1)return mod_pow(a,b-1)*a%MOD;
    int power=mod_pow(a,b>>1);
    return power*power%MOD;
}

int modular_inverse(int a){
    return mod_pow(a,MOD-2);
}

vector<int> movy={0,0,1,-1};
vector<int> movx={1,-1,0,0};

void solve(){
    int mat[2][2];
    for(int i=0;i<2;i++)for(int j=0;j<2;j++)cin>>mat[i][j];
    cout<<mat[0][0]*mat[1][1]-mat[0][1]*mat[1][0]<<endl;
}

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("IN.txt","r",stdin);
        //freopen("OUT.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include <bitset>
// #include <atcoder/all>
#include <fstream>
#include <random>
#include <cassert>

//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;
// using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e16;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const long double PI = 3.1415926535897932;

using Graph = vector<vector<ll>>;

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

	ll n;
	cin >> n;
	vector<ll> a(n), b(n), c(n), d(n), e(n);
	ll ma, mb, mc, md, me;
	ma = 0; mb = 0; mc = 0; md = 0; me = 0;

	ll an, bn, cn, dn, en;

	rep(i, n)
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i] >> e[i];
		if (ma < a[i])
		{
			ma = a[i];
			an = i;
		}
		if (mb < b[i])
		{
			mb = b[i];
			bn = i;
		}
		if (mc < c[i])
		{
			mc = c[i];
			cn = i;
		}
		if (md < d[i])
		{
			md = d[i];
			dn = i;
		}
		if (me < e[i])
		{
			me = e[i];
			en = i;
		}
	}

	ll aa, bb, cc, dd, ee;
	ll ans = 0;

	for (int i = 0; i < n-1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			aa = max(a[i], a[j]);
			bb = max(b[i], b[j]);
			cc = max(c[i], c[j]);
			dd = max(d[i], d[j]);
			ee = max(e[i], e[j]);

			ll check = 0;

			if (aa == min({ aa,bb,cc,dd,ee }))
			{
				check = an;
			}
			if (bb == min({ aa,bb,cc,dd,ee }))
			{
				check = bn;
			}
			if (cc == min({ aa,bb,cc,dd,ee }))
			{
				check = cn;
			}
			if (dd == min({ aa,bb,cc,dd,ee }))
			{
				check = dn;
			}
			if (ee == min({ aa,bb,cc,dd,ee }))
			{
				check = en;
			}

			aa = max(aa, a[check]);
			bb = max(bb, b[check]);
			cc = max(cc, c[check]);
			dd = max(dd, d[check]);
			ee = max(ee, e[check]);

			ans = max(ans, min({ aa,bb,cc,dd,ee }));
		}
	}

	cout << ans << endl;

	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 = 101;
const int C = 10101;
int n;
int S;
int dp[N][C];
int f[N];

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

	scanf("%d", &n);
	dp[0][0] = 1;
	S = 0;
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		for (int j = i; j >= 0; j--)
			for (int y = 0; y <= S; y++)
				dp[j + 1][y + x] = add(dp[j + 1][y + x], dp[j][y]);
		S += x;
	}
	if (S & 1) {
		printf("0\n");
		return 0;
	}
	f[0] = 1;
	for (int i = 1; i < N; i++)
		f[i] = mult(f[i - 1], i);
	int ans = 0;
	S /= 2;
	for (int k = 0; k <= n; k++)
		ans = add(ans, mult(mult(f[k], f[n - k]), dp[k][S]));
	printf("%d\n", ans);

	return 0;
}


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

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;

ld const PI = 4*atan((ld)1);

int main()
{
	fastio;

	int n, s, d;
	cin >> n >> s >> d;

	int x, y;
	bool res = false;

	for (int i = 0; i < n; ++i)
	{
		cin >> x >> y;
		if (x < s && y > d) res = true;
	}
	cout << (res ? "Yes\n" : "No\n");

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define reps(i, a, n) for (int i = (a); i < (n); ++i)
#define rep(i, n) reps(i, 0, n)
#define deps(i, a, n) for (int i = (a); i >= (n); --i)
#define dep(i, n) deps(i, n, 0)
#define inf 2147483647
#define int long long

signed main(void)
{
	int v, t, s, d; cin >> v >> t >> s >> d;
	if (v * t > d) cout << "Yes" << endl;
	else if (v * s < d) cout << "Yes" << endl;
	else cout << "No" << endl;
}


#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 4020000;
int dy[8] = {0,1,0,-1,1,-1,-1,1};
int dx[8] = {-1,0,1,0,1,-1,1,-1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    int sz = a.size();
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr;
        sz--;
        if(sz) cout << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll b,c; cin >> b >> c;
    ll ans = 1;
    if(b > 0){
        ans += (c-2) / 2;
        ans += (c-1) / 2;
        ans += min(b,c/2);
        ans += min(b-1,(c-1)/2);
        ans++;
    }else if(b < 0){
        b = abs(b);
        ans += (c-1) / 2;
        ans += c / 2;
        ans += min(b,(c-1)/2);
        ans += min(b-1,(c-2)/2);
        ans++;
    }else{
        ans += c / 2;
        ans += (c-1) / 2;
    }
    cout << ans << "\n";
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(),a.end()
typedef pair<ll,ll> pi;

//__builtin_popcountll(2) (the number of ones in the binary representation)
//__builtin_clz(2) (number of leading zeroes)
//__builtin_ctz(2) (number of trailing zeroes)

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

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>*/
// s.find_by_order(k)(returns iterator to kth element), s.order_of_key(k)(number of elements less than number)

ll mod = 1e9+7;
vector<ll> fact(1);
/*vector<ll> spf(10000005), cntPrime(10000005);

void spff(){
    int i;
    for(i=1;i<10000005;i++) spf[i] = i;
    for(i=2;i*i<10000005;i++)
    {
        if(spf[i] != i) continue;
        for(int j = i*i; j < 10000005; j+= i){
            if(spf[j]==j) spf[j] = i;
        }
    }
    for(i=1;i<10000005;i++){
        if(spf[i] != spf[i/spf[i]]){
            cntPrime[i] = cntPrime[i/spf[i]]+1;
        }
        else cntPrime[i] = cntPrime[i/spf[i]];
    }
}
while(spf[a[i]]!=a[i]){
              z=spf[a[i]];
              while(a[i]%z==0) a[i]/=z;
              m[z]++;
          }
          if(a[i]>1) m[a[i]]++;*/

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

ll power(ll x, ll y)
{
    ll temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}

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

ll modInv(ll n, ll p)
{
    return power(n, p - 2, p);
}

ll ncr(ll n, ll r) {return (n>=r?(fact[n]*modInv(fact[r],mod))%mod*modInv(fact[n-r],mod)%mod:0);}

ll add(ll a, ll b) {ll z=a+b; if(z>=mod) z -= mod; return z;}
ll mul(ll a, ll b) { return (a*b)%mod;}
ll sub(ll a, ll b) { return (a-b+mod)%mod;}
// LLONG_MAX

int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  ll t=1,i,j;
  db z,n;
  //cin>>t;
  //fact[0]=1;
  //for(i=1;i<300003;i++)fact[i]=(fact[i-1]*i)%mod;
  while(t--)
  {
      cin>>z>>n;
      ll b=z;
      z=z/100;
      ll c=ceil(n/z);
      //cout<<c<<' ';
      cout<<(ll)(c+n-1);
  }
}


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

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;

void INX(){}
template<typename Head, typename... Tail>
void INX(Head&& head, Tail&&... tail)
{
    cin >> head;
    INX(forward<Tail>(tail)...);
}
void OUTX(){}
template<typename Head, typename... Tail>
void OUTX(Head&& head, Tail&&... tail)
{
    cout << head << endl;
    OUTX(forward<Tail>(tail)...);
}
void OUTX2(){cout << endl;}
template<typename Head, typename... Tail>
void OUTX2(Head&& head, Tail&&... tail)
{
    cout << head << ' ';
    OUTX2(forward<Tail>(tail)...);
}

#define ADD emplace_back
#define MP make_pair
#define __LONG_LONG_MIN__ (-__LONG_LONG_MAX__ - 1)

#define MOD 998244353
//setprecision(10)

class UnionFind
{
    private:
    vll parent;

    public:
    UnionFind(ll N) : parent(N)
    {
        for (ll i = 0; i < N; i++) parent[i] = i;
    }

    ll GetParent(ll x)
    {
        return (parent[x] == x ? x : (parent[x] = GetParent(parent[x])));
    }

    void Unite(ll x, ll y)
    {
        ll rx = GetParent(x);
        ll ry = GetParent(y);
        if(rx != ry) parent[rx] = ry;
    }

    bool IsUnited(ll x, ll y)
    {
        return GetParent(x) == GetParent(y);
    }
};

int main()
{
    ll N;
    INX(N);

    vll f(N);
    UnionFind uf(N);
    for (ll i = 0; i < N; i++)
    {
        INX(f[i]);
        f[i]--;
        uf.Unite(i, f[i]);
    }

    set<ll> s;
    for (ll i = 0; i < N; i++)
    {
        s.emplace(uf.GetParent(i));
    }

    ll result = 1;
    for (ll i = 0; i < s.size(); i++)
    {
        result <<= 1;
        result %= MOD;
    }
    result = (result == 0 ? MOD : result) - 1;
    OUTX(result);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[310000];
int main()
{
	int n;
	cin>>n;
	long long s=0;
	bool xiangtong=1;
	for(int i=1;i<=n;i++)
	{
	cin>>a[i];
	s+=a[i];
	if(a[i]!=a[i-1])
	xiangtong=0;
    }
    if(xiangtong==1)
    {
    	cout<<0;
    	return 0;
	}
	long long sum=0;
	for(int i=1;i<=n;i++)
	sum+=(a[i]*(s-a[i]));
	long long dev=0;
	for(int i=1;i<=n;i++)
	dev+=(a[i]*a[i]);
	dev*=(n-1);
	long long a=dev-sum;
	cout<<a;
	return 0;
}

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

#define int long long

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

    int t;
    cin >> t;
    int sq=0 , sum=0;
    int n = t;
    while (t--){
        int temp ;
        cin >> temp;
        sq += (temp*temp);
        sum += temp;
    }
    int ans = (n*sq) - (sum*sum);
    cout << ans << endl;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deb(x) cout << #x << " " << x << endl;
#define mod 1000000007
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(v) v.rbegin(), v.rend()
const ll INF = 1e18;
//const ll NEGINF = -1 * INF;
const ll N = 1e6 + 1;

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

ll my_pow(ll a, ll n, ll m = INF)
{
    ll res = 1;
    while (n)
    {
        if (n % 2)
        {
            res = (res * a) % m;
            n--;
        }
        a = (a * a) % m;
        n /= 2;
    }
    return res;
}

void solve()
{
    ll N;
    cin >> N;
    vector<pair<ll, ll>> edge(N - 1);
    vector<vector<ll>> g(N);
    for (ll i = 0; i < N - 1; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        edge[i] = {a, b};
    }
    vector<ll> depth(N, -1);
    depth[0] = 0;
    vector<ll> q = {0};
    while (q.size())
    {
        ll at = q.back();
        q.pop_back();
        for (ll i : g[at])
            if (depth[i] == -1)
            {
                depth[i] = depth[at] + 1;
                q.push_back(i);
            }
    }
    vector<ll> s(N);
    ll Q;
    cin >> Q;
    while (Q--)
    {
        ll t, e, x;
        cin >> t >> e >> x;
        auto [a, b] = edge[e - 1];
        if (depth[a] > depth[b])
        {
            swap(a, b);
            t ^= 3;
        }
        if (t == 1)
        {
            s[0] += x;
            s[b] -= x;
        }
        else
            s[b] += x;
    }
    q = {0};
    while (q.size())
    {
        ll at = q.back();
        q.pop_back();
        for (ll i : g[at])
            if (depth[at] < depth[i])
            {
                s[i] += s[at];
                q.push_back(i);
            }
    }
    for (ll i : s)
        cout << i << endl;
}

int main()
{
    fast;
#ifndef ONLINE_JUDGE
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/input.txt", "r", stdin);
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/output.txt", "w", stdout);
#endif
    int T = 1;
    while (T--)
    {
        solve();
    }
    //cout<< "Done in " << clock() / CLOCKS_PER_SEC <<"sec"<< endl;
    return 0;
}

#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef struct Node{
	int depth;
	vector<int> adj;
	ll val;
	bool imos;
}Node;

void det_depth(vector<Node> &tree, int id, int depth){
	if(tree[id].depth != -1)return;
	tree[id].depth = depth;
	for(auto v : tree[id].adj){
		det_depth(tree, v, depth+1);
	}
}

void imos(vector<Node> &tree, int id, ll sum){
	if(tree[id].imos)return;
	tree[id].imos = true;
	tree[id].val += sum;
	for(auto v : tree[id].adj){
		imos(tree, v, tree[id].val);
	}
}

signed main()
{
	int N;
	cin >> N;
	vector<pair<int, int>> edge(N);
	vector<Node> tree(N);
	REP(i, N-1){
		int a, b;
		cin >> a >> b;
		edge[i] = (MP(a-1, b-1));
		tree[i].val = 0;
		tree[i].depth = -1;
		tree[i].imos = false;
		tree[a-1].adj.PB(b-1);
		tree[b-1].adj.PB(a-1);
	}
	tree[N-1].val = 0;
	tree[N-1].depth = -1;
	tree[N-1].imos = false;
	det_depth(tree, 0, 0);
	int Q;
	cin >> Q;
	REP(i, Q){
		int t, e, x;
		cin >> t >> e >> x;
		int a = edge[e-1].F, b = edge[e-1].S;
		if(tree[b].depth<tree[a].depth){
			int tmp = a;
			a = b;
			b = tmp;
			if(t == 1){
				t = 2;
			}else{
				t = 1;
			}
		}
		if(t == 1){
			tree[0].val += x;
			tree[b].val -= x;
		}else{
			tree[b].val += x;
		}
	}
	imos(tree, 0, 0);
	for(auto v : tree){
		cout << v.val << endl;
	}
}


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

using namespace std;

int N;
unsigned long long X;
unsigned long long A[50];
unsigned long long Amul[49];
long long base[50];

void A_to_Amul() {
    Amul[0] = A[0];
    for (int i = 0; i < N-1; i++) {
        Amul[i] = A[i+1] / A[i];
    }
}

void X_to_base(unsigned long long X) {
    for (int i = 0; i < N - 1; i++) {
        base[i] = X % Amul[i];
        X = (X - base[i]) / Amul[i];
    }
    base[N-1] = X;
}

void print_Amul() {
    for (int i = 0; i < N-1; i++) {
        cout << Amul[i] << " ";
    }
    cout << endl;
}

void print_base() {
    for (int i = 0; i < N; i++) {
        cout << base[i] << " ";
    }
    cout << endl;
}

unsigned long long ans[50];

int main() {
    cin >> N >> X;
    for (int i = 0; i < N; i++) cin >> A[i];

    A_to_Amul();
//    print_Amul();

    X_to_base(X);
//    print_base();

    vector<int> vld_fsts, vld_lsts;
    for (int i = 0; i < N-1; i++) {
        if (base[i] > 0) vld_lsts.push_back(i);
    }
    for (int i = 1; i < N-1; i++) {
        if (base[i] < Amul[i] - 1) vld_fsts.push_back(i);
    }
    vld_fsts.push_back(N-1);

//    cout << "fst = ";
//    for (int i = 0; i < vld_fsts.size(); i++) {
//        cout << vld_fsts[i] << " ";
//    }
//    cout << endl;
//
//    cout << "lst = ";
//    for (int i = 0; i < vld_lsts.size(); i++) {
//        cout << vld_lsts[i] << " ";
//    }
//    cout << endl;

    ans[0] = 0;
    for (int f = 1; f < N; f++) {
        ans[f] = ans[f-1];
        auto it_fst = find(vld_fsts.begin(), vld_fsts.end(), f);
        if (it_fst == vld_fsts.end()) {
            continue;
        }
        for (int l = f-1; l >= 0; l--) {
            auto it_lst = find(vld_lsts.begin(), vld_lsts.end(), l);
            if (it_lst != vld_lsts.end()) {
                ans[f] += 1 + (l >= 1 ? ans[l-1] : 0);
            }
        }
    }

//    for (int i = 0; i < N; i++) {
//        cout << ans[i] << " ";
//    }
//    cout << endl;

    cout << ans[N-1] + 1;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) { os << ','; }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define repl(i, a, b) for(int i = a; i < int(b); i++)
#define rep(i, n) repl(i, 0, n)
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

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

    vector<map<ll, ll>> dp(60);
    dp[0][X] = 1;

    rep(i, N) {
        for(const auto &[j, val] : dp[i]) {
            if(i < N - 1) {
                ll r = j % a[i + 1];
                dp[i + 1][j - r] += val;
                if(r > 0) dp[i + 1][j + a[i + 1] - r] += val;
            } else {
                dp[i + 1][0] += val;
            }
        }
    }

    cout << dp[N][0] << "\n";
}


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

using namespace __gnu_pbds;
using namespace std;

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

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

#define mp make_pair

const int MOD =  998244353;

int mul(int a, int b) {
    return (1LL * a * b) % MOD;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=MOD) s-=MOD;
    return s;
}

int sub(int a, int b) {
    int s = (a+MOD-b);
    if (s>=MOD) s-=MOD;
    return s;
}

int po(int a, ll deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, MOD-2);
}

mt19937 rnd(time(0));

/*
const int LIM = 1e6 + 5;

vector<int> facs(LIM), invfacs(LIM);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<LIM; i++) facs[i] = mul(facs[i-1], i);
    invfacs[LIM-1] = inv(facs[LIM-1]);
    for (int i = LIM-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

/*struct DSU
{
    vector<int> sz;
    vector<int> parent;
    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        else
        {
            auto par = find_set(parent[v]);
            parent[v] = par;
            return par;
        }
    }

    void union_sets(int a, int b) {
        find_set(a);
        find_set(b);

        a = find_set(a);
        b = find_set(b);

        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        };
    }

    DSU (int n)
    {
        parent.resize(n);
        sz.resize(n);
        for (int i = 0; i<n; i++) make_set(i);
    }
};*/

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

    int n, m; cin>>n>>m;

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

    for (int i = 1; i<=m; i++)
    {
        degs[i][0] = 1;
        for (int j = 1; j<=n; j++) degs[i][j] = mul(degs[i][j-1], i);
    }

    ll tot = mul(n, degs[m][n]);
    for (int len = 1; len<=n-1; len++)
    {
        int sum = 0;
        for (int val = 1; val<=m; val++)
        {
            if (val==m && len>1) continue;
            //probability = 1/m^2 + (m - val)^(len-1)
            int cnt = degs[m][n - len - 1];
            if (len>=2) cnt = mul(cnt, degs[m - val][len-1]);
            sum = add(sum, cnt);
        }
        tot = sub(tot, mul(sum, n-len));
    }

    cout<<tot;

}

/*
f(n, m) = f(n, m-1) + //Case when there are several ones

 */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
const double PI = acos(-1.0);
/*const double PI = atan2(0.0,-1.0)*/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i,aa,n) for(ll i = aa; i <= (ll)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define ar_init(aa,val) rep(i,aa.size()) aa[i]=val;
#define v2d(aa,val1,val2,ini) vector<vector<ll>> aa(val1,vector<ll>(val2,ini));
#define pqe priority_queue<ll>
#define pqeg priority_queue<ll,vector<ll>,greater<ll>>
#define lcin(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define eout(...) COU(__VA_ARGS__);
#define sout(...) SCOU(__VA_ARGS__);
#define scin(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define lb(aa,val) lower_bound(ALL(aa),val)
#define pb push_back
#define mkp make_pair
#define si size()

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}

void COU(){}
template <class Head,class... Tail>
void COU(Head&& head,Tail&&... tail){
    cout<<head<<endl;
    COU(move(tail)...);
}

void SCOU(){}
template <class Head,class... Tail>
void SCOU(Head&& head,Tail&&... tail){
    cout<<head<<" ";
    SCOU(move(tail)...);
}

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

using pii = pair<ll,ll>;
using v2 = vector<vector<ll>>;
using v1 = vector<ll>;
using v2p = vector<vector<pii>>;
using v1p = vector<pii>;
//ll mo=1000000007;
ll mo=998244353;

ll mod_pow(ll N,ll n){
if(n==0) return 1;
ll pp,hh;
pp=n/2;
hh=n%2;
int tt=mod_pow(N,n/2);
if(hh==0)return tt%mo*tt%mo;
else {return tt%mo*tt%mo*N%mo;}
}

ll pp[6000][6000];
int main(){
//cout<<fixed<<setprecision(15);

lcin(n,m);

rep1(i,1,m){
pp[i][0]=1;
rep1(k,1,n){
pp[i][k]=pp[i][k-1]*i;
pp[i][k]%=mo;
}
}

ll res=0;

rep1(i,1,m){
rep1(k,1,n){
if(k+2<=n){res+=pp[m][n-k-2]*(pp[m-i+1][k]-pp[m-i][k])%mo*max((ll)0,n-k+1-2)*(i-1)%mo*(i-1)%mo;
}
if(k!=n){res+=2*pp[m][max((ll)0,n-k-1)]*(pp[m-i+1][k]-pp[m-i][k])%mo*(i-1)%mo;
}
if(k==n){res+=pp[m-i+1][k]-pp[m-i][k];
res%=mo;
}

}
}

eout(res);
}


#line 1 "main_a.cpp"
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

/* template start */

#line 2 "/home/imperi/cp-library/lib/utility/type_alias.hpp"

#line 4 "/home/imperi/cp-library/lib/utility/type_alias.hpp"

using u64 = std::uint64_t;
using u32 = std::uint32_t;
using u16 = std::uint16_t;
using u8 = std::uint8_t;

using i64 = std::int64_t;
using i32 = std::int32_t;
using i16 = std::int16_t;
using i8 = std::int8_t;

using usize = std::size_t;
using isize = std::ptrdiff_t;

constexpr i64 operator"" _i64(unsigned long long num) { return i64(num); }

constexpr u64 operator"" _u64(unsigned long long num) { return u64(num); }
#line 33 "main_a.cpp"

#define rep(i, a, b) for (i64 i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...)                                                    \
  std::cerr << "LINE: " << __LINE__ << "  [" << #__VA_ARGS__ << "]:", \
      debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << std::endl; }

template <typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
  std::cerr << " " << h;
  if (sizeof...(t) > 0) std::cerr << " :";
  debug_out(t...);
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}

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

template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b) {
  return a > b && (a = b, true);
}

template <typename Num, typename Func = std::multiplies<Num>>
constexpr Num mypow(Num a, u64 b, Num id = 1, Func mul = Func()) {
  if (b == 0) return id;
  Num x = id;
  while (b > 0) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}

/* template end */

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

  i64 t,n;
  std::cin>>t>>n;
  n--;

  std::set<i64> set;

  rep(i,0,100+t)set.emplace(i);

  rep(i,0,100){
    set.erase((100+t)*i/100);
  }

  i64 ans = 0;

  i64 m = set.size();

  ans += (100+t) * (n/m);
  n%=m;

  auto itr = set.begin();
  std::advance(itr,n);
  ans+=*itr;

  std::cout<<ans<<"\n";

  return 0;
}

//#define MULTICASES
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(i=(a);i<=(b);++i)
#define per(i,a,b) for(i=(a);i>=(b);--i)
#define REP(i,a,b) for(i=(a);i< (b);++i)
#define PER(i,a,b) for(i=(a);i> (b);--i)
#define ERR(...) fprintf(stderr,__VA_ARGS__)
inline void ac();
int main(){
#ifdef MULTICASES
	int t;scanf("%d",&t);while(t--)ac();
#else
	ac();
#endif
	return 0;
}
inline void ac(){
	int t,n;
	scanf("%d%d",&t,&n);
	ll a=((n-1)/t)*100ll;
	ll b=((n-1)/t)*(t+100ll);
	n-=(n-1)/t*t;
	ERR("%lld %lld %d\n",a,b,n);
	do{
		++a;
		do{
			if((++b)==a*(t+100ll)/100ll)break;
			if(!(--n)){printf("%lld\n",b);return;}
		}while(true);
	}while(true);
}
/*
0. int overflow, array bounds
1. special cases (n=1? n=0?)
2. do smth instead of nothing and stay organized
3. WRITE STUFF DOWN
4. DON'T GET STUCK ON ONE APPROACH
5. STAY CALM AND DON'T GET EXPLODED
*/


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, m, n) for (ll i = m; i < n; i++)
#define rrep(i, m, n) for (ll i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(), n.end())
#define HOUT(S) cout << setprecision(50) << S << endl
#define pint pair<ll, ll>
#define paf(L, R) pair<L, R>
#define mod 998244353
#define MAX 10000010
#define endl "\n"
#define ALL(a) a.begin(), a.end()
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))

template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type fill_v(U& u, const V... v) {
    u = U(v...);
}

template <typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    bool flag = true;
    rep(i, 0, S.size()) {
        if(i % 2 == 0) {
            if(S[i] < 'a') flag = false;
        }
        else {
            if(S[i] >= 'a') flag = false;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	int n;
	cin >> n;
	int ar[n];
	for (int i = 0; i < n; i++) {
		cin >> ar[i];
	}
	int sol = 2e9;

	for (int msk = 0; msk < (1<<n); msk++) {
		vector<int> cur;
		int a = 0;
		for (int i = 0; i < n; i++) {
			a |= ar[i];
			if ((msk>>i) & 1) {
				cur.push_back(a);
				a = 0;
			}
		}
		cur.push_back(a);
		int b = 0;
		for (auto x : cur) b ^= x;
		sol = min(sol, b);
	}
	cout << sol << '\n';
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD int(1e9+7)
#define INF int(1e9+7)
#define LINF ll(1e18+7)
#define PI acos(-1)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<ll,ll>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

int n;
int x[20];
int y[20];
int z[20];
int dp[1<<20][20];
int c[20][20];

int main(){
  cin>>n;
  rep(i,n) cin>>x[i]>>y[i]>>z[i];
  rep(i,n)rep(j,n){
    c[i][j]=abs(x[j]-x[i])+abs(y[j]-y[i])+max(z[j]-z[i],0);
  }
  rep(i,1<<n)rep(j,n) dp[i][j]=INF;
  dp[1][0]=0;
  for(int S=2; S<(1<<n); S++){
    rep(i,n){
      if(S>>i&1){
        int T=S-(1<<i);
        rep(j,n){
          if(T>>j&1) chmin(dp[S][i],dp[T][j]+c[j][i]);
        }
      }
    }
  }
  int ans=INF;
  rep(i,n) chmin(ans,dp[(1<<n)-1][i]+c[i][0]);
  cout<<ans<<endl;
}

#include<bits/stdc++.h>
#define ll  long long int
#define db long double
#define ull unsigned long long int
// #define mp make_pair
#define pii pair<ll,ll>
#define F first
#define S second
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
#define Nmax 1000005
#define INF 1000000000000000000
#define MOD 1000000007
#define MAXN 10000
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

using namespace std;

ll mod=1e7+7;
ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}

ll seg[2000005];
ll lazy[2000005];
map<ll,ll>cod;

void push(ll v)
{
	if(lazy[v]==0) return;
	seg[2*v]+=lazy[v];
	lazy[2*v]+=lazy[v];
	seg[2*v+1]+=lazy[v];
	lazy[2*v+1]+=lazy[v];
	lazy[v]=0;
}

void update(ll v,ll tl,ll tr,ll l,ll r,ll val)
{
	if(l>tr || r<tl) return;
	if(l<=tl && tr<=r)
	{
		seg[v]+=val;
		lazy[v]+=val;
		return;
	}
	push(v);
	ll tm=(tl+tr)/2;
	update(2*v,tl,tm,l,r,val);
	update(2*v+1,tm+1,tr,l,r,val);
	seg[v]=min(seg[2*v],seg[2*v+1]);
}

ll query(ll v,ll tl,ll tr,ll l,ll r)
{
	if(tl>r || l>tr) return INF;
	// push(v);
	if(l<=tl && tr<=r)
	{
		return seg[v];
	}
	push(v);
	ll tm=(tl+tr)/2;
	return min(query(2*v,tl,tm,l,r),query(2*v+1,tm+1,tr,l,r));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int tests=1;
    // cin>>tests;
    while(tests--)
    {
    	ll i,j,n;
    	cin>>n;
    	vector<ll>a(n);
    	rep(i,0,n-1) cin>>a[i];
    	map<ll,ll>mpp;
    	rep(i,0,n-1) mpp[a[i]]++;
    	while(mpp.size()>1)
    	{
    		ll mn,mx;
    		ll secmx;
    		auto itr=mpp.begin();
    		mn=itr->first;
    		itr=mpp.end();
    		itr--;
    		mx=itr->first;
    		// mpp[mx]--;
    		// ll cnt=mpp[mx];
    		mpp.erase(mx);
    		// mpp[mx-mn]++;
    		itr--;
    		secmx=itr->first;
    		ll tmp=(mx-secmx+mn-1)/mn;
    		mx=mx-tmp*mn;
    		mpp[mx]++;
    	}
    	cout<<mpp.begin()->first;
    }
    time
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pld = pair<ld,ld>;
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
#define _GLIBCXX_DEBUG
#define rep(j, m) for (int j = 0; j < (int)(m); j++)
#define rep2(i, l, n) for (int i = l; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
const ld PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main() {
	ll N;
	cin >> N;
	vll W(N);
	rep(i,N) {cin >> W[i];}
	vll V(N);
	ll sum = 0;
	rep(i,N) {
		V[i] = W[i] - i - 1;
		sum += abs(V[i]);
	}
	if (sum == (N - 1)*2) {
		ll flag = 0;
		vll X = V;
		vll Y(N - 1,0);
		rep(i,N - 1) {
			ll a = i;
			while(a >= 0 && X[a] > 0 && X[a + 1] < 0) {
				swap(X[a],X[a + 1]);
				X[a]++;
				X[a + 1]--;
				Y[a]++;
				a--;
			}
		}
		rep(i,N - 1) {if (X[i] != 0 || Y[i] != 1) {flag++;}}
		if (flag != 0) {cout << -1 << endl;}
		else {
			rep(i,N - 1) {
				ll a = i;
				while(a >= 0 && V[a] > 0 && V[a + 1] < 0) {
					swap(V[a],V[a + 1]);
					V[a]++;
					V[a + 1]--;
					cout << a + 1 << endl;
					a--;
				}
			}
		}
	}
	else {cout << -1 << endl;}

}

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

#define REP(i,N) for(int (i)=0;(i)<(N);(i)++)
#define REP2(i,a,N) for(int (i)=(a);(i)<(N);(i)++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

#include <iomanip>
using namespace std;
using ll = long long;
ll gcd(ll x, ll y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    return ll(x / gcd(x, y)) * y;
}

vector< int > divisor(int n) {
    vector< int > ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return ret;
}
template<class T>
auto comp_idx(T& ptr) {
    return [ptr](int l_idx, int r_idx) {
        return ptr[l_idx] < ptr[r_idx];
    };
}
//std::sort(IndA.begin(), IndA.end(), comp_idx(A));

int main() {
    string N;
    cin >> N;
    int index = N.size()-1;
    for (int i = N.size() - 1; i >= 0; i--) {
        if (N[i] == '0') {
            index--;
        }
        else break;
    }
    if (index == 0) {
        cout << "Yes";
        return 0;
    }
    for (int i = 0; i < N.size() / 2; i++) {
        if (N[i] != N[index - i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define FOR(i,a,b) for(int i = a;i<=b;i++)
using namespace std;
const double e = 1e-9;
int n;
typedef pair<int,int> ii ;
ii A[105] ;
vector<int> G[200] ;
int dd[200] ;

double dist(ii a,ii b){
    return sqrt( (a.fi-b.fi)*(a.fi-b.fi) + (a.se-b.se)*(a.second-b.second) ) ;
}
void dfs(int u){
    dd[u] = 1;
    for(int v:G[u]) if(!dd[v]) dfs(v) ;
}
bool check(double R)
{
    FOR(i,0,n+1) G[i].clear() ,dd[i] = 0 ;
    // 0 and n+1
    FOR(i,1,n) {
        if(100-A[i].se < R*2) {
                G[0].push_back(i) ;
                G[i].push_back(0) ;
        }
        if(A[i].se + 100 < R*2) {
                G[n+1].push_back(i) ;
                G[i].push_back(n+1) ;
        }
    }
    FOR(i,1,n)
    FOR(j,i+1,n) {
        if(dist(A[i],A[j]) < 2.0*R) {
            G[i].push_back(j);
            G[j].push_back(i);
        }
    }
    dfs(0) ;
    if(dd[n+1]==1) return false;
    return true ;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> A[i].fi >> A[i].se ;

    double L =0 , R = 100,res = 0;
    while(L<R-e)
    {
        double mid = (L+R)/2.0 ;
        if(check(mid)) res = mid , L = mid ;
        else R = mid ;
    }
    cout << res ;
}

#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

const int kMaxN = 101;

struct P {
  double d;
  int x, y;
  bool b;
} p[kMaxN];

int n, s;
double ans = 1e9;

double D(int i, int j) {
  return sqrt(pow(p[i].x - p[j].x, 2) + pow(p[i].y - p[j].y, 2));
}

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].x >> p[i].y;
    p[i].d = p[i].y + 100;
  }
  for (int i = 1; i <= n; i++) {
    s = 0;
    for (int j = 1; j <= n; j++) {
      if (!p[j].b) {
        if (!s || p[s].d > p[j].d) {
          s = j;
        }
      }
    }
    p[s].b = 1;
    for (int j = 1; j <= n; j++) {
      if (!p[j].b) {
        p[j].d = min(p[j].d, max(p[s].d, D(s, j)));
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    ans = min(ans, max(p[i].d, 100.0 - p[i].y));
  }
  cout << setprecision(8) << fixed << ans / 2;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>         vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)            for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;
const double EPS = 1e-7;
const double PI = acos(-1);

struct dsu {
  vector<mii> y;
  vi id, sz;

  dsu(int n) : y(n), id(n), sz(n, 1) {
    loop(n) {
      int c;
      cin >> c;
      y[i][c] = 1;
      id[i] = i;
    }
  }

  int find(int x) {
    return x == id[x] ? x : id[x] = find(id[x]);
  }

  bool join(int a, int b) {
    a = find(a);
    b = find(b);
    if (a == b) return false;
    if (sz[a] > sz[b]) swap(a, b);
    id[a] = id[b];
    sz[b] += sz[a];
    for (auto& [k, v] : y[a]) {
      y[b][k] += v;
    }
    y[a].clear();
    return true;
  }
};

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

  int n, q;
  cin >> n >> q;
  dsu uf(n);
  int op, a, b;
  loop(q) {
    cin >> op >> a >> b;
    if (op == 1) uf.join(a - 1, b - 1);
    else cout << uf.y[uf.find(a - 1)][b] << endl;
  }
  return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long
//UF
struct UnionFind {
    vector<int> par, siz;
    // 初期化
    UnionFind(int n) : par(n, -1) , siz(n, 1) { }
    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        par[y] = x;
        siz[x] += siz[y];
        return true;
    }
    int size(int x) {
        return siz[root(x)];
    }
};
signed main(){
  int N,Q;cin>>N>>Q;
  vector<map<int,int>>mp(N);
  for(int i=0;i<N;i++){
    int a;cin>>a;
    mp[i][a-1]=1;
  }
  UnionFind uf(N);
  while(Q--){
    int a,b,c;cin>>a>>b>>c;
    b--;c--;
    if(a==1){
      int d=uf.root(b),e=uf.root(c);
      if(d!=e){
        uf.unite(d,e);
        int f=uf.root(d);
        if(d!=f){
          swap(d,e);
        }
        for(auto j:mp[e]){
          mp[d][j.first]+=j.second;
        }
      }
    }
    else{
      cout<<mp[uf.root(b)][c]<<endl;
    }
  }
}


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

#define ll long long int
#define pb push_back
#define CR7 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<ll, ll>
#define mod 1000000007
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll, ll>
//RRMMMMMMMMMRRRRRRRRRR!!

int main()
{
    CR7;
    ll t;
    cin>>t;
    while (t--)
    {
    ll a,b;
    cin>>a>>b;
    ll d = 2*a;
    if(d>b)
       cout<<"0\n";
    else
    {
        if(d==b)
           cout<<"1\n";
        else
           {
               if(b%2)
               {
                  b=b-1;
                  ll p = d/2;
                  ll r = b/2;
                  ll dif = r - p + 1;
                  ll w = (2*dif) -1;
                  cout<<((w*(w+1))/2) + w+1<<endl;
               }
               else
               {
                  ll p = d/2;
                  ll r = b/2;
                  ll dif = r - p + 1;
                  ll w = (2*dif) -1;
                  cout<<((w*(w+1))/2)<<endl;
               }
           }
    }
    }
    return 0;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 1001;

int A[N], B[N];
int dp[N][N];
int n,m;

int solve(int x, int y) {
  if(x == n) {
    return m - y;
  }

  if(y == m) {
    return n - x;
  }

  int &res = dp[x][y];
  if(res != -1) {
    return res;
  }

  res = n + m - x - y;
  res = min(res, 1 - (A[x] == B[y]) + solve(x + 1, y + 1));
  res = min(res, 1 + solve(x, y + 1));
  res = min(res, 1 + solve(x + 1, y));
  return res;
}

int main() {
  S2(n,m);
  rep(i,0,n) S(A[i]);
  rep(i,0,m) S(B[i]);
  memset(dp, -1, sizeof(dp));
  int ans = solve(0, 0);
  P(ans);
}