#include <iostream>

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

#define ff first
#define ss second
#define REP(i,st,en) for (int i = st; i <= en; i++)
#define REPR(i,st,en) for (int i = st; i >= en; i--)

const int MOD = 1e9 + 7;

class MainClass {
public:

	void solve() {

		long long l, r; cin >> l >> r;

		if (l > r - l) {
			cout << 0;
			return;
		}
		long long ans = (r - l + 1) * (r - 2 * l + 1);
		ans -= ((r - l) * (r - l + 1)) / 2;
		ans += (l * (l - 1)) / 2;
		// for (long long b = l; b <= r; b++) {
		// 	long long max_c = r - b;
		// 	if (max_c < l) break;
		// 	ans += (max_c - l + 1);
		// }

		cout << ans;
		return;
	}
};

int main() {

	int test = 1; cin >> test;
	for (int tst = 1; tst <= test; ++tst) {
		MainClass Ausmosian;

		Ausmosian.solve();
		cout << "\n";
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define vi vector<int>
#define mk make_pair
#define vll vector<long long >
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define loopr(i,a,b) for(int i=b;i>=a;i--)
#define vii vector<vector<int>>
#define ll long long
void io()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

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

	while (t--) {
		int l, r;
		cin >> l >> r;
		ll ans = 0;
		int maxx = r - 2 * l + 1;
		if (maxx <= 0)
			ans = 0;
		else
			ans = (maxx * ((ll)maxx + 1 )) / 2;

		cout << ans << endl;

	}

	return 0;
}


//デバッグ用オプション：-fsanitize=undefined,address

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//インクルードなど
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
//FORAは範囲for文(使いにくかったら消す)
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

/*
ビット全探索
for(int bit=0;bit<(1<<n);bit++){
        for(int i=0;i<n;i++){
            if(bit & (1<<i)){
            }
        }
*/

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

signed main(){
    //小数の桁数の出力指定
    //cout<<fixed<<setprecision(10);
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    double a,b;
    cin>>a>>b;
    if(b==0||a==0){
        cout<<0<<endl;
        return 0;
    }
    cout<<fixed<<setprecision(10)<<b/100*a<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define ll long long
int main(){
    double a,b;cin >> a >> b;
    cout << setprecision(20) << a*b/100.0 << endl;
}


#include <algorithm>
#include <bitset>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define INF 0x3f3f3f3f
#define MOD 1000000007

using namespace std;
typedef long long ll;

mt19937 rng(random_device{}());
mt19937_64 rng64(random_device{}());

template <typename T> void read(T &x) {
  x = 0;
  char c = getchar();
  T sig = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-')
      sig = -1;
  for (; isdigit(c); c = getchar())
    x = (x << 3) + (x << 1) + c - '0';
  x *= sig;
}

class Solution {
public:
  void solve() {
    int n;
    ll x;
    read(n);
    read(x);
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
      read(a[i]);
    unordered_map<ll, ll> v;
    v[x] = 1;
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
      unordered_map<ll, ll> nv;
      for (auto [c, f] : v) {
        if (c == 0)
          continue;
        if (i + 1 < n) {
          ll rem = c % a[i + 1];
          nv[c - rem] += f;
          if (rem > 0)
            nv[c + a[i + 1] - rem] += f;
        } else {
          if (c % a[i] == 0)
            nv[0] += f;
        }
      }
      v = move(nv);
      ans += v[0];
      v.erase(0);
    }
    cout << ans;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution solution = Solution();
  solution.solve();
}

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

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

#define pb                    push_back
#define ll                    long long
#define ld                    long double
#define sz(x)                 (ll)x.size()
#define vll                   vector<long long>

#define infi                  INT_MAX
#define infl                  LONG_LONG_MAX
#define infd                  LDBL_MAX
#define f(i,a,b)              for(ll i=a;i<b;i++)
#define fi(i,a,b)             for(ll i=(b-1);i>=a;i--)
#define F                     first
#define S                     second
#define G(a,b)                get<a>(b)
#define MP                    make_pair
#define MT                    make_tuple
#define pll                   pair<ll,ll>
#define endl                  "\n"
#define ALL(v)                v.begin(),v.end()
#define nl                    cout<<"\n";
#define pr(x)                 cout<<x;
#define pr1(x)                cout<<x<<" ";
#define pr2(x,y)              cout<<x<<" "<<y;
#define pr3(x,y,z)            cout<<x<<" "<<y<<" "<<z;
#define pr4(x,y,z,w)          cout<<x<<" "<<y<<" "<<z<<" "<<w;
#define deb                   cout<<"***************************************************************************************\n";
#define moshi                 cout<<"moshi moshi ! \n";
#define hi                    cout<<"hi ! \n";
#define bye                   cout<<"bye bye ! \n";
#define kawai                 cout<<"O kawai koto ! \n";
#define o_set                 tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define number_of_set_bits  __builtin_popcountll
#define eb                    emplace_back
const ld PI=3.1415926535897932384626433;

auto clk=clock();
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 <<"\n";
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

//**********************************************************  Code begins  ***********************************************

const ll N=55;
ll n,x,arr[N],cnt[N],dp[N][2],g[N];

void solve()
{
  cin>>n>>x;
  f(i,0,n) cin>>arr[i];
  ll curr=x;
  fi(i,0,n)
  {
  	if(curr==0) break;
  	ll y=curr/arr[i];
  	cnt[i]=y;
  	curr-=(y*arr[i]);
  }
  g[n-1]=infl;
  f(i,0,n-1) g[i]=arr[i+1]/arr[i];
  dp[n-1][0]=dp[n-1][1]=1;  //do nothing
  fi(i,0,n-1)
  {
  	f(j,0,2)
  	{
      curr=cnt[i]+j;
      if(curr==0)
      {
      	dp[i][j]=dp[i+1][j];
      	continue;
      }
      if(curr==g[i]) dp[i][j]=dp[i+1][1];
      else dp[i][j]=dp[i+1][0]+dp[i+1][1];
  	}
  }
  cout<<dp[0][0]<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);

    ll test_cases=1;
    //cin>>test_cases;

    f(i,1,test_cases+1)  solve();

    #ifdef rd
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif

    return 0;
}


#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

int main(){
    long n;
    cin >> n;
    vector<vector<int>> vviNum(1, vector<int>(2));
    vviNum[0][0] = 0;
    vviNum[0][1] = 1;
    long iTmp = 4;
    for(long i = 0; i < n-1; i++){
        vector<vector<int>> vviNumTmp = vviNum;
        vviNum.resize(iTmp-1);
        for(int j = 0 ; j < iTmp -1; j++){
            vviNum[j].resize(iTmp);
        }
        for(int j = 0; j < iTmp/2; j++){
            for(int k = 0; k < iTmp/2 - 1; k++){
                vviNum[2*k][2*j] = vviNumTmp[k][j];
                vviNum[2*k][2*j+1] = vviNumTmp[k][j];
                vviNum[2*k+1][2*j] = vviNumTmp[k][j];
                vviNum[2*k+1][2*j+1] = 1-vviNumTmp[k][j];
            }
        }
        vector<int> viBack(iTmp,0);
        for(int j = 0; j < iTmp/2; j++){
            viBack[2*j+1] = 1;
        }
        vviNum[iTmp-2] = viBack;
        iTmp *= 2;
    }
    cout << vviNum.size() << endl;
    for(int i = 0; i < vviNum.size(); i++){
        for(int j = 0; j < vviNum[i].size(); j++){
            if(vviNum[i][j] == 0){
                printf("A");
            } else {
                printf("B");
            }
        }
        printf("\n");
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define PB push_back
constexpr int kN = int(1E3 + 10);
int n, tot, cnt[kN][kN];
vector<string> v;

bool check() {
	for (string i : v) {
		for (int j = 0; j < tot; j++) for (int k = j + 1; k < tot; k++) if (i[j] != i[k]) cnt[j][k]++;
	}

	for (int i = 0; i < tot; i++) for (int j = i + 1; j < tot; j++) if (cnt[i][j] != cnt[0][1]) {
		printf("cnt[%d][%d] = %d\n", i, j, cnt[i][j]);
		return false;
	}
	return true;
}

vector<string> solve(int n) {
	vector<string> ans;
	int tot = 1 << n;
	string s;
	for (int i = 1; i <= tot / 2; i++) s += "A";
	for (int i = 1; i <= tot / 2; i++) s += "B";
	ans.PB(s);
	if (n == 1) return ans;
	else {
		vector<string> tmp = solve(n - 1);
		for (string i : tmp) ans.PB(i + i);
		for (string i : tmp) {
			string ss = i;
			for (int j = 0; j < tot / 2; j++) if (i[j] == 'A') ss += "B";
			else ss += "A";
			ans.PB(ss);
		}
		return ans;
	}
}

int main() {
	cin >> n;
	//for (int i = 3; i <= tot; i++) {
	//	for (int j = tot - 1; j > 1; j--) if (s[j] == 'B' && s[j - 1] == 'A') {
	//		swap(s[j], s[j - 1]);
	//		j--;
	//	}
	//	v.PB(s);
	//}

	v = solve(n);
	assert(check());
	cout << int(v.size()) << "\n";
	for (string i : v) cout << i << "\n";
}


#undef _GLIBCXX_DEBUG
// Problem: F - Rook on Grid
// Contest: AtCoder - Panasonic Programming Contest (AtCoder Beginner Contest 186)
// URL: https://atcoder.jp/contests/abc186/tasks/abc186_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

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

struct splitmix64_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 = std::chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};

template <typename K, typename V, typename Hash = splitmix64_hash>
using hash_map = __gnu_pbds::gp_hash_table<K, V, Hash>;

template <typename K, typename Hash = splitmix64_hash>
using hash_set = hash_map<K, __gnu_pbds::null_type, Hash>;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int n, m, o;
int row[maxN], col[maxN];

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> m >> o;
	RI(i, m) col[i] = -1;
	RI(i, n) row[i] = -1;
	REP(_, o) {
		int a, b; cin >> a >> b;
		if (row[a] == -1) row[a] = b - 1;
		else row[a] = min(row[a], b - 1);
		if (col[b] == -1) col[b] = a - 1;
		else col[b] = min(col[b], a - 1);
	}
	ll ans = 0;
	vector<pii> vec;
	if (row[1] == -1) row[1] = m;
	RI(i, m) {
		if (col[i] == -1) col[i] = n;
		if (i <= row[1]) {
			ans += col[i];
			vec.pb({col[i], i});
		} else {
			vec.pb({0, i});
		}
	}
	// cout << ans << endl;
	ordered_set s;
	sort(vec.begin(), vec.end());
	int cnt = 0;
	RI(i, col[1]) {
		while (cnt != m && vec[cnt].st < i) {
			s.insert(vec[cnt].nd);
			cnt++;
		}
		if (row[i] == -1) row[i] = m;
		// cout << i << " " << cnt << " " << row[i] << endl;
		ans += s.order_of_key(row[i] + 1);
	}
	cout << ans;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
    ll X, N = 0;
    cin >> N >> X;
    vector<ll> A(N,0);
    for(ll i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    vector<ll> M(N, 0);
    for(ll i = 1; i < N; i++) {
        M.at(i - 1) = A.at(i)/A.at(i - 1) - 1;
    }

    ll t = X;
    vector<ll> x(N, 0);
    for(ll i = 1; i < N; i++) {
        ll memo = t%A.at(i);
        x.at(i - 1) = memo/A.at(i - 1);
        t -= memo;
    }
    ll p = 0, e = 1, l = 0;
    if(x.at(0)) {
        l = 1;
    }
    for(ll i = 1; i < N - 1; i++) {
        ll P = p, E = e, L = l;
        if(x.at(i) == M.at(i)) {
//             cout << "A" << endl;
            E = e;
            L = e + l;
        } else if(x.at(i) == 0) {
//             cout << "B" << endl;
            E = e + l;
            L = l;
        } else {
//             cout << "C" << endl;
            E = e + l;
            L = e + l;
        }
        p = P, e = E, l = L;
    }
    ll P = p, E = e, L = l;
    if(x.at(N - 1) == 0) {
//      cout << "B" << endl;
        E = e + l;
        L = 0;
    } else {
//      cout << "C" << endl;
        E = e + l;
        L = 0;
    }
    p = P, e = E, l = L;

    cout << e + l << endl;

    return 0;
}


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

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

	int k=(1<<n)-1;
	cout<<k<<endl;
	for(int i=1; i<=k; i++){
		string s="";
		rep(i, (1<<n)) s+='A';

		for(int j=0; j<n; j++) if(i>>j&1){
			rep(l, (1<<n)) if(l>>j&1) s[l]=1-(s[l]-'A')+'A';
		}
		cout<<s<<endl;
	}

	return 0;
}

#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=100000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 1000000007
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

namespace My_Math{
    #define N 100000

    int fac[N+100],invfac[N+100];

    int add(int x,int y) {return x+y>=maxd?x+y-maxd:x+y;}
    int dec(int x,int y) {return x<y?x-y+maxd:x-y;}
    int mul(int x,int y) {return 1ll*x*y%maxd;}
    ll qpow(ll x,int y)
    {
        ll ans=1;
        while (y)
        {
            if (y&1) ans=mul(ans,x);
            x=mul(x,x);y>>=1;
        }
        return ans;
    }
    int getinv(int x) {return qpow(x,maxd-2);}

    int C(int n,int m)
    {
        if ((n<m) || (n<0) || (m<0)) return 0;
        return mul(mul(fac[n],invfac[m]),invfac[n-m]);
    }

    void math_init()
    {
        fac[0]=invfac[0]=1;
        rep(i,1,N) fac[i]=mul(fac[i-1],i);
        invfac[N]=getinv(fac[N]);
        per(i,N-1,1) invfac[i]=mul(invfac[i+1],i+1);
    }
    #undef N
}
using namespace My_Math;

int n,a[N],f[N][2],g[N][2];

int main()
{
    n=read();
    rep(i,1,n) a[i]=read();
    f[1][0]=1;g[1][0]=a[1];
    rep(i,2,n)
    {
        f[i][0]=add(f[i-1][0],f[i-1][1]);
        f[i][1]=f[i-1][0];
        g[i][0]=add(add(g[i-1][0],g[i-1][1]),mul(f[i][0],a[i]));
        g[i][1]=add(g[i-1][0],mul(f[i][1],maxd-a[i]));
    }
    //rep(i,1,n) cout << f[i][0] << " " << f[i][1] << endl;
    printf("%d\n",add(g[n][0],g[n][1]));
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int h, w, a[101][101], minn=1000000, s=0;
    cin>>h>>w;
    for(int i=1; i<=h; i++){
        for( int j=1; j<=w; j++){
            cin>>a[i][j];
            if(a[i][j]<minn){
                minn=a[i][j];
            }
        }
    }
    for(int i=1; i<=h; i++){
        for( int j=1; j<=w; j++){
            s=s+a[i][j]-minn;
        }
    }
    cout<<s;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int s=0;
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			s+=i*100+j;
		}
	}
	cout<<s;
	return 0;
}


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

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

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

	array<int, 2> c = {0};
	long long ans = 0;

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		int now = count(s.begin(), s.end(), '1') % 2;
		c[now] += 1;
		ans += c[1 - now];
	}
	cout << ans << '\n';
	return 0;
}

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

int main(){
	int n,m;
	cin>>n>>m;
	long long odd=0,even=0;
	while(n--){
		string s;
		cin>>s;
		int ones=0;
		for(char c:s){
			if(c=='1') ones++;
		}
		if(ones%2) odd++;
		else even++;
	}
	cout<<(long long)odd*even<<endl;
	return 0;
}


#include <iostream>
using namespace std;
long long qzh[200005],mx[200005],a[200005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	long long ans=0,s=0;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
		qzh[i]=qzh[i-1]+a[i];
		mx[i]=max(mx[i-1],qzh[i]);
		ans=max(ans,s+mx[i]);
		s+=qzh[i];
	}
	cout << ans;
	return 0;
}

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

#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define all(a) a.begin(),a.end()
// #define mod 1000000007
#define pi 3.141592653589
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod) ;
int power(int x, int y) ;
int gcd(int a, int b) ;

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

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T>
// using ordered_multiset = tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
//(*****FOR USING ORDERED SET CHANGE INT*******)

// struct chash {
//     const int RANDOM = (long long)(make_unique<char>().get()) ^ chrono::high_resolution_clock::now().time_since_epoch().count();
//     static unsigned long long hash_f(unsigned long long x) {
//         x += 0x9e3779b97f4a7c15;
//         x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//         x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//         return x ^ (x >> 31);
//     }
//     static unsigned hash_combine(unsigned a, unsigned b) { return a * 31 + b; }
//     int operator()(int x) const { return hash_f(x)^RANDOM; }
// };

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n] ;
    rep(i, 0, n) {
        cin >> a[i] ;
    }
    int ans = 0 ;
    int curs = 0 ;
    int curel = 0 ;
    int curmax = 0 ;
    rep(i, 0, n) {
        curs += a[i] ;
        curmax = max(curmax, curs) ;
        ans = max(ans, curel+curmax) ;
        curel += curs ;
    }
    cout << ans << "\n" ;
}


#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#include<random>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X))
#define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X))
#define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"
#define cauto const auto

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
void ouT(ll x,int d=3){auto re=to_string(x);if((int)re.size()>d) re=x>0?"oo":"-oo";cout<<string(d-re.size(),' ')<<re<<",";}
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
template<class A,class B> pair<A,B> operator+(const pair<A,B> &p,const pair<A,B> &q){ return {p.X+q.X,p.Y+q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator+=(pair<A,B> &p,const pair<C,D> &q){ p.X+=q.X; p.Y+=q.Y; return p;}
template<class A,class B> pair<A,B> operator-(const pair<A,B> &p,const pair<A,B> &q){ return {p.X-q.X,p.Y-q.Y};}
template<class A,class B,class C,class D> pair<A,B>& operator-=(pair<A,B> &p,const pair<C,D> &q){ p.X-=q.X; p.Y-=q.Y; return p;}
template<class A,class B> istream& operator>>(istream &is, pair<A,B> &p){ is>>p.X>>p.Y; return is;}
template<class T=ll> T read(){ T re; cin>>re; return move(re);}
template<class T=ll> T read(const T &dec){ T re; cin>>re; return re-dec;}
template<class T=ll> vector<T> readV(const int sz){ vector<T> re(sz); for(auto &x:re) x=read<T>(); return move(re);}
template<class T=ll> vector<T> readV(const int sz, const T &dec){ vector<T> re(sz); for(auto &x:re) x=read<T>(dec); return move(re);}
vv<int> readG(const int &n,const int &m){ vv<int> g(n); rep(_,m){ cauto a=read<int>(1),b=read<int>(1); g[a].pb(b); g[b].pb(a);} return move(g);}
vv<int> readG(const int &n){ return readG(n,n-1);}
#define TT cauto TTT=read();rep(_,TTT)
const ll MOD=1e9+7; //998244353;

struct UF{
  vector<int> data;
  UF(int size):data(size,-1){}
  bool unite(int x,int y){
    x=root(x); y=root(y);
    if(x!=y){
      if(-data[y]>-data[x]) swap(x,y);
      data[x]+=data[y]; data[y]=x;
    }
    return x!=y;
  }
  bool findSet(int x,int y){return root(x)==root(y);}
  int root(int x){return data[x]<0?x:data[x]=root(data[x]);}
  int size(int x) {return -data[root(x)];}
	bool operator()(int x,int y){ return findSet(x,y);}
	int operator[](int x){ return root(x);}
	bool unti(int x,int y){ return unite(x,y);}
};

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	cauto n=read();
	cauto ps=readV<pii>(n,{1,1});
	UF uf(412345);
	for(cauto [a,b]:ps) uf.unite(a,b);
	vector<int> cnt(412345);
	for(cauto p:ps) ++cnt[uf.root(p.X)];
	int re=0;
	rep(i,412345)if(uf.root(i)==i) re+=min(uf.size(i),cnt[i]);
	cout<<re NL;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = false;
//---------------------------------//

struct UnionFind {
public:
	using size_type = std::size_t;

	UnionFind(size_type n) : n(n), size_(n, 1) {
		par.resize(n);
		std::iota(par.begin(), par.end(), 0);
	}

	size_type size(size_type x) { return size_[find(x)]; }

	size_type find(size_type x) {
		assert(x < n);
		while (par[x] != x) {
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}

	void unite(size_type x, size_type y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (size(x) > size(y)) std::swap(x, y);
		par[x] = y;
		size_[y] += size_[x];
	}

	bool issame(size_type x, size_type y) { return find(x) == find(y); }

private:
	size_type n;
	std::vector<size_type> size_, par;
};

int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	REP(i, N) scanf("%d %d", &A[i], &B[i]);
	UnionFind uf(412345);
	REP(i, N) {
		if (uf.issame(A[i], B[i])) uf.unite(A[i], 0);
		else uf.unite(A[i], B[i]);
	}

	int ans = 0;
	FOR(i, 1, 412345) if (uf.find(i) == i && !uf.issame(i, 0)) {
		ans += uf.size(i) - 1;
	}
	ans += uf.size(0) - 1;
	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Node{
    int to;
    int d;
};
using graph = vector<vector<Node>>;

int main()
{
    int n, m;
    cin >> n >> m;
    graph g(n);
    for(int i=0; i<m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        g[a-1].push_back({b-1, c});
    }
    vector<vector<int>> d(n, vector<int>(n, 1e9));
    for(int i=0; i<n; ++i){
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
        pq.push({0, i});
        while(!pq.empty()){
            auto [d_now, u] = pq.top();
            pq.pop();
            for(const auto &e: g[u]){
                if(d[i][e.to] > d_now + e.d){
                    d[i][e.to] = d_now + e.d;
                    pq.push({d[i][e.to], e.to});
                }
            }
        }
    }
    for(int i=0; i<n; ++i){
        int ans = d[i][i];
        if(ans == 1e9){
            cout << -1 << endl;
        }else{
            cout << ans << endl;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long LINF = 1LL << 60;

using Graph = vector<vector<pair<int, long long>>>;
int N, M;

vector<long long> dijkstra(const Graph &G, int s) {
    int min_v;
    vector<long long> dist(N, LINF);
    priority_queue<pair<long long, int>> pq;
    dist[s] = 0;
    pq.emplace(0, s);
    while (!pq.empty()) {
        min_v = pq.top().second; pq.pop();
        for (pair<int, long long> p : G[min_v]) {
            if (chmin(dist[p.first], dist[min_v] + p.second)) pq.emplace(-dist[p.first], p.first);
        }
    }
    return dist;
}

int main() {
    cin >> N >> M;
    Graph G(N), to(N);
    int A, B, C;
    rep(i, M) {
        cin >> A >> B >> C; A--; B--;
        G[A].emplace_back(B, C);
        to[B].emplace_back(A, C);
    }
    rep(i, N) {
        auto dist = dijkstra(G, i);
        long long res = LINF;
        for (auto [to, cost]: to[i]) chmin(res, dist[to] + cost);
        if (res != LINF) cout << res << endl;
        else cout << "-1" << endl;
    }
}


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

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && !std::isdigit(ch)) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (std::isdigit(ch)) data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int N(505);
int T, n, p[N];
std::vector<int> ans;

int main()
{
#ifndef ONLINE_JUDGE
	file(cpp);
#endif
	for (T = read(); T--; puts(""))
	{
		n = read(), ans.clear();
		for (int i = 1; i <= n; i++) p[i] = read();
		for (int t = 1; !std::is_sorted(p + 1, p + n + 1); t ^= 1)
		{
			int j = t ? 1 : 2;
			for (int i = j; i < n; i += 2) if (p[i] > p[i + 1]) j = i;
			std::swap(p[j], p[j + 1]), ans.push_back(j);
		}
		printf("%lu\n", ans.size());
		for (auto i : ans) printf("%d ", i);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 #define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)

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

cout<<N<<endl;
}


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

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

    size_t ans = (1 << (N)) - 1;
    cout << ans << endl;

    for (size_t i = 1; i <= ans; i++)
    {
        for (size_t j = 0; j < ((size_t)1 << N); j++)
        {
            if (bitset<32>(i & j).count() % 2 == 0)
            {
                cout << 'A';
            }
            else
            {
                cout << 'B';
            }
        }
        cout << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int64_t N;
	cin>>N;
	for (int64_t a=3;a<=N;a*=3){
		int64_t b=5;
		while (b<=N-a){
			if (a+b==N){
				int cnt1=0,cnt2=0;
				int64_t tmp1=1,tmp2=1;
				while (tmp1!=a) {
					tmp1*=3;
					cnt1++;
				}
				while (tmp2!=b) {
					tmp2*=5;
					cnt2++;
				}
				cout<<cnt1<<" "<<cnt2<<'\n';\
				return 0;
			}
			b*=5;
		}
	}
	cout<<-1<<'\n';
}


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

int main() {
	int a, b, x, y;
	scanf("%d%d%d%d", &a, &b, &x, &y);
	if(a == b)
		printf("%d", x);
	else if(b > a) {
		int diff = b - a;
		printf("%d", min(x + diff* y, x + 2 * x * diff));
	}
	else {
		int diff = a - b - 1;
		printf("%d", min(x + diff * y, x + 2 * x * diff));
	}
}

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

#define endl '\n'
#define int long long

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

	int a, b, x, y; cin >> a >> b >> x >> y;
	int ans = 0;
	int dp[105][2];
	memset(dp, -1, sizeof dp);
	function<int(int, int)> solve = [&] (int pos, int cur) {
		if(pos == b and cur) return 0LL;
		else if(pos == b and !cur) return x;
		int &ans = dp[pos][cur];
		if(ans != -1) return ans;
		if(pos > b) {
			if(cur)
				ans = min({solve(pos - 1, cur) + min(y, 2 * x), solve(pos - 1, cur ^ 1) + x + y});
			else
				ans = min(solve(pos - 1, cur) + y, solve(pos - 1, cur ^ 1) + x);
		}
		else if(pos < b) {
			if(cur)
				ans = min({solve(pos + 1, cur) + min(y, 2 * x), solve(pos + 1, cur ^ 1) + x});
			else
				ans = min({solve(pos + 1, cur) + min(y, 2 * x), solve(pos + 1, cur ^ 1) + min(3 * x, x + y)});
		}
		return ans;
	};
	cout << solve(a, 0) << endl;

	return 0;
}


// ¯\_(ツ)_/¯
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define all(x)                      (x).begin(),(x).end()
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << ": " <<  x << endl;

const ll MAXN = 1e2 + 10;
const ll INF = 8e18;
const ll MOD = 998244353; // 1e9 + 9;

int n, W[MAXN];
ll dp[2][MAXN][MAXN * MAXN], fact[MAXN], s;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	dp[0][0][0] = fact[0] = 1;

	for (int i = 1; i <= n; i++) {
		int ind = i & 1, w;
		dp[ind][0][0] = 1;
		fact[i] = fact[i - 1] * i % MOD;
		cin >> w;
		s += w;

		for (int j = 1; j <= i; j++) {
			for (int k = 0; k <= s; k++) {
				dp[ind][j][k] = dp[1 - ind][j][k];
				if (k >= w) dp[ind][j][k] += dp[1 - ind][j - 1][k - w];
				if (dp[ind][j][k] >= MOD) dp[ind][j][k] -= MOD;
			}
		}
	}

	if (s & 1) return cout << 0 << endl, 0;
	s /= 2;

	ll ans = 0;
	for (int j = 0; j <= n; j++)
		ans = (ans + (dp[n & 1][j][s] * fact[j] % MOD * fact[n - j] % MOD)) % MOD;
	cout << ans << endl;
	return 0;
}

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

const int MAX = 1e6;

int cnt[MAX+4];
bool isSqr[MAX+4];

using pii = pair<int,int>;

long long coprimes(int l, int r){
    //[l,r]에서 x<y인 서로소 쌍의 수
    //전체에서 k로 동시에 나눠떨어지는걸로 포함배제하면 된다
    long long result = 1LL * (r-l+1) * (r-l) / 2;
    for(int i=2;i<=r;i++)if(!isSqr[i]){
        long long tmp = r/i - (l-1)/i;
        if(cnt[i]&1) result -= tmp*(tmp-1)/2;
        else result += tmp*(tmp-1)/2;
    }
    return result;
}

int main(){
    for(int i=2;i<=MAX;i++)if(cnt[i] == 0){
        for(int j=i;j<=MAX;j+=i) cnt[j]++;
        if(1LL*i*i<=MAX) for(int j=i*i;j<=MAX;j+=i*i) isSqr[j] = 1;
    }
    int L, R;
    scanf("%d%d",&L,&R);
    long long ans = 1LL*(R-L+1)*(R-L)/2;
    ans -= coprimes(L,R);
    for(int i=max(2,L);i<=R;i++) ans -= R/i-1;
    printf("%lld\n", ans*2);
    return 0;
}


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

#define  fastt      ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  pb         push_back
#define  inf        1000000000000000000
#define  mp         make_pair
#define  sz(a)      a.size()
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "
#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  tt         ll int t;cin>>t;while(t--)

ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

#define f(j,l)      for (int i = j; i <l; ++i)
#define fn(j,l)     for (int i = j; i >l; --i)

// cout << fixed << setprecision(12);

int main()
{

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

    fastt;
    int a,b;
    cin>>a>>b;
    b=a-b;
    if(b==0){
        cout<<"0"<<endl;
        return 0;
    }
    cout<<fixed<<setprecision(18)<<(double)((b*100)/(double)a)<<endl;

    return 0;
}

#include <array>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <functional>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vpii = vector<pii>; using vpll = vector<pll>;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (const auto &x : v) os << x << " "; return os; }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

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

int main() {
#ifndef ONLINE_JUDGE
	ifstream in("inputB.txt");
	cin.rdbuf(in.rdbuf()); //redirect cin to input.txt!
	ofstream out("outB.txt");
	cout.rdbuf(out.rdbuf()); //redirect cout to out.txt!
#endif
	solve();
	return 0;
}


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

int main(int argc, const char * argv[]) {
    int N=0,i=0;
    double D=0,H=0,d=0,h=0,m=0,ans=0,minmin=0;
    cin>>N>>D>>H;
    for(;i<N;i++){
        cin>>d>>h;
        m=(H-h)/(D-d);
        m*=d;
        ans=h-m;
        if(ans>minmin) minmin=ans;
    }
    cout<<minmin<<endl;
    return 0;
}

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

#define INF 1e9
#define LLINF 1e18
#define PI 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef long double ld;

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

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

//素因数分解vector<pair<素因数, 個数>>
vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while(n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

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

int main() {
    int n;
    ld d, h;
    cin >> n >> d >> h;
    vector<ld> x(n), y(n);
    ld ans = 0;
    rep(i, n) {
        cin >> x[i] >> y[i];
        ld num;
        if (x[i] == d) num = 0;
        else num = h - d * (h - y[i]) / (d - x[i]);
        ans = max(num, ans);
    }
    cout << fixed << setprecision(20) << ans << endl;
}


#ifdef _LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

static const ll MOD = 998244353ll;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll add(ll a, ll b) { return (a + b) % MOD; }
ll mul(ll a, ll b) { return (a * b) % MOD; }
ll di(ll a, ll b) {
    return a * modinv(b, MOD) % MOD;
}

ll solve(ll a, ll b, ll c) {
    ll cc = di(mul(add(1ll, c), c), 2ll);
    ll bb = di(mul(add(1ll, b), b), 2ll);
    ll aa = di(mul(add(1ll, a), a), 2ll);
    return mul(mul(cc, bb), aa);
}

#ifndef _LOCAL
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << solve(a, b, c) << endl;
}
#endif

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

int main(){
	int n;
	string s, x;
	cin>>n>>s>>x;

	vector<bool> dp(7, false), ndp(7);
	dp[0]=true;
	per(i, n){
		if(x[i]=='A'){
			rep(j, 7) ndp[j]=true;
			rep(j, 7){
				if(dp[j*10%7]==false) ndp[j]=false;
				if(dp[(j*10 + s[i]-'0')%7]==false) ndp[j]=false;
			}
		}
		else{
			rep(j, 7) ndp[j]=false;
			rep(j, 7){
				if(dp[j*10%7]==true) ndp[j]=true;
				if(dp[(j*10 + s[i]-'0')%7]==true) ndp[j]=true;
			}
		}
		swap(dp, ndp);
	}

	if(dp[0]) cout<<"Takahashi"<<endl;
	else cout<<"Aoki"<<endl;
	return 0;
}


#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pi 3.141592653589
#define pb push_back
#define nl cout<<"\n"
#define db(x) cout<<x<<" "
#define fi(a,b) for(int i=a;i<b;i++)
#define fj(a,b) for(int j=a;j<b;j++)
#define fk(a,b) for(int k=a;k<b;k++)
#define F first
#define S second
ll fastexp(ll a,ll n,ll nod=LLONG_MAX){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%nod;
        a=(a*a)%nod;
        n>>=1;
    }
    return ans;
}
#define mxsize (int)3e5

void fun(){
    int n;
    cin>>n;
    fi(1,n+1)   cout<<(2*i)%n+1<<" "<<(2*i+1)%n+1<<"\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout.precision(20);
    cout<<fixed;
    #ifndef ONLINE_JUDGE
        freopen("/ATOM/input.txt", "r", stdin);
        freopen("/ATOM/output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--){
        fun();
    }
}

#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define MAXN 200005
#define max_num 1000000
#define MOD 998244353
#define LL long long
using namespace std;
LL sum[MAXN];
LL a[MAXN], p[MAXN];
LL C[MAXN][305];
int n, k;
LL pow(LL x, LL nn)
{
    LL res = 1LL;
    while(nn)
    {
        if(nn & 1) res = (res * x) % MOD;
        x = (x * x) % MOD;
        nn >>= 1;
    }
    return res;
}
int main()
{
    C[1][0] = C[1][1] = 1LL;
    for(int i = 2; i <= 300; i++)
    {
        C[i][0] = C[i][i] = 1LL;
        for(int j = 1; j < i; j++)
        {
            C[i][j] = (C[i - 1][j-1] + C[i - 1][j]) % MOD;
        }
    }
    //while(cin >> n >> k) cout << pow(n, k) << endl;
    while(cin >> n >> k)
    {
        for(int i = 1; i <= n; i++)
        {
            scanf("%lld", &a[i]);
            a[i] = a[i] % MOD;
        }
        for(int i = 1; i <= n; i++) p[i] = 1LL;
        for(int x = 0; x <= k; x++)
        {
            LL tmp = 0;
            for(int i = 1; i <= n; i++)
            {
                tmp = (tmp + p[i]) % MOD;
                p[i] = (p[i] * a[i]) % MOD;
            }
            sum[x] = tmp;
        }

        LL div = pow(2LL, MOD - 2LL);
        for(int x = 1; x <= k; x++)
        {
            LL ans = 0;
            for(int i = 0; i <= x; i++)
            {
                LL tmp = (sum[i] * sum[x - i] % MOD - sum[x] + MOD) % MOD * C[x][i] % MOD;
                //tmp = tmp * div % MOD;
                ans = (ans + tmp) % MOD;
            }
            //ans = (ans + sum[x] + sum[x]) % MOD;
            ans = (ans * div) % MOD;
            cout << ans << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define all(A) A.begin(), A.end()
typedef long long ll;

char process(char c) {
  if (c == '6') {
    return '9';
  }
  if (c == '9') {
    return '6';
  }
  return c;
}

int main() {
  string s;
  cin >> s;
  reverse(all(s));
  for (char c : s) {
    cout << process(c);
  }
  cout << endl;
}

//............Created by:- Arth Raj...........................//
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <climits>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<sstream>
#define ll long long int
#define pll pair<long long int,long long int>
#define pb push_back
#define mp make_pair
#define vi vector<long long int>
#define vii vector<pair<long long int,long long int>>
#define tez ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lp(i,a,b) for(long long int i=a;i<b;i++)
#define rlp(i,a,b) for(long long int i=b;i>=a;i--)
#define ld long double
#define tl tuple<ll,ll,ll>
#define all(x) (x).begin(),(x).end()
#define bs(x,b) binary_search(all(x),b)
#define vip vector<pair<long long int,pair<long long int,long long int>>>
#define pip pair<long long int,pair<long long int,long long int>>
#define INF 1e18
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll abm(ll a, ll b, ll m) {ll ans = 1; a = a % m; while (b > 0) {if (b & 1)ans = (ans * a) % m; a = (a * a) % m; b = b / 2;} return ans % m;}
ll ncr(ll n, ll r, ll m) {if (r == 0)return 1; ll fac[n + 5]; fac[0] = 1; lp(i, 1, n + 1) {fac[i] = fac[i - 1] * i % m;} return (((fac[n] * abm(fac[r], m - 2, m)) % m) * (abm(fac[n - r], m - 2, m))) % m;}
int main()
{
	string s;
	cin >> s;
	string ans = "";
	rlp(i, 0, s.length() - 1)
	{
		if (s[i] == '9')
		{
			ans += '6';
		}
		if (s[i] == '8')
		{
			ans += '8';
		}
		if (s[i] == '6')
		{
			ans += '9';
		}
		if (s[i] == '1')
		{
			ans += '1';
		}
		if (s[i] == '0')
		{
			ans += '0';
		}
	}
	cout << ans << endl;
}


#include<bits/stdc++.h>

using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;

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

void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

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

void solve() {
    int n;
    cin >> n;
    vector<pair<int, string>>v(n);
    for (int i = 0; i < n; i++)cin >> v[i].second >> v[i].first;
    sort(v.begin(), v.end(), greater<pair<int, string>>());
    cout << v[1].second;

}

int main() {
#ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
#endif
    ll t = 1;
    // cin >> t;
    while (t--)solve();

}

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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
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;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

int n;
vector<pair<int, string>> v;

int main(){
    cin >> n;
    REP(i,n)
    {
        string s;
        int t;
        cin >> s >> t;
        v.push_back(make_pair(t,s));
    }
    sort(v.begin(),v.end());
    if(v.size()>=2)
        cout << v[n-2].second << endl;
    if(v.size()==1)
        cout << v[0].second << endl;
    return 0;
}


#include<iostream>
#include<map>
#include<vector>
#include<set>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// map 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const map<S,T>& mp){
  for(const pair<S,T>& x: mp){
    cout << "[" << x.first << "]=" << x.second << " ";
  }
  return os;
}

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
};

int gcd(int a,int b){return (b==0)?a:gcd(b,a%b); }

int main(){
  int n,m; cin >>n >>m;
  map<int,int> mp;
  auto  add=
    [&](int a){
      for(int i=1;i*i<=a and i<=m; i++){
        if(a%i) continue;
        mp[i]=gcd(a,mp[i]);
        if(a/i<=m)mp[a/i]=gcd(a,mp[a/i]);
      }
      if(df)print(a,":",mp);
    };

  add(m);

  rep(i,n-1){
    int a; cin >>a;
    if(a<m) m=a;
    add(a);
  }
  int cnt=0;
  for(auto p:mp){
    if(p.first>m) break;
    if(p.first==p.second) cnt++;
  }
  print(cnt);
}

// Problem: C - Tricolor Pyramid
// Contest: AtCoder - AtCoder Regular Contest 117
// URL: https://atcoder.jp/contests/arc117/tasks/arc117_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
using namespace std;
typedef long long ll;

int read() {
	char ch=getchar();int x=0,f=1;
	while(ch<'0'||ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int N=4e5+5;

char a[N];
int n;

pair<int,int> p(ll x) {
	if(x==0) return make_pair(0,0);
	int res=0;
	for(;x%3==0;) {
		x/=3,res++;
	}
	return make_pair(res,x);
}

int main() {
	n=read();
	scanf("%s",a+1);
	ll ans=0;
	ll f=0,g=1;
	for(int i=1;i<=n;i++) {
		int x;
		if(a[i]=='W') x=0;
		if(a[i]=='R') x=1;
		if(a[i]=='B') x=2;
		if(!f) ans=(ans+g*x%3)%3;
		pair<int,int> u=p(n-1-i+1),d=p(i);
		f+=u.first-d.first,g=g*u.second%3*d.second%3;
	}
	if(n%2==0) ans=(3-ans)%3;
	if(ans==0) printf("W\n");
	if(ans==1) printf("R\n");
	if(ans==2) printf("B\n");
	return 0;
}


#include <bits/stdc++.h>
#define st string
#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;

void solve() {
	int n;
	cin >> n;
	int z = 1, e;
	vector <int> ss;
	for (int i = 0; i < n; i++) {
		cin >> e;
		ss.push_back(e);
	}
	sort(ss.begin(), ss.end());
	for (auto i : ss) {
		if (i != z) {
			cout << "No";
			return;
		}
		z++;
	}
	cout << "Yes";
}

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

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

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#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) for (int i = j ; i < k ; ++i)
#define FORR(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define INF 1000000000000000003
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef pair<int, int> PI;
typedef map<int, int> mpii;
#define F first
#define S second
#define pb push_back
#define POB pop_back
#define MP make_pair

int main()
{
     io;
     // int t; cin>>t; while(t--){
     //   while(1){
    int n;
    cin>>n;
    int a[n];

    set<int> s;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        s.insert(a[i]);
    }
    if(s.size()==n)
    cout<<"Yes";
    else
    cout<<"No";

   /* } */  return 0;}


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

const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

void addmodp(ll &x, ll y) {x = (x + y) % mod;}

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

    vector<vector<ll>> L(N,vector<ll>(2)), R(N,vector<ll>(2));
    L[0][0] = 1;
    repp(i,1,N) {
        L[i][0] = (L[i-1][0] + L[i-1][1]) % mod;
        L[i][1] = L[i-1][0];
    }
    R[N-1][0] = 1;
    repm(i,N-2,0) {
        R[i][0] = (R[i+1][0] + R[i+1][1]) % mod;
        R[i][1] = R[i+1][0];
    }

    ll ans = 0;
    rep(i,N) {
        ll x = L[i][0] * ((R[i][0] + R[i][1])%mod) % mod;
        ll y = L[i][1] * R[i][0] % mod;
        addmodp(ans,A[i]*x%mod);
        addmodp(ans,(mod-A[i])*y%mod);
    }

    Cout(ans);
}


#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <utility>

typedef long long ll;
typedef unsigned long long ull;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b%a, a); }
ll mod(ll a) { return a % MOD < 0 ? (a % MOD) + MOD : a % MOD; }
ll mod_add(ll a, ll b) { return (a%MOD + b%MOD) % MOD; }
ll mod_sub(ll a, ll b) { return mod((a%MOD - b%MOD) % MOD); }
ll mod_mul(ll a, ll b) { return (a%MOD * b%MOD) % MOD; }
ll mod_pow(ll a, ll b)
{
    if(b == 0) return 1;
    ll p = mod_pow(a, b/2) % MOD;
    p = mod_mul(p, p);
    return (b%2 == 0) ? p : mod_mul(a, p);
}
ll mod_inv(ll a) { return mod_pow(a, MOD-2); }
ll mod_div(ll a, ll b) { return a%MOD * mod_inv(b) % MOD; }
ll mod_summation(ll N) { return mod_div(mod_mul(N, mod_add(N, 1)), 2); }

int main()
{
    int N, X, V, P;
    int res = -1;
    std::cin >> N >> X;
    X *= 100;

    floop(N)
    {
        std::cin >> V >> P;

        if(X > -1)
        {
            X -= (V*P);
            if(X <= -1)
                res = i+1;
        }
    }

    print(res);

    return 0;
}

#include <iostream>
using namespace std;
int main()
{
  long long A, B, C;
  cin >> A >> B >> C;
  if ( C % 2 == 0 )
  {
    A = A>0?A:-A;
    B = B>0?B:-B;
  }
  if ( A > B ) cout << ">";
  else if ( A < B ) cout << "<";
  else cout << "=";
}


#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
#include <cassert>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using namespace std;
//#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; exit(0); }
void Yes() { cout << "Yes" << endl; exit(0); }
void No() { cout << "No" << endl; exit(0); }

//---------- 1000000007 ----------
const int MOD = 1000000007;
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; }

mint m_comb(mint n, mint r)
{
	int i;
	mint p = 1;
	for (i = 1; i <= r.x; i++)
	{
		p *= n - i + 1;
		p /= i;
	}
	return p;
}
mint m_comb_with_rep(mint n, mint r)
{
	return m_comb(n + r - 1, r);
}
mint m_perm(mint n, mint r)
{
	mint a = 1;
	for (int i = n.x; i > n.x - r.x; i--)
	{
		a *= i;
	}
	return a;
}

struct St
{
	mint sum;
	mint cnt;
	St() {}
	St(mint sum, mint cnt) : sum(sum), cnt(cnt) {}
};

int N;
mint A[100010];

bool _flg[100010];
St _memo[100010];
mint _p[100010];

St func(int n)
{
	if (_flg[n])
	{
		return _memo[n];
	}

	if (n == 2)
	{
		return St(-A[N - 1] - A[N - 2], 1);
	}
	else if (n == 1)
	{
		return St(0, 0);
	}

	mint sum = 0;
	mint cnt = 0;

	//mint p = ((mint)2).pow(n - 2);
	cnt += _p[n - 2];
	sum -= (A[N - n] + A[N - n + 1]) * _p[n - 2];

	St st;
	st = func(n - 1);
	cnt += st.cnt;
	sum += st.sum + st.cnt * A[N - n];

	st = func(n - 2);
	cnt += st.cnt;
	sum += st.sum + st.cnt * (-A[N - n] + A[N - n + 1]);

	_flg[n] = true;
	_memo[n] = St(sum, cnt);
	return _memo[n];
}

signed main()
{
	cin >> N;
	REP(i, N) cin >> A[i];

	if (N == 1)
	{
		cout << A[0] << endl;
		return 0;
	}
	else if (N == 2)
	{
		cout << A[0] * 2 << endl;
		return 0;
	}

	REP(i, 100001)
	{
		_p[i] = ((mint)2).pow(i);
	}

	mint ans = 0;
	ans = ((mint)2).pow(N - 1) * A[0];
	St f = func(N - 1);
	ans -= f.sum;
	ans -= f.cnt * A[0];
	cout << ans << endl;
}

#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define F(w,x,y) for(ll w=x; w<y; w++)
#define endl "\n"
#define mod 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

void play()
{
    ll n;
    cin>>n;
    vector <ll> v(n);
    F(i,0,n)
    cin>>v[i];
    ll dp[n][2]; // number of ways to arrange + and - so that the last operation is - (0) or + (1)

    dp[0][1]=1;
    dp[0][0]=0;

    F(i,1,n)
    {
        dp[i][0]=(dp[i-1][1])%mod;
        dp[i][1]=(dp[i-1][0]%mod+dp[i-1][1]%mod)%mod;
    }

    ll ans[n][2];

    ans[0][1]=v[0];
    ans[0][0]=0;

    F(i,1,n)
    {
        ans[i][0]=(ans[i-1][1]%mod-(dp[i][0]%mod*v[i]%mod)%mod+mod)%mod;
        ans[i][1]=((ans[i-1][1]%mod+ans[i-1][0]%mod)%mod+(dp[i][1]%mod*v[i]%mod)%mod)%mod;
    }

    cout<<(ans[n-1][0]%mod+ans[n-1][1]%mod)%mod<<endl;
}

int main()
{
    //freopen("milkvisits.in","r",stdin);
    //freopen("milkvisits.out","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //pre();
    ll t;
    t=1;
    //cin>>t;
    F(i,1,t+1)
    {
        //cout<<"Case #"<<i<<": ";
        play();
    }
    return 0;
}


///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define        u64             uint64_t
#define        ll              long long
#define        endl            "\n"
#define        PI              acos(-1)
#define        fi              first
#define        si              second
#define        mkp             make_pair
#define        pb              push_back
#define        set0(arr)       memset(arr, 0, sizeof(arr))
#define        setinf(arr)     memset(arr, 126, sizeof(arr))
#define        all(x)          (x).begin(),(x).end()
#define        sz(v)           ((int)(v).size())
#define        IOS             ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
using          pll        =      pair<ll, ll> ;
using          vl         =      vector<ll> ;
using          vpll       =      vector<pll> ;
using          mll        =      map<ll, ll> ;
using          mcl        =      map<char, ll> ;
using          msl        =      map<string,ll> ;
using          sl         =      set<ll> ;
using          sc         =      set<char> ;
using          dl         =      deque<ll> ;
const int N = 1e6+5 ;

ll      mod = 1e9+7 ;
vl      adj[N] ;
vpll    adjc[N] ;
ll      vis[N] ;
ll      arr[N] ;

int main()
{
    IOS;
    ll a, b, c, d, n, m, p, x, y, z, i, j, k, f = 0, tc, cnt = 0, sum = 0, mul = 1, mi = 1e18, ma = -1e18, cs;
    string   str ;
    char     ch ;
    double   db ;
    ll       l, r ;
    //code

        cin>>n;
        sl st;
        for(i=0;i<n;i++)
        {
            cin>>arr[i];
            st.insert(arr[i]);
        }
        while(st.size()>1)
        {
               auto it1=st.begin();
               auto it2=st.end();
               it2--;
               a=*it1;
               b=*it2;
               x=b-a;
               st.erase(b);
               st.insert(x);
        }
        auto it=st.begin();
        cout<<(*it)<<endl;

    //code
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
	return b==0?a:gcd(b,a%b);
}
int main() {
	int n, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		ans = gcd(ans, a);
	}
	cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    char s,t;
    cin >> s >> t;
    if(s=='Y'){
        t=std::toupper(t);
    }
    cout << t << endl;
}

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

int n, m, ans, MOD;

int mul(int B, int K) {
	int base = B, h = K, res = 1;
	while (h) {
		if (h & 1) res = (res * base) % MOD;
		base = (base * base) % MOD, h >>= 1;
	}
	return res;
}

signed main() {
	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);

	cin >> n >> m;
	MOD = m * m, ans = mul(10, n);
	MOD = m, ans = ans - mul(10, n);
	cout << ans / m << endl;

	// fclose(stdin);
	// fclose(stdout);
	return 0;
}


#include <bits/stdc++.h>

#define rep( i, a, b ) for( i = a; i < b; i ++ )

using namespace std;
template< class T >
using vv = vector< vector< T > >;

int solve( vv< int > *dvv, vector< int > rv, int ind, int a, int d ) {
    int p = rv.at( ind );
    rv.erase( rv.begin() + ind );
    if( rv.empty() ) {
        int b = d + dvv->at( p ).at( 0 );
        return a == b ? 1 : 0;
    }
    int cn = 0, i;
    rep( i, 0, rv.size() ) {
        cn += solve( dvv, rv, i, a, d + dvv->at( p ).at( rv.at( i ) ) );
    }
    return cn;
}

int main() {
    vv< int > dvv;
    vector< int > rv;
    int c, a, i, j, d;
    cin >> c >> a;
    rep( i, 0, c ) {
        vector< int > dv;
        rep( j, 0, c ) {
            cin >> d;
            dv.push_back( d );
        }
        dvv.push_back( dv );
    }
    rep( i, 0, c ) {
        rv.push_back( i );
    }
    cout << solve( &dvv, rv, 0, a, 0 ) << endl;
    return 0;
}

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <limits>
#include <numeric>
#include <vector>

using namespace std;

// static constexpr long long INF = numeric_limits<long long>::max() / 2;

// vector<long long> travel(int S, int v, int N, int K, int counter, vector<long long>& T, vector<long long>& dp) {
//   if (dp[S][v] >= 0) {
//     vector<long long> ans = { dp[S][v] };
//   }

//   // if (S == ((1 << N) - 1) && dp[S][v] == K) {
//   //   counter++;
//   // }

//   if (S == (1 << N) - 1 && v == 0) {
//     return dp[S][v] = 0;
//   }

//   long long res = INF;
//   for (int u = 0; u < N; u++) {
//     if (!(S >> u & 1)) {
//       long long total = travel(S | (1 << u), u, N, K, counter, T, dp) + T[v][u];
//       if (total == K) {
//         counter++;
//       }
//       res = counter;
//     }
//   }
//   return dp[S][v] = res;
// }

int main() {
  int N, K;
  cin >> N >> K;
  vector<vector<long long>> T(N, vector<long long>(N));

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      long long t;
      cin >> t;
      T[i][j] = t;
    }
  }

  vector<long long> cities(N+1);
  iota(cities.begin(), cities.end(), 0);
  cities[N] = 0;

  long long counter = 0;
  do {
    long long total = 0;
    for (int i = 0; i <= N; i++) {
      if (i == N) {
        total += T[cities[i]][0];
      } else {
        total += T[cities[i]][cities[i+1]];
      }
    }
    if (total == K) {
      counter++;
    }
  } while(next_permutation(cities.begin()+1, cities.end()));

  cout << counter << endl;

  // // vector<long long> dp(1 << N, vector<long long>(N, -1));
  // vector<long long> dp(1 << N, -1);

  // for (int i = 0; i < (1 << N); i++) {
  //   long long cost = 0;
  //   for (int j = 0; j < N; j++) {
  //     if (i >> j & 0x1) {

  //     }
  //   }
  // }

  return 0;
}


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

struct pascal_comb {
    vector<vector<long long>> dat;
    pascal_comb(int s) : dat(s + 1, vector<long long>(s + 1)) {
        rep(i,s+1) {
            dat[i][0] = 1;
            dat[i][i] = 1;
        }
        for (int k = 1; k < s + 1; k++) {
            for (int j = 1; j < k; j++) {
                dat[k][j] = dat[k - 1][j - 1] + dat[k - 1][j];
            }
        }
    }
    long long operator() (int a, int b) {
        if (b < 0 || a < b) return 0;
        return dat[a][b];
    }
};

int main() {
    int l; cin >> l;
    l -= 12;
    pascal_comb pc(200);
    cout << pc(l + 11, 11) << endl;
}

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

int main() {
    ll l;
    cin >> l;
    ll ans = 1;
    for (int i = 1; i <= 11; i++) {
        ans *= l - i;
        ans /= i;
    }
    cout << ans  << endl;
}


//#include<math.h>
#include<algorithm>
#include<stdlib.h>
#include<time.h>
#include<stdio.h>
#include<string.h>
#define un unsigned
#define srd srand(time(0))
#define ll long long
#define con continue
#define gtc getchar()
#define ptc putchar
#define dou double
#define eps 0.00000000001
#define opr operator
#define cl(x,a) memset(x,a,sizeof(x))
#define fo0(i,k) for(i=fr[k];i;i=nx[i])
#define fo1(i,l,r) for(i=l;i<=r;i++)
#define fo2(i,l,r) for(i=l;i>=r;i--)
#define fo(i,n) for(i=1;i<=n;i++)
#define ret return
#define x first
#define cint const int
#define y second
#define opi(x) freopen(x,"r",stdin)
#define opo(x) freopen(x,"w",stdout)
#define tpl template<class T>
#define priq priority_queue
#define mp make_pair
#define use using namespace
#define WT while(T--)
#define pb push_back
#define sz size()
use std;
typedef pair<int,int> pii;typedef pair<int,ll> pil;typedef pair<ll,int> pli;typedef pair<ll,ll> pll;
namespace io
{
	void _(int &k){char c;int e=1;k=0;while((c=gtc)>'9'||c<'0')if(c=='-')e=-1;k=c-'0';while((c=gtc)<='9'&&c>='0'){k*=10;k+=c-'0';}k*=e;}
	void _(ll &k){char c;int e=1;k=0;while((c=gtc)>'9'||c<'0')if(c=='-')e=-1;k=c-'0';while((c=gtc)<='9'&&c>='0'){k*=10;k+=c-'0';}k*=e;}
	void _(char &c){while((c=gtc)==' '||c=='\n');}void _(dou &c){scanf("%lf",&c);}void _(char *s){char c;while((c=gtc)!=EOF&&c!=' '&&c!=10)*s++=c;}
	template<class t1,class t2>void _(t1 &a,t2 &b){_(a);_(b);}template<class t1,class t2,class t3>void _(t1 &a,t2 &b,t3 &c){_(a);_(b);_(c);}
	template<class t1,class t2,class t3,class t4>void _(t1 &a,t2 &b,t3 &c,t4 &d){_(a);_(b);_(c);_(d);}
	template<class t1,class t2,class t3,class t4,class t5>void _(t1 &a,t2 &b,t3 &c,t4 &d,t5 &e){_(a);_(b);_(c);_(d);_(e);}
	void _p(dou k){printf("%.6lf",k);}void _p(char *c){for(;*c;ptc(*c++));}void _p(const char *c){for(;*c;ptc(*c++));}void _p(char c){ptc(c);}
	tpl void _p0(T k){if(k>=10)_p0(k/10);ptc(k%10+'0');}tpl void _p(T k){if(k<0){ptc('-');_p0(-k);}else _p0(k);}tpl void __p(T k){_p(k);ptc(' ');}
	tpl void _pn(T k){_p(k);ptc('\n');}template<class t1,class t2>void _p(t1 a,t2 b){__p(a);_pn(b);}
	template<class t1,class t2,class t3>void _p(t1 a,t2 b,t3 c){__p(a);__p(b);_pn(c);}
	template<class t1,class t2,class t3,class t4>void _p(t1 a,t2 b,t3 c,t4 d){__p(a);__p(b);__p(c);_pn(d);}
	tpl void op(T *a,int n){int i;n--;fo(i,n)__p(a[i]);_pn(a[n+1]);}int gi(){int x;_(x);ret x;}ll gll(){ll x;_(x);ret x;}
}
int gcd(int a,int b){ret b?gcd(b,a%b):a;}void fcl(){fclose(stdin);fclose(stdout);}
void fop(const char *s){char c[256],d[256];cl(c,0);cl(d,0);strcpy(c,s);strcpy(d,s);opi(strcat(c,".in"));opo(strcat(d,".out"));}
int eq(dou a,dou b){return a+eps>=b&&b+eps>=a;}tpl void _ma(T &a,T b){if(a<b)a=b;}tpl void _mi(T &a,T b){if(a>b)a=b;}
cint N=1234567,EE=100000000,GG=1000000000,ima=2147483647,p=998244353;
use io;
int n,m,k,T;
int ksm(int a,int b)
{
	if(!b)
		return 1;
	int t=ksm(a,b/2);
	t=(ll)t*t%p;
	return b%2?(ll)t*a%p:t;
}
int main()
{
	int i,j,a1,a2;
	_(n,m,k);
	if(n+m==2)
		_pn(k);
	else if(n==1||m==1)
		_pn(ksm(k,n+m-1));
	else
	{
		int an=0;
		//m=max(n,m);
		//n=t;
		fo(i,k)
			an=(an+(ll)ksm(i,n)*(ksm(k-i+1,m)-ksm(k-i,m)+p))%p;
		_pn(an);
	}
}

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


/**
*    author:  shu8Cream
*    created: 16.04.2021 21:45:44
**/

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        bool f = true;
        string ten = to_string(i+1);
        rep(j,ten.size()){
            if(ten[j]=='7') f = false;
        }
        string hati = "";
        int tmp = i+1;
        while(tmp!=0){
            if(tmp%8==7) f=false;
            tmp/=8;
        }
        if(f) ans++;
    }
    cout << ans << endl;
}

/* C++ */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pint;
const ll MAX = 510000;
const ll MOD = 1000000007;
#define rep(i, n) for(ll i = ll(0); i < ll(n); i++)
#define Rep(i, n) for(ll i = ll(1); i < ll(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265358979323846
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n"
ll fac[MAX], finv[MAX], inv[MAX];

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

bool palindrome(string s){
  bool flag=true;
  rep(i,(ll)s.size()) if(s[i]!=s[s.size()-1-i]) flag=false;
  return flag;
}

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}

ll Sint(ll n) {
  ll ans=0;
  while(n!=0) ans+=n%10,n/=10;
  return ans;
}

ll Svec(vector<ll> v){
  ll n=0;
  rep(i,(ll)v.size()) n+=v[i];
  return n;
}

ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}

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

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  rep(i,(ll)s.size()-1){
    if(s[i]==s[i+1]){
      x++;
      if(i==(ll)s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==(ll)s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}

ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

string Toupper(string s){
  string ans="";
  rep(i,s.size()){
    if('a'<=s[i] && s[i]<='z') ans+=(char)s[i]-32;
    else ans+=s[i];
  }
  return ans;
}
string Tolower(string s){
  string ans="";
  rep(i,s.size()){
    if('A'<=s[i] && s[i]<='Z') ans+=(char)s[i]+32;
    else ans+=s[i];
  }
  return ans;
}

void dis(vector<ll> v){ rep(i,v.size()) cout<<v[i]<<endl; }

void dis2(vector<vector<ll>> v){
  rep(i,v.size()){
    rep(j,v[0].size()) cout<<v[i][j]<<' ';
    cout<<endl;
  }
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  /* isPrime[1]=false; */
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

ll POW(ll a, ll n) {
  ll ret = 1;
  rep (i, n) ret *= a;
  return ret;
}

/*bool cmp(pint a, pint b) { return a.second < b.second; }*/

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n; cin >> n;
  vector<ll> x(n), y(n);
  rep (i, n) cin >> x[i] >> y[i];
  bool flag = false;
  rep (i, n) {
    for (ll j = i + 1; j < n; j++) {
      for (ll k = j + 1; k < n; k++) {
        ll dx = x[j] - x[i];
        ll dy = y[j] - y[i];
        ll sx = x[k] - x[j];
        ll sy = y[k] - y[j];
        if (sx * dy == dx * sy) flag = true;
      }
    }
  }
  ifYN(flag);
}


#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

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

long long n,k;
cin>>n>>k;
long long a[n];
long long count[n+1]={0};
for(long long i=0;i<n;i++){
  cin>>a[i];
  count[a[i]]++;
}
long long ans=0;
long long count2[n+1]={0};
count2[0]=min(k,count[0]);
for(long long i=1;i<n;i++){
count2[i]=min(count2[i-1],count[i]);
count2[i]=min(k,count2[i]);
}
long long count3=0;
long long count4=0;
for(long long i=n-1;i>=0;i--){

  if(count3<=k){
    if(count3<count2[i]){
    if(count3+count2[i]-count3<=k){

    ans+=(i+1)*(count2[i]-count3);
    count3+=count2[i]-count3;
  }
  else{
    ans+=(k-count3)*(i+1);
    break;
  }
}
}
else{
  break;
}
}
cout<<ans<<endl;
  return 0;
}

///****In the name of ALLAH, most Gracious, most Compassionate****//

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

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

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

#define ALL(a) a.begin(), a.end()
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define IN freopen("input.txt","r+",stdin)
#define OUT freopen("output.txt","w+",stdout)

#define DBG(a) cerr<< "line "<<__LINE__ <<" : "<< #a <<" --> "<<(a)<<endl
#define NL cout<<endl

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

const int N=3e5+5;
const int oo=1e9+7;
int a[N];
int32_t main()
{
    FastIO;
    int n,k;
    cin>>n>>k;

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    priority_queue < pair < int , int > > pq;
    for(int i=0;i<k;i++)
        pq.push({0,i});

    ll ans = 0;
    for(int i=0;i<n and ! pq.empty();i++)
    {
        while(!pq.empty())
        {
            auto x = pq.top();
            pq.pop();

            int now = - x.first ;

//            DBG(now);
//            DBG(a[i]);
//            NL;

            if(a[i] < now)
            {
                pq.push(x);
                break;
            }
            else if(a[i] == now)
            {
                pq.push({ - (now +1) , x.second});
                break;
            }
            else
            {
                ans+=now;
                continue ;
            }
        }
    }
    while(!pq.empty())
    {
        ans += -pq.top().first;
        pq.pop();
    }
    cout<<ans<<"\n";

}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    string s;
    string search = "ZONe";
    cin >> s;

    int count = 0;

    for (int i = 0; i < 9; i++)
    {
        //cout << s.substr(i, 4) << endl;

        if (s.substr(i, 4) == search)
            count++;
    }

    cout << count << endl;

    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define irreps(i, m, n) for (int i = ((int)(n)-1); i > (int)(m); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) (int)(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;
using ld = long double;

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

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

const ll INF = 1e9+10;
// const ll MOD = 1e9+7;
const ll MOD = 998244353;
const ll LINF = 1e18;

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

  string s; cin>>s;
  string x="ZONe";
  int n=s.size();
  ll ans=0;
  rep(i,n-3){
    if(s.substr(i,4)==x) ans++;
  }
  cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define clr(x) memset(x,0,sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define PI 3.1415926535897932384626
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
int mpow(int base,int exp);
void ipgraph(int n,int m);
void dfs(int u,int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];

void solve(){
  int n,w;
  cin >> n >> w;
  cout << (n/w);
}

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

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

  return 0;
}

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

    base = ((ll)base * base) % mod;
    exp >>= 1;
  }

  return result;
}

void ipgraph(int n,int m){
  int i, u, v;

  while(m--){
    cin >> u >> v;
    u-- , v--;
    g[u].pb(v);
    g[v].pb(u);
  }

}

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int c1 = 0, c2 = 0;
		for (int j = i; j < n; ++j) {
			if (s[j] == 'A') c1++;
			else if (s[j] == 'T') c1--;
			else if (s[j] == 'C') c2++;
			else c2--;
			if (c1 == 0 && c2 == 0) ans++;
		}
	}

	cout << ans << '\n';

	return 0;
}


//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/arc110/tasks/arc110_d

//参考：
//https://drken1215.hatenablog.com/entry/2020/12/06/070100
// ポイント：二項係数を扱う方法論として、経路数へと帰着する方法がある
// 積=かつ、和=行き先増やす
// 使った使わないを論じるといいかも

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;

#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

//https://github.com/atcoder-live/library/blob/master/mint.cpp
struct mint {
  LL x;
  mint(LL x=0):x((x%mod+mod)%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;//factに階乗を計算、ifactはその各々に対する逆元
  combination(LL n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (LL i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (LL i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(LL n,LL k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

LL N,M;
LL A[2000];

mint ans = 1;

void solve(){
    LL sum = 0;
    for(int i=0;i<N;i++) sum+=A[i];

    for(LL i=0;i<sum+N;i++){
        ans *= mint(M+N-i);
        ans /= mint(i+1LL);
    }
}

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

    solve();

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

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

int debug = 0;

const int N = 3e5, mod = 998244353;

int n, cnt = 0, clr = 1, ans, f[N], was[N];
vector <int> inv[N];

void dfs(int v) {
    if (was[v] == clr) return;
    was[v] = clr;
    dfs(f[v]);
    for (int i : inv[v]) dfs(i);
}

main() {
    cin >> n;
    rep(i, 1, n + 1) {
        cin >> f[i];
        inv[f[i]].push_back(i);
    }
    rep(i, 1, n + 1) {
        if (!was[i]) {
            ++cnt;
            dfs(i);
            clr++;
        }
    }
    ans = 1;
    rep(i, 0, cnt) {
        ans = ans + ans;
        while (ans >= mod) ans -= mod;
    }
    ans = (ans - 1 + mod) % mod;
    cout << ans << '\n';
}


#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

void mod_add(ll &a, ll b) {
	a += b;
	a %= MOD;
}

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

	ll n;cin >> n;
	vector<ll> v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));

	ll ans = 0;
	ll now = 0;
	ll pre = 0;
	REP(i, n) {
		pre = pre * 2 % MOD;
		mod_add(pre, now);
		now = v[i];
		mod_add(ans, v[i] * ((now + pre) % MOD));
	}

	cout << ans << endl;

	return 0;
}

// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
//#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
//using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//ordered_set 重複不可
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// use set_function + find_by_order(select itr-num)

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*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;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char Alpha[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

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

//cout << std::fixed << std::setprecision(15) << y << endl; //小数表示

const ll MOD = 998244353;

const ll MAX = 1000000; //テーブルの数

long long fac[MAX], finv[MAX], inv[MAX];
// finv ->階乗割り算
// fac ->階乗掛け算

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;
}

int n, m;

map<ll, ll> mp;

ll solve(ll sum){ //残りを計算する
  if(sum % 2 == 1){
      return 0;
  }
  if(mp.count(sum)){
      return mp[sum];
  }
  ll mid = 0;
  for(int i = 0; i <= n; i+=2){
      ll c = COM(n, i);
      if(sum - i < 0){
          break;
      }
      mid += c * solve((sum - i) / 2);
      mid %= MOD;
  }
  mp[sum] = mid;
  //cout << sum <<  " " << mid << endl;
  return mid;
}

int main(){
    COMinit();
    cin >> n >> m;
    if(m % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    mp[0] = 1;
    cout << solve(m) << endl;
}


#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;

int main(){
	string s;
	cin>>s;
	cout<<s[1]<<s[2]<<s[0];
	return 0;
}

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

int main() {
  string s;
  char w;
  cin >> s;
  w = s.at(0);
  for (int i = 0; i < s.size() - 1; i++) {
    s.at(i) = s.at(i + 1);
  }
  s.at(2) = w;

  cout << s;
}


#include <bits/stdc++.h>

#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i, n) for(ll i=n-1;i>=0;--i)
#define rep1(i, n) for(ll i=1; i<=n; ++i)
#define repitr(itr,mp) for(auto itr=mp.begin();itr!=mp.end();++itr)
#define ALL(a) (a).begin(),(a).end()

template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

using namespace std;
using ll  = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;

const ll MOD  = 998244353;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;
const double PI = 3.1415926535897932384626;

ll mod(ll a, ll m){return (a + m) % m;}

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

    ll cnt_odd = 0;
    rep(i, n){
        string s;
        cin >> s;
        ll cnt = 0;
        for(char c: s)if(c == '1')cnt++;

        if(cnt % 2)cnt_odd++;
    }

    cout << cnt_odd * (n - cnt_odd) << endl;

}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
#define int long long
int d[200];

signed main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>a[i];
    d[a[i]%200]++;
  }
  int ans=0;
  rep(i,200){
    if(d[i]>1){
      ans+=(d[i]*(d[i]-1)/2);
    }
  }
  cout<<ans<<endl;
  return 0;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

LL A,B,W;

int main()
{
//	freopen("1.in","r",stdin);
	cin>>A>>B>>W;
	W*=1000;
	LL ans=W/B;
	while(ans*B<W) ans++;
	if(A*ans>W) puts("UNSATISFIABLE");
	else {
		printf("%lld ",ans);
		ans=W/A;
		while((ans+1)*A<=W) ans++;
		printf("%lld\n",ans);
	}
	return 0;
}

#include <stack>
#include <queue>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <tuple>
#include <cmath>
#include <random>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include <numeric>

#define fio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
#define rng mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count())

#define ri(...) i64 __VA_ARGS__; rx(__VA_ARGS__)
#define rc(...) char __VA_ARGS__; rx(__VA_ARGS__)
#define rs(...) string __VA_ARGS__; rx(__VA_ARGS__)
#define rvi(x, n) vi x(n); cin >> x
#define rvvi(x, n, m) vvi x(n, vi(m)); cin >> x

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << '[' << #__VA_ARGS__ << "]: "; dbg_log(__VA_ARGS__)
#else
#define dbg(...) ;;
#endif

#define fa(i, v) for (auto &i : v)
#define fi(i, n) for (i32 i = 0; i < n; i++)
#define fp(i, n) for (i32 i = 1; i < n; i++)
#define fr(i, n) for (i32 i = n - 1; i >= 0; i--)
#define fu(_i) ri(i); fi(_i, i)

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#ifdef __SIZEOF_INT128__
typedef __uint128_t u128;
typedef __int128_t i128;
#endif
typedef vector<i64> vi;
typedef vector<vi> vvi;

template<typename T>
inline istream &operator>>(istream &in, vector<T> &v) {
    fa(x, v) in >> x;
    return in;
}

template<typename T>
inline ostream &operator<<(ostream &out, const vector<T> &v) {
    fa(x, v) out << x << ' ';
    return out;
}

template<typename T>
inline void rx(T &x) {
    cin >> x;
}

template<typename T, typename... R>
inline void rx(T &x, R &... l) {
    cin >> x;
    rx(l...);
}

template<typename T>
inline void dbg_log(const T &x) {
    cerr << x << endl;
}

template<typename T, typename... R>
inline void dbg_log(const T &x, const R &... l) {
    cerr << x << ", ";
    dbg_log(l...);
}

template<typename T>
inline void wl(const T &x) {
    cout << x << '\n';
}

template<typename T, typename... R>
inline void wl(const T &x, const R &... l) {
    cout << x << ' ';
    wl<R...>(l...);
}

int main() {
    fio;

    ri(a, b, w);
    w = w * 1000;
    bool good = false;
    i32 mn = 0;
    i32 mx = 0;
    fp(i, 1000001) {
        if (a * i <= w && w <= b * i) {
            if (!good) {
                good = true;
                mn = i;
                mx = i;
            } else {
                mx = i;
            }
        }
    }

    if (good) {
        wl(mn, mx);
    } else {
        wl("UNSATISFIABLE");
    }

    return 0;
}