#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <random>
#include <numeric>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<double> VD;

int main() {
    //freopen("test.in","r",stdin);
    int64 b,c;
    cin >> b >> c;
    vector<pair<int64,int64> > seg;
    seg.PB({b-c/2, 1}); seg.PB({b+1, -1});
    if (c>=1) { seg.PB({-b-(c-1)/2, 1}); seg.PB({-b+(c-1)/2+1, -1}); }
    if (c>=2) { seg.PB({b-(c-2)/2, 1}); seg.PB({b+(c-2)/2+1, -1}); }
    sort(ALL(seg));
    int64 cov=0,y=-3e18;
    int64 r=0;
    for (auto [x, t] : seg) {
        if (cov>0) r+=x-y;
        cov+=t;
        y=x;
    }
    cout << r << endl;
    return 0;
}

#include <bits/stdc++.h>

const long long INF = 1e9;
const long long MOD = 1e9 + 7;
//const long long MOD = 998244353;
const long long LINF = 1e18;
using namespace std;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define COUT(x) cout<<(x)<<endl
#define SCOUT(x) cout<<(x)<<" "
#define VECCOUT(x) for(auto&youso_: (x) )cout<<right<<setw(10)<<youso_<<" ";cout<<endl
#define ENDL cout<<endl
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) long long __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define mp make_pair
#define PQ priority_queue<long long>
#define PQG priority_queue<long long,V,greater<long long>>

typedef long long ll;
typedef vector<long long> vl;
typedef vector<long long> vi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef pair<long long, long long> pll;

#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
template<class T>
void mod(T &x) {
    x %= MOD;
    x += MOD;
    x %= MOD;
}

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

struct COMB{
    vl fact, fact_inv, inv;
    void init_nCk(long long SIZE) {
        fact.resize(SIZE + 5);
        fact_inv.resize(SIZE + 5);
        inv.resize(SIZE + 5);
        fact.at(0) = fact.at(1) = fact_inv.at(0) = fact_inv.at(1) = inv.at(1) = 1;
        for(long long i = 2; i < SIZE + 5; i++) {
            fact.at(i) = fact.at(i - 1)*i%MOD;
            inv.at(i) = MOD - inv.at(MOD%i)*(MOD/i)%MOD;
            fact_inv.at(i) = fact_inv.at(i - 1)*inv.at(i)%MOD;
        }
    }
    long long nCk (long long n, long long k) {
        assert(!(n < k));
        assert(!(n < 0 || k < 0));
        return fact.at(n)*(fact_inv.at(k)*fact_inv.at(n - k)%MOD)%MOD;
    }
};
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}

void Main() {

    ll ans = LINF;
    LCIN(N);
    vl X(N);
    VECCIN(X);
    vl l{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
    for(int i = 0; i < (1 << 15); i++) {
        vl c(N, 1);
        for(int j = 0; j < N; j++) {
            bool check = 0;
            for(int k = 0; k < 15; k++) {
                if(i & (1 << k)) {
                    if(GCD(l.at(k), X.at(j)) != 1) check = 1;
                }
            }
            if(check) c.at(j) = 0;
        }
        ll memo = 1;
        for(int j = 0; j < N; j++) {
            if(c.at(j)) {
                memo = 0;
            }
        }
        if(memo == 0) continue;
        ll tmp = 1;
        for(int j = 0; j < 15; j++) {
            if(i & (1 << j)) {
                tmp *= l.at(j);
            }
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
#define endl "\n"
#define optimize() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define pb push_back
#define testcase ll t; cin>>t; while(t--)
using namespace std;
int main() {
  optimize();
  ll n;
  cin>>n;
  ll cnt = 0, ans = 0;
  for(ll i = 0; i < 1000000000; i++) {
    cnt += i;
    if (cnt >= n) {
      ans = i;
      break;

    }
  }
  cout<<ans<<endl;
}

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 1e18;
    rep(i,1<<20)
    {
        ll bit = i;
        ll tmp = a[0];
        vector<ll> v;
        rep(j,n-1)
        {
            ll bit1 = bit & (1<<j);
            ll bit2 = bit & (1<<(j+1));

            if(bit1*2 == bit2)
            {
                tmp = tmp | a[j+1];
            }
            else
            {
                v.emplace_back(tmp);
                tmp = a[j+1];
            }
        }
        v.emplace_back(tmp);
        ll now = 0;
        for(auto vi:v) now = now ^ vi;
        ans = min(ans,now);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
	{
	string str;

	cin >> str;

	vector<int> dig(10, 0);
	for(int i=0; i < str.size(); i++)
		dig[str[i]-'0']++;

	for(int i=0; i < 10; i++)	dig[i] = min(dig[i], 3);

	vector<int> pos;
	for(int i=0; i < 10; i++)	for(int j=0; j < dig[i]; j++)	pos.push_back(i);

	int size = pos.size();

	if(size == 1)
		{
		if(pos[0]%8==0)
			{
			cout << "Yes" << endl;
			return 0;
			}
		}
	else if(size==2)
		{
		int a=pos[0], b=pos[1];
		if((a+2*b)%8==0 || (b+2*a)%8==0)
			{
			cout << "Yes" << endl;
			return 0;
			}
		}
	else
		{
		for(int i=0; i < size; i++)
			for(int j=0; j < size; j++)
				if(j!=i)
					for(int k=0; k < size; k++)
						if(k!=i && k!=j)
							if((pos[i]+2*pos[j]+4*pos[k])%8==0)
								{
								cout << "Yes" << endl;
								return 0;
								}
		}

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

/* author:hellojim */
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	int x;
	cin>>x;
	if(x<0)x=0;
	cout<<x<<endl;
	return 0;
}


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

using namespace std;
using namespace __gnu_pbds;

//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first

typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef unsigned long long ull;
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;
typedef long long ll;
typedef double db;

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

const int inf = 1e9, maxn = 2e5 + 48, mod = 998244353, N = 5012;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 300;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = acos(-1);
const ll INF = 1e18;

void add (int &x, int y) {
	x += y;
	if (x >= mod)
		x -= mod;
}

int n, m, dp[N][N], pw[N][N], s[N];

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

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

	for (int len = 1; len < N; ++len)
		for (int i = 1; i <= m; ++i) {
			dp[len][i] = pw[m - 1][len] - pw[m - i][len];
			if (dp[len][i] < 0)
				dp[len][i] += mod;
			add(s[len], dp[len][i]);
		}

	int ans = 0;
	for (int l = 1; l <= n; ++l) {
		for (int r = l + 2; r <= n; ++r)
			add(ans, pw[m][l - 1] * 1ll * s[r - l - 1] % mod * pw[m][n - r] % mod);

		add(ans, pw[m - 1][l - 1] * 1ll * m % mod * pw[m][n - l] % mod);
	}

	cout << ans << endl;

}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

double dp[101][101][101];

double rec(int i, int j, int k){
    if(i >= 100 || j >= 100 || k >= 100) return 0;
    if(dp[i][j][k] > -1) return dp[i][j][k];
    dp[i][j][k] = 1;
    int s = i+j+k;
    dp[i][j][k] += double(i)/double(s)*rec(i+1, j, k);
    dp[i][j][k] += double(j)/double(s)*rec(i, j+1, k);
    dp[i][j][k] += double(k)/double(s)*rec(i, j, k+1);
    return dp[i][j][k];
}

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    rep(i, 101) rep(j, 101) rep(k, 101) dp[i][j][k] = -2;
    cout << sp(15) << rec(A, B, C) << endl;
}


// R SAI KRISHNA
#include <bits/stdc++.h>
#define for0(i, n) for (int i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (ll)(n); ++i)
#define forc(i, l, r) for (int i = (ll)(l); i <= (ll)(r); ++i)
#define forr0(i, n) for (int i = (ll)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (ll)(n); i >= 1; --i)
#define pb push_back
#define fi first
#define debug(x) cout << #x << " -> " << x << endl;
#define endl '\n'
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define sz(a) ll((a).size())
#define mod 1000000007
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

void debug_vec(vector<ll>&v){
    cout << '[';
    for(auto i:v)cout << i << ", "; cout << "]";
    cout << "\n";
}

void debug_set(set<ll>&st){
    cout << "{";
    for(auto i:st)cout << i << ", ";
    cout << "}";
    cout << "\n";
}

void fast()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

bool prime[1000001];
void sieve()
{
  memset(prime, true, sizeof(prime));
  prime[1]=false;
  for (int p=2; p*p<=1000000; p++)
  {
    if (prime[p] == true)
    {
        for (int i=p*p; i<=1000000; i += p)
                prime[i] = false;
    }
  }
}

void print(bool f){
    if(f)cout << "YES\n";
    else cout << "NO\n";
}

void google(int x){
    cout << "Case #" << x << ": " ;
}
void input_array(vector<ll>&arr){
    for(auto &i : arr){
        cin >> i;
    }
}
void solve()
{
    long double x,y,r;
    cin >> x >> y >> r;
    r += (1e-14);
    long double lx,rx,ly,ry;
    lx = ceil(x - r);
    rx = floor(x + r);
    ll sum = 0;
    for(int i = lx ;i <= rx ; i++) {
        long double res = ((long double)(sqrtl((long double)(r*r) - (long double)(x - i)*(x - i))));
        ll left_limit = ceil(y - res);
        ll right_limit = floor(y + res);
        sum += (ll)(right_limit - left_limit + 1) ;
    }
    cout << sum << endl;
}

int main()
{
  fast();
  /*ll t;
  cin >> t;
  for(int tt = 1;tt <= t ;tt++)*/
  solve();

return 0;
}

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int MAX = 200000;
const int DECIMAL = 10000;

long long solve(long long cy, long long cx, long long r)
{
    cx = ((cx % DECIMAL) + DECIMAL) % DECIMAL;
    cy = ((cy % DECIMAL) + DECIMAL) % DECIMAL;

    long long ans = 0;
    for(int y=(cy+DECIMAL-1)/DECIMAL*DECIMAL; y<cy+r; y+=DECIMAL){
        long long left = cx;
        long long right = cx + r;
        while(left < right){
            long long x = (left + right + 1) / 2;
            long long dy = y - cy;
            long long dx = x - cx;
            if(dy * dy + dx * dx <= r * r)
                left = x;
            else
                right = x - 1;
        }
        ans += left / DECIMAL;
    }
    return ans;
}

int main()
{
    double cy0, cx0, r0;
    cin >> cx0 >> cy0 >> r0;

    long long cy = (long long)round(cy0 * DECIMAL);
    long long cx = (long long)round(cx0 * DECIMAL);
    long long r = (long long)round(r0 * DECIMAL);

    long long ans = 0;
    if(cx % DECIMAL == 0 && cy % DECIMAL == 0)
        ++ ans;

    for(int i=0; i<4; ++i){
        ans += solve(cy, cx, r);
        swap(cx, cy);
        cy *= -1;
    }
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define DB double
#define U unsigned
#define P std::pair
#define LL long long
#define LD long double
#define pb emplace_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 1e6 + 5;
LL res[MAXN];

int main(){
	int l,r;scanf("%d%d",&l,&r);
	LL ans = 0;
	FOR(g,2,r){
		int len = r/g - (l-1)/g;
		res[g] = 1ll*len*len;
	}
	ROF(i,r,2){
		for(int j = i+i;j <= r;j += i) res[i] -= res[j];
	}
	FOR(i,2,r) ans += res[i];
	FOR(g,l,r){
		if(g == 1) continue;
		ans -= 2*(r/g) - 1;
	}
	printf("%lld\n",ans);
	return 0;
}
// gcd = i 的数的个数

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

#define N 1000001
#define int1 long long int

int1 lpf[N], mobius[N];

void least_prime_factor()
{
	for (int1 i = 2; i < N; i++)
		if (!lpf[i])
			for (int1 j = i; j < N; j += i)
				if (!lpf[j])		lpf[j] = i;
}

void Mobius()
{
	for (int1 i = 1; i < N; i++) {
		if (i == 1)			mobius[i] = 1;
		else {
			if (lpf[i / lpf[i]] == lpf[i])		mobius[i] = 0;
			else                				mobius[i] = -1 * mobius[i / lpf[i]];
		}
	}
}

int1 gcd_pairs(int1 a[], int1 n)
{
	int1 maxi = 0;
	int1 fre[N] = { 0 };
	for (int1 i = 0; i < n; i++) {
		fre[a[i]]++;
		maxi = max(a[i], maxi);
	}
	least_prime_factor();
	Mobius();
	int1 ans = 0;
	for (int1 i = 1; i <= maxi; i++) {
		if (!mobius[i])
			continue;
		int1 temp = 0;
		for (int1 j = i; j <= maxi; j += i)
			temp += fre[j];
    	ans += temp * (temp - 1) / 2 * mobius[i];
	}
	return ans;
}

int main()
{
    int1 l , r;
    cin>>l>>r;
    int1 a[r-l+1];
	for(int1 i=0;i<=r-l;i++)   a[i] = i+l;
	int1 n = r-l+1;

	int1 x = 2*gcd_pairs(a, n);
	int1 total = (r-l)*(r-l+1);
	int1 y = 0;

	for(int1 i=0;i<=(r-l)/2;i++)
	{
	    int1 tmp = a[i];
	    for(int1 j=i+tmp; j<=r-l; j += tmp)   y++;
	}

    if(a[0] == 1)   y -= r-l;
    y *= 2;
	cout<<total-x-y<<endl;

	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937/*_64*/ rng(chrono::steady_clock::now().time_since_epoch().count());
#define printArr(arr, n) cerr << #arr << " = ["; for(int i=0; i<(n); i++){if (i) cerr << ", "; cerr << arr[i];} cerr << "]\n"
template<class A> ostream& operator<<(ostream &cout, vector<A> const &v) {cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";};
template<class A, class B> ostream& operator<<(ostream &cout, const pair<A,B> &x) {return cout << "(" <<x.first << ", " << x.second << ")";};
void _print() {cerr << "]\n";}
template <class T, class... V> void _print(T t, V... v) {cerr << t; if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#define fi first
#define se second
#define SZ(x) (int)((x).size())
#define pii pair<int,int>
vector<int> place[26];
vector<int> pos[26];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int n = SZ(s);
	for (int q = 0; q < n; q++) {
		pos[s[q]-'a'].push_back(q);
	}
	for (int q = n-2; q >= 0; q--) {
		if (s[q] == s[q+1]) {
			place[s[q]-'a'].push_back(q);
		}
	}
	for (int q = 0; q < 26; q++) {
		place[q].push_back(n);
		sort(place[q].begin(), place[q].end());
	}
	ll ans = 0;
	for (int q = 0; q < 26; q++) {
		for (int w = 0; w < SZ(place[q]); w++) {
			if (w == SZ(place[q])-1) {
				continue;
			} else {
				if (place[q][w]+1==place[q][w+1]) continue;
				bool between = false;
				int last = n;
				for (int e = 0; e < 26; e++) {
					if (q == e) continue;
					auto it = upper_bound(place[e].begin(), place[e].end(), place[q][w]);
					if (*it < place[q][w+1]) {
						between = true;
						last = min(last, *it);
					}
				}
				if (between) {
					ll x = n-2-place[q][w];
					ll lo = upper_bound(pos[q].begin(), pos[q].end(), place[q][w]+1)-pos[q].begin();
					ll hi = lower_bound(pos[q].begin(), pos[q].end(), last)-pos[q].begin();
					hi--;
					ll dif = max(0LL,hi-lo+1);
					x -= dif;
					ans += x;
					continue;
				}
				ll x = place[q][w+1]-place[q][w]-2;
				ll lo = upper_bound(pos[q].begin(), pos[q].end(), place[q][w]+1)-pos[q].begin();
				ll hi = lower_bound(pos[q].begin(), pos[q].end(), place[q][w+1]) - pos[q].begin();
				hi--;
				ll dif = max(0LL,hi-lo+1);
				x -= dif;
				ans += x;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)
#define popcount __builtin_popcount

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,7)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

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

struct UnionFind {
  vector<ll> par, s, e;
  UnionFind(ll N) : par(N), s(N), e(N) { rep(i,N) { par[i] = i; s[i] = 1; e[i] = 0; } }
  ll root(ll x) { return par[x]==x ? x : par[x] = root(par[x]); }
  ll size(ll x) { return par[x]==x ? s[x] : s[x] = size(root(x)); }
  void unite(ll x, ll y) {
    ll rx=root(x), ry=root(y);
    if (rx!=ry) { s[rx] += s[ry]; e[rx] += e[ry]+1; par[ry] = rx; }
    else e[rx]++;
  }
  bool same(ll x, ll y) {  ll rx=root(x), ry=root(y); return rx==ry; }
};

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

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

  ll MA = 400010;
  UnionFind uf(MA);
  rep(i,N) uf.unite(a[i],b[i]);
  ll result = 0; rep(i,MA) if (uf.root(i)==i) result += min(uf.s[i],uf.e[i]);
  cout << result << endl;
  return 0;
}


/*

 ALLAH IS ALMIGHTY              ******BISMILLAHIR RAHMANIR RAHIM.******              ALLAH IS ALMIGHTY
                                    ```````````````````````````````
                                        AUTHOR: ANISUR RAHAMAN
                                            BSMRSTU(SHIICT)
                                                ID:017

                            ............LET's START OUR JOURNEY.............

*/
#include <bits/stdc++.h>

#define I_O ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

//~~~~~~~~~~~~ Sort Form Of Long~~~~~~~~~~~//
#define ll long long int
#define lls int64_t
#define ld long double
#define db double
#define ull unsigned long long int

//~~~~~~~~~~~~~~Pair~~~~~~~~~~~~~~~~~~//
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<db,db>
#define psi pair<string,int>
#define vi vector<int>
#define vl vector<ll>
#define vd vector<db>
#define vs vector<string>
#define vb vector<bool>
#define vpi vector<pii>
#define vpl vector<pll>
#define vpd vector<pdd>
#define vpsi vector<psi>

//~~~~~~~~~~~~~~Vector~~~~~~~~~~~~~~~~~//
#define pb push_back
#define pf push_front
#define MP make_pair
#define in insert
#define ff first
#define ss second
#define al(v) v.begin(),v.end()
#define alr(v) v.rbegin(), v.rend()
#define srt(v) sort(al(v))
#define srtr(v) sort(al(v), greater<int>());
#define len(x) ((ll)(x).length())
#define sz(x) ((ll)(x).size())
#define rev(v) reverse(al(v))
#define btcnt(n) __builtin_popcount(n)
#define acl(v, n) accumulate(al(v), n)
#define eb emplace_back
#define lb(v, kk) lower_bound(al(v), kk)
#define ub(v, kk) upper_bound(al(v), kk)
#define tpu(str) transform(al(str), str.begin(), ::toupper)
#define tpl(str) transform(al(str), str.begin(), ::tolower)
#define cignr cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define mxv(v) *max_element(al(v))
#define mnv(v) *min_element(al(v))

const int MOD = 1e9 + 7;
const ll INF = 2e18;
const int mxn = 2e9 + 9;
const int mxd = 2e5 + 5;
const int mxa = 1e5 + 5;

//~~~~~~~~~~~~~~~~~~Function~~~~~~~~~~~~~~~~~~~~//
lls gcd(lls a, lls b){
    if(b == 0LL) return a;
    return gcd(b, a % b);
}

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

//~~~~~~~~~~~~~~~Loops and Short~~~~~~~~~~~~~~~~//

#define PI acos(-1)
#define Cn continue
#define Br break
#define off return 0
#define N '\n'
#define WT(something) auto az = something; cout << az << N;
#define WTS(something) cout << something << N;
#define rep(i, n) for(lls i = 0; (lls)i < n; i++)
#define repn(i, a, b) for(lls i = (lls)(a); i < (lls)(b); i++)
#define repr(i, a, b) for(lls i = (lls)(a) - 1; i >= (lls)(b); i--)
#define test_case() int T; T = 1; while(T--)

using namespace std;

lls maxll(lls x, lls y){ return x > y ? x : y; }
lls minll(lls x, lls y){ return x < y ? x : y; }
// ===================================~~~~~~ SOLUTION STARTS HERE ~~~~~~=================================== //

//int a, b, c, d, e, res = 0, ans = 0, prod = 1, n, m, cnt = 0, k, l, r, s, t, x, y, f, i, j, p;

void Run_Case()
{
    lls n, k;
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        if (n % 200 == 0) n /= 200;
        else {
            string str = to_string(n);
            str += "200";
            n = stoll(str);
        }
    }

    cout << n << N;
}

int main()
{
    I_O
    test_case()
    {
        Run_Case();
    }

    off;
}

#include<bits/stdc++.h>
#define inf 1e18
#define ll long long
#define endl "\n"
#define pb(a)  push_back(a)
#define mp(x,y) make_pair(x,y)
#define instr(str) string str; cin>>str;
#define loop(i,x,y) for(int i = x; i < y ; i++ )
#define rev(i,x,y) for(int i = x; i >= y ; i--)
#define in(n)       int n; cin>>n;
#define tc int t;cin>>t;while(t--)
#define inarr(arr,n) int arr[n]; for(int i = 0; i < n ; i++){cin>>arr[i];}
#define ff first
#define sec second
#define mem(a,c) mvemset(a,c,sizeof(a))
#define bitcount(x) __builtin_popcountll(x)
#define maploop(x) for(auto itr = x.begin(); itr != x.end();itr++)
int mod = 1000000007;
#define int long long
using namespace std;
bool isp(int x) {
	for (int i = 2; i * i <= x; ++i)
		if (x % i == 0) return false;
	return true;
}
void pog()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.first > b.first);
}
// bool prime[1000000 + 1];
// void SieveOfEratosthenes()
// {
// 	memset(prime, true, sizeof(prime));

// 	prime[1] = false;

// 	for (int p = 2; p * p <= 10000000; p++) {

// 		// If prime[p] is not changed, then it is a prime
// 		if (prime[p] == true) {

// 			// Set all multiples of p to non-prime
// 			for (int i = p * 2; i <= 10000000; i += p)
// 				prime[i] = false;
// 		}
// 	}
// }
bool prime_check(int n)
{
	bool flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {

		// If n is divisible by any number between
		// 2 and n/2, it is not prime
		if (n % i == 0) {
			flag = 0;
			break;
		}
	}
	return flag;
}
long long power( long long x,
                 int y, int p)
{
	long long res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0) {
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res * x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x * x) % p;
	}
	return res;
}
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

/*************************************************************************/
void Main()
{
	in(n)
	inarr(arr, n)
	inarr(arr1, n)
	int res[n];
	res[0] = arr[0] * arr1[0];
	int maxi[n];
	maxi[0] = arr[0];
	loop(i, 1, n)
	{
		maxi[i] = max(maxi[i - 1], arr[i]);
	}
	loop(i, 1, n)
	{
		res[i] = max(res[i - 1], arr[i] * arr1[i]);
		res[i] = max(res[i], maxi[i - 1] * arr1[i]);
	}
	loop(i, 0, n)
	{
		cout << res[i] << endl;
	}
}

int32_t main()

{
	srand(time(0));
	pog();
	int t = 1 ;
	// int t;
	// cin >> t;
	while (t--)
	{
		Main();
	}

#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
}


#include <bits/stdc++.h>
using namespace std;
// #include<atcoder/all>
// using namespace atcoder;
using ll = long long;
#define rep(i, e) for (ll i = (ll)0; i < (ll)e; i ++)
#define repd(i, s) for (ll i = (ll)s; i > (ll)0; i--)
#define reps(i, s, e, p) for (ll i = (ll)s; i < (ll)e; i += p)
#define repsd(i, s, e, p) for (ll i = (ll)s; i > (ll)e; i -= p)
#define ALL(vec) vec.begin(), vec.end()

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

    int t, a, b, r = 0;
    rep (i, q){
        cin >> t >> a >> b;
        if (t == 1){
            if (r == 0){
                swap(s[a - 1], s[b - 1]);
            }else{
                if (a <= n) a += n;
                else a -= n;

                if (b <= n) b += n;
                else b -= n;

                swap(s[a - 1], s[b - 1]);
            }
        }else r = 1 - r;
    }

    cout << (r == 0 ? s.substr(0, n) + s.substr(n, n) : s.substr(n, n) + s.substr(0, n)) << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  float n, D, H; cin >> n >> D >> H;
  float ans = 0;
  for (int i = 0; i < n; i++){
    float d, h; cin >> d >> h;
    ans = max(ans, H - (D * (H - h) / (D - d)));
  }
  cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
const ll INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

    int scnt = 0;
    int tcnt = 0;
    vector<ll> sindex;
    vector<ll> tindex;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == '1')
        {
            scnt++;
            sindex.push_back(i);
        }
        if (t[i] == '1')
        {
            tcnt++;
            tindex.push_back(i);
        }

        // if (scnt > tcnt)
        // {
        //     cout << -1 << endl;
        //     return 0;
        // }
    }

    if (scnt < tcnt)
    {
        cout << -1 << endl;
        return 0;
    }
    if ((scnt - tcnt) % 2 != 0)
    {
        cout << -1 << endl;
        return 0;
    }

    ll cnt = 0;

    int j = 0;
    for (int i = 0; i < tcnt; i++)
    {
        vector<ll> now;

        if (j >= scnt)
        {
            cout << -1 << endl;
            return 0;
        }
        while (sindex[j] < tindex[i])
        {
            now.push_back(sindex[j]);
            j++;
            if (j >= scnt)
            {
                cout << -1 << endl;
                return 0;
            }
        }
        if (now.size() % 2 == 1)
        {
            now.push_back(sindex[j]);
            j++;
        }

        if (j >= scnt)
        {
            cout << -1 << endl;
            return 0;
        }

        for (int k = 0; k < now.size(); k += 2)
        {
            cnt += now[k + 1] - now[k];
        }

        cnt += sindex[j] - tindex[i];
        j++;

        // cout << j << " " << cnt << endl;
    }

    for (int i = j; i < scnt; i += 2)
    {
        cnt += sindex[i + 1] - sindex[i];
    }

    cout << cnt << endl;
}

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

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

    long long int ans = 0;
    queue<int> q;
    for(int i=0; i<n; i++){
        if(q.empty() == false && s[i] == '1'){
            ans += i - q.front();
            q.pop();
            s[i] = '0';
        }
        if(s[i] != t[i]) q.push(i);
    }
    if(q.empty() == false) cout << -1  << endl;
    if(q.empty() == true)  cout << ans << endl;
    return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n,q;
	cin>>n>>q;
	unordered_map<ll,ll> m;
	vector<ll> a(n);
	for(ll i=0;i<n;i++)
	{
	    cin>>a[i];
	    m[a[i]]++;
	}
	sort(a.begin(),a.end());
	while(q--)
	{
	    ll d;
	    cin>>d;
	    ll l=0,r=(1100000000000000000);
	    while(r-l > 1)
	    {
	        ll m = (l+r)/2;
	        ll cnt = upper_bound(a.begin(),a.end(),m)-a.begin();
	        if(m - cnt >= d)
	        {
	            r=m;
	        }
	        else
	        {
	            l=m;
	        }
	    }
	    cout<<r<<"\n";
	}
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); ++i)

ll INF = 1ll << 60;

int main(){
    ll n, q;
    cin >> n >> q;
    vl a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    vector<pll> k(q);
    rep(i, 0, q){
        ll t;
        cin >> t;
        k[i] = {t, i};
    }
    sort(k.begin(), k.end());

    vl ans(q);
    int id = 0;
    rep(i, 0, q){
        ll t = k[i].first;
        if(id == 0){
            if(a[0]-1 >= t){
                ans[k[i].second] = t;
                continue;
            }
        }
        while(id < n-1 && a[id+1]-(id+2) < t){
            id++;
        }
        ans[k[i].second] = t+id+1;
    }

    rep(i, 0, q){
        cout << ans[i] << endl;
    }

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

template <typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template <typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template <typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template <typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << '['; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <typename T, size_t sz> ostream &operator<<(ostream &os, const array<T, sz> &arr) { os << '['; for (auto v : arr) os << v << ','; os << ']'; return os; }
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T, typename TH> ostream &operator<<(ostream &os, const unordered_set<T, TH> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) { os << '(' << pa.first << ',' << pa.second << ')'; return os; }
template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
template <typename TK, typename TV, typename TH> ostream &operator<<(ostream &os, const unordered_map<TK, TV, TH> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }

// #define DEBUG

#ifdef DEBUG
const string COLOR_RESET = "\033[0m", BRIGHT_GREEN = "\033[1;32m", BRIGHT_RED = "\033[1;31m", BRIGHT_CYAN = "\033[1;36m", NORMAL_CROSSED = "\033[0;9;37m", RED_BACKGROUND = "\033[1;41m", NORMAL_FAINT = "\033[0;2m";
#define dbg(x) cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << " in " << __FILE__ << ")" << COLOR_RESET << endl
#else
#define dbg(x) (x)
#endif

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

	vector<pair<ull, ull>> bag(N);  // first: value, second: size
	REP(n, N) cin >> bag[n].second >> bag[n].first;
	sort(bag.begin(), bag.end());

	vector<ull> X(M);
	REP(m, M) cin >> X[m];

	REP(q, Q) {
		int L, R;
		cin >> L >> R;
		--L;

		vector<ull> box;
		REP(m, L) box.push_back(X[m]);
		FOR(m, R, M) box.push_back(X[m]);
		sort(box.begin(), box.end());

		ull ans = 0;
		vector<bool> used(box.size(), false);
		REPR(n, N) {
			ull value = bag[n].first, size = bag[n].second;

			REP(m, box.size()) {
				if (used[m]) continue;
				if (box[m] < size) continue;
				ans += value;
				used[m] = true;
				break;
			}
		}

		cout << ans << endl;
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif

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

    int n, k;
    cin >> n >> k;

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

    sort(a.begin(), a.end());
    vector<vector<int>> b(k);

    for (int i = 0; i < n; i++) {
        int j = i;
        while (j < n && a[i] == a[j])
            j++;
        j--;
        for (int q = i; q <= j && q - i < k; q++)
            b[q - i].push_back(a[i]);
        i = j;
    }

    ll res = 0;

    for (const auto& ar : b) {
        unordered_set<int> q(ar.begin(), ar.end());
        int cur = 0;
        while (q.count(cur))
            cur++;
        res += cur;
    }

    cout << res << "\n";

    return 0;
}


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

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

  long long sum =0;
  for(int i=0;i<N;i++){
    long long a,b;
    cin >> a >> b;
    sum += ((a+b)*(b-a+1))/2;
  }
  cout << sum << endl;
}

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 998244353
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 110
using namespace std;
ll n;
bool vis[N];
vector<ll> vt[N];
vector<pair<ll,ll> > nail;
double calc_dist(ll x1,ll y1,ll x2,ll y2)
{
	return sqrt((double)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
}
bool reach(ll x,ll dest)
{
	if(x==dest)
	{
		return true;
	}
	vis[x]=true;
	ll i;
	for(i=0;i<vt[x].size();i++)
	{
		if(vis[vt[x][i]])
		{
			continue;
		}
		if(reach(vt[x][i],dest))
		{
			return true;
		}
	}
	return false;
}
bool check(double mx_d)
{
	mx_d*=2;
	double dist;
	ll i,j;
	//n is the upper edge, n+1 is the lower edge
	for(i=0;i<N;i++)
	{
		vt[i].clear();
	}
//	cout<<mx_d<<endl;
	memset(vis,false,sizeof(vis));
	for(i=0;i<n;i++)
	{
		dist=calc_dist(nail[i].F,nail[i].S,nail[i].F,100);
	//	cout<<dist<<" ";
		if(dist<mx_d)
		{
			vt[i].push_back(n);
			vt[n].push_back(i);
		}
		dist=calc_dist(nail[i].F,nail[i].S,nail[i].F,-100);
	//	cout<<dist<<endl;
		if(dist<mx_d)
		{
			vt[i].push_back(n+1);
			vt[n+1].push_back(i);
		}
		for(j=i+1;j<n;j++)
		{
			dist=calc_dist(nail[i].F,nail[i].S,nail[j].F,nail[j].S);
			if(dist<mx_d)
			{
				vt[i].push_back(j);
				vt[j].push_back(i);
			}
	//		cout<<i<<","<<j<<": "<<dist<<endl;
		}
	}
//	puts("");
	if(reach(n,n+1))
	{
		return false;
	}
	return true;
}
int main(){
	ll i,x,y;
	double l,r,mid;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lld%lld",&x,&y);
		nail.push_back(make_pair(x,y));
	}
	l=0;
	r=100;
	while(l+0.0000000001<r)
	{
		mid=(l+r)/2;
		if(check(mid))
		{
			l=mid;
		}
		else
		{
			r=mid;
		}
	}
	printf("%.16f",l);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define flush cout.flush

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pl = pair<ll, ll>;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;
const ll mod2 = 998244353;
const ld eps = 1e-9;
const ld PI = acos(-1);

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll X;
    cin >> X;
    vector<ll> a(n);
    for (ll &i : a) cin >> i;
    ll res = INF * INF;
    for (ll k = 1; k <= n; ++k) {
        vector<vector<ll>> dp(k + 1, vector<ll>(k + 1, -1));
        dp[0][0] = 0;
        for (auto x : a) {
            vector<vector<ll>> new_dp(k + 1, vector<ll>(k + 1, -1));
            new_dp[0][0] = 0;
            for (ll i = 1; i <= k; ++i) {
                for (ll j = 0; j < k; ++j) {
                    ll back = ((j - x) % k + k) % k;
                    new_dp[i][j] = dp[i][j];
                    if (dp[i - 1][back] == -1)continue;
                    new_dp[i][j] = max(new_dp[i][j], dp[i - 1][back] + x);
                }
            }
            dp = new_dp;
        }
        if (dp[k][X % k] == -1)continue;
        res = min(res, (X - dp[k][X % k]) / k);
    }
    cout << res << "\n";
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

struct math {
  __int128 Tgcd(__int128 a, __int128 b) {
    if (b == 0) {
      return a;
    } else {
      return Tgcd(b, a % b);
    }
  }
  __int128 d = 0;
  pair<__int128, __int128> gcd(__int128 a, __int128 b) {
    if (b == 0) {
      d = a;
      return {1, 0};
    } else {
      pair<__int128, __int128> it = gcd(b, a % b);
      return {it.second, it.first - a / b * it.second};
    }
  }
  pair<__int128, __int128> coef(__int128 a, __int128 b, __int128 c) {
    auto it = gcd(a, b);
    if (c % d) return {0, 0};
    it.first *= (c / d);
    it.second *= (c / d);
    return it;
  }
  __int128 crt(__int128 m1, __int128 m2, __int128 r1, __int128 r2) {
    pair<__int128, __int128> it = coef(m1, -m2, r2 - r1);
    __int128 t = m1 * it.first + r1, mod = m1 * m2 / abs(d);
    t %= mod;
    if (t < 0) {
      t += mod;
    }
    if (t % m1 != r1 || t % m2 != r2) {
      return -1;
    }
    return t;
  }
};

math user;

signed main() {
  int t;
  cin >> t;
  while (t--) {
    const __int128 inf = (__int128) 2e23;
    long long x, y, p, q;
    __int128 ret = inf;
    cin >> x >> y >> p >> q;
    for (__int128 t1 = x; t1 < x + y; t1++) {
      for (__int128 t2 = p; t2 < p + q; t2++) {
        __int128 val = user.crt(2 * (x + y), p + q, t1, t2);
        if (val != -1) ret = min(ret, val);
      }
    }
    if (ret == inf) {
      cout << "infinity\n";
    } else {
      long long print = ret;
      cout << print << "\n";
    }
  }
}


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i, h) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < h - 1; ++i) {
        for (int j = 0; j < w - 1; ++j) {
            int d = 0;
            if (a[i][j] == '#') ++d;
            if (a[i][j + 1] == '#') ++d;
            if (a[i + 1][j] == '#') ++d;
            if (a[i + 1][j + 1] == '#') ++d;
            //cout << d << endl;
            if (d == 3 || d == 1) ++ans;
        }
    }
    cout << ans << endl;
}

const bool isDebugMode = true;
int testcase = 1;
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
    #include <atcoder/all>
    using namespace atcoder;
#endif
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const int SHOWSIZE = 1 << 5;
const long long MOD = 1000000007; //998244353;
const long long dy[] = {0, 0, 1, 1};
const long long dx[] = {0, 1, 0, 1};
const string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
long long power(long long a, long long n){long long res = 1; while(n > 0){if(n & 1)res = res * a; a = a * a; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void enu(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void enu2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, min(v.size(), SHOWSIZE)) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, min(v.size(), SHOWSIZE)){rep(j, min(v[i].size(), SHOWSIZE)) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b, a % b) : b;}
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template <typename T, typename U, typename... V> typename enable_if<is_same<T, U>::value != 0>::type fill_v(U &u, const V... v) { u = U(v...); }
template <typename T, typename U, typename... V> typename enable_if<is_same<T, U>::value == 0>::type fill_v(U &u, const V... v){for (auto &e : u) fill_v<T>(e, v...);}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

void solve();

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

void solve(){
    ll H, W; cin >> H >> W;
    vector<string> s(H);
    rep(i, H) cin >> s[i];
    ll ans = 0;
    rep(i, H - 1)rep(j, W - 1){
        ll cnt = 0;
        rep(k, 4){
            if(valid(H, W, i + dx[k], j + dy[k]) && s[i + dx[k]][j + dy[k]] == '.') cnt++;
        }
        if(cnt % 2) ans++;
    }
    pt(ans);
}


#include <bits/stdc++.h>
using namespace std;
long long n,k;
int main()
{
    cin >> n >> k;
    while(k--)
    {
        if(n % 200) n = n * 1000 + 200;
        else n /= 200;
    }
    cout << n;
    return 0;
}

#define _GLIBCXX_DEBUG//これが最後の手段だ!
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>
#include <cmath>

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

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

/*template<class T> T ipow(T a, int b){

}*/

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

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

  if (c >= 15 && b >= 8){
    cout << 1 << '\n';
  }else if (c >= 10 && b >= 3){
    cout << 2 << '\n';
  }else if (c >= 3){
    cout << 3 << '\n';
  }else{
    cout << 4 << '\n';
  }

  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 998244353;
LL pw(LL n, int x) {
	LL ret = 1;
	LL t = n;
	while (x) {
		if (x & 1) ret = ret * t % mod;
		t = t * t % mod;
		x >>= 1;
	}
	return ret;
}

int main() {
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	if (n == 1)
		printf("%lld", pw(k, m));
	else if (m == 1)
		printf("%lld", pw(k, n));
	else {
		LL ret = 0;
		for (int i = 1; i <= k; ++i)
			ret = ((pw(i, n) - pw(i - 1, n) + mod) % mod * pw(k + 1 - i, m) % mod + ret) % mod;
		printf("%lld", ret);
	}
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
#include <cstdint>
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    if(n==0) return 0;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
const int MOD = 1000000007;
const int mod = 998244353;
const int MAX = 510000;
const int inf = 400000000000000;
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
vector<vector<int>> ruiseki2d(vector<vector<int>> vec){
    rep(i,vec.size()-1){
        rep(j,vec[0].size()-1){
            vec[i+1][j+1] = vec[i][j+1]+vec[i+1][j]-vec[i][j]+vec[i+1][j+1];
        }
    }
    return vec;
}
class CompareDist
{
public:
    bool operator()(pair<int,int> p,pair<int,int>q){
    return p.second > q.second;
}
};
vector<int> dijkstra(vector<vector<pair<int,int>>> vec,int s){
    priority_queue<pair<int,int>,vector<pair<int,int>>,CompareDist> que;
    pair<int,int> f = make_pair(s,0);//point,cost;
    que.push(f);
    bool y = false;
    vector<int> cost(vec.size(),inf);
    while(!que.empty()){
        pair<int,int> tmp = que.top();
        que.pop();
        int p = tmp.first;
        int c = tmp.second;
        if(cost[p]>c){
        cost[p] = c;
        rep(i,vec[p].size()){
            if(cost[vec[p][i].first]<=inf){
            tmp = make_pair(vec[p][i].first,vec[p][i].second+c);
            que.push(tmp);
            }
        }
        }
        if(!y) cost[p] = inf;
        y = true;
    }
    return cost;
}
signed main(void){
    int n,m,k;
    cin >> n >> m >> k;
    int ans = 0;
    if(n==1||m==1) ans = modpow(k,max(n,m),mod);
    else{
        for(int i=1;i<=k;i++){
            ans += (modpow(i,n,mod)*modpow(k-i+1,m,mod)%mod);
            ans %= mod;
            ans -= (modpow(i,n,mod)*modpow(k-i,m,mod)%mod);
            ans = (ans%mod+mod)%mod;
            //cout << modpow(i,n,mod) << " " << modpow(k-i+1,m,mod) << endl;
        }
    }
    cout << ans%mod << endl;
}


// Author: Pasindu Wijesena

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

#define deb(x) cout<<#x<<": "<<x<<endl
#define rep(a,b) for(int a=0;a<b;a++)
#define rep2(a,b,c) for(int a=b;a<c;a++)
#define per2(a,b,c) for(int a=b;a>=c;a--)
#define gcd(a,b) __gcd(a,b) // gcd of two numbers
#define bitCount(a) __builtin_popcount(a) // number of ones in binary form
#define zeroCount(a) __builtin_clz(a) // number of zeros at the end in binary form

typedef long long ll;

template<typename... T>
void rd(T&... args){ ((cin>>args), ...); }
template<typename... T>
void wt(T&&... args) { ((cout<<args<<" "), ...); }

ll mod(ll V, ll N){
	return ((V % N) + N) % N;
}

const ll MOD = 1e9+7;

bool solve(){
	int N;
	rd(N);
	vector<int>A(N,0);
	for(auto &a:A) rd(a);

	sort(A.begin(), A.end());
	ll answer = A[0]+1;
	ll diff = 0;
	rep2(i,1,N){
		diff = A[i] - A[i-1];
		answer = mod(answer * (diff+1), MOD);
	}
	cout<<answer<<endl;
	return true;
}

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

	int T=1;
	//~ rd(T);
	rep(i,T){
		//~ cout<<"Case #"<<i+1<<": ";
		solve();
		//~ bool result = solve();
		//~ if(result)cout<<"YES"<<endl;
		//~ else cout<<"NO"<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int U;
template <typename T>
inline void read(T &x)
{
	x = 0;bool b = 0;char c;
	for (c = getchar();!isdigit(c);b |= (c == '-'), c = getchar());
	for (;isdigit(c);x = (x << 1) + (x << 3) + (c ^ 48), c = getchar());
	if (b) x = -x;
}
template <typename T>
inline void write(T x, int base = 10)
{
	if (x == 0)
	{
	    putchar('0');
	    return ;
	}
	if (x < 0) putchar('-'), x = -x;
	static int stk[70];
	int top = 0;
	while (x)
	{
		stk[top++] = x % base;
		x /= base;
	}
	while (top > 0)
	{
		putchar(stk[--top] ^ 48);
	}
}
const int M = 1000005;
int num, mu[M + 5], ol[M + 5], prime[M + 3];
int l, r;
void get()
{
	mu[1] = 1;
	for (int i = 2;i <= M;++i)
	{
		if (!ol[i])
			prime[++num] = i, mu[i] = -1;
		for (int j = 1;j <= num && i * prime[j] <= M;++j)
		{
			ol[i*prime[j]] = 1;
			if (i % prime[j] == 0)
			{
				mu[i * prime[j]] = 0;
				break;
			}
			mu[i * prime[j]] = -mu[i];
		}
	}
}
ll tmp(int t)
{
	return (ll)t * (t-1);
}
ll ans;
int main()
{
	get();
	read(l);read(r);
	for (int i = 2;i <= r;++i)
		ans -= tmp(r / i - (l - 1) / i) * mu[i];
	for (int i = l;i <= r;++i)
		ans -= ((r / i - 1) << 1);
	if (l == 1)
		ans += (r - 1) * 2;
	write(ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=222222,mod=998244353;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
char s[maxn];
int n,cnt[26];
ll ans;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	cnt[s[n]-'a']++;
	ROF(i,n-1,1){
		cnt[s[i]-'a']++;
		if(s[i]==s[i+1]){
//			printf("at %d\n",i);
			FOR(j,0,25) if(j!=s[i]-'a') ans+=cnt[j],cnt[s[i]-'a']+=cnt[j],cnt[j]=0;
//			printf("ans=%d\n",ans);
		}
	}
	printf("%lld\n",ans);
}
/*
azaazbbzzaaza
*/


#include <bits/stdc++.h>
using namespace std;
#define int long long
void read (int &x) {
    char ch = getchar(); x = 0; int f = 0;
    while (!isdigit(ch)) { if (ch == '-') f = 1; ch = getchar(); }
    while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
    if (f) x = -x;
} const int N = 2e5 + 5, mod = 998244353;
int qpow (int x, int y) {
    int t = 1;
    while (y) {
        if (y & 1) t = t * x % mod;
        x = x * x % mod, y >>= 1;
    }
    return t;
}
int n, m, res, a[N], t, p[N * 2], in[N * 2], b[N], tot, k[N];
int C (int x, int y) {
    return p[x] * in[y] % mod * in[x - y] % mod;
}
void prework () {
    p[0] = 1;
    for (int i = 1; i <= n + m; ++i) p[i] = p[i - 1] * i % mod;
    in[n + m] = qpow (p[n + m], mod - 2);
    for (int i = n + m; i >= 1; --i) in[i - 1] = in[i] * i % mod;

    for (int i = 2; i * i <= m; ++i)
        if (!k[i]) {
            b[++tot] = i;
            for (int j = i; j * j <= m; j += i) k[j] = 1;
        }
}
void work (int x) {
    t = 0;
    for (int i = 1; i <= tot && b[i] <= x; ++i) {
        int cnt = 0;
        while (x % b[i] == 0) ++cnt, x /= b[i];
        if (cnt) a[++t] = cnt;
    }
    if (x > 1) a[++t] = 1; int tmp = 1;
    for (int i = 1; i <= t; ++i) {
        tmp = tmp * C (a[i] + n - 1, a[i]) % mod;
    }
    // printf ("%lld %lld %lld\n", x, tmp, b[1]);
    (res += tmp) %= mod;
}
signed main() {
    read (n), read (m); prework ();
    // printf ("%d\n", tot);
    for (int i = 1; i <= m; ++i) work (i);
    printf ("%lld\n", res);
}

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

const int N = 2e5 + 10, mod = 998244353;

int n, fa[N], ans = 1;

int find_(int x) {
	return x == fa[x] ? x : fa[x] = find_(fa[x]);
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		fa[i] = i;
	for (int i = 1, x; i <= n; i++) {
		scanf("%d", &x);
		if (find_(x) == find_(i))
			ans = ans*2%mod;
		else
			fa[find_(i)] = find_(x);
	}
	printf("%d\n", (ans + mod - 1)%mod);
}


#include <iostream>
#include <vector>
using namespace std;
long mod = 1000000007;

long sqr(long a) {
    return a * a % mod;
}
int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        long n, a, b;
        cin >> n >> a >> b;
        if (n < a + b) {
            cout << 0 << endl;
            continue;
        }
        if (a > b) {
            swap(a, b);
        }
        long s;
        long x = n-a+1;
        long y = n-b+1;
        s = sqr(x)*sqr(y)%mod;
        s += mod - sqr(b-a+1)*sqr(y)%mod;
        s%=mod;
        long z = a - 1;
        long s1 = ((b-a+1)*y%mod)*(y - 1)%mod;
        long sz = ((b-a+1)*y%mod)*(y - z)%mod;
        s += mod - (s1+sz)*z%mod*2%mod;
        s%=mod;
        long s11 = (y-1)*(y-1)%mod;
        long s1z = (y-1)*(y-z)%mod;
        long szz = (y-z)*(y-z)%mod;
        s1 = (s11 + s1z) * z%mod;
        sz = (s1z + szz) * z%mod;
        s += mod - (s1+sz)*z%mod;
        s %= mod;

        cout << s << endl;
    }
}

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define sz(A) (int)A.size()
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> oset;

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

#define in input_int()
#define ins input_string()
bool sb(int a,int i){return (a&(1LL<<i))>0;}
int p2(int a){return (1LL<<a);}
int input_int(){int a;cin>>a;return a;}
string input_string(){string s;cin>>s;return s;}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int ceil(int a,int b){return (a+b-1)/b;}
int ct,visited[N],ans;
vi adj[N];
int n,m,k,a,b,c,d,x,y,arr[N];
void clr()
{
    forn(i,0,n+10)adj[i].clear(),visited[i]=0,arr[i]=0;
}

inline int mul(int a,int b){return (a*1ll*b)%MOD;}
inline int add(int a,int b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,MOD-2);}

int get_sum(int a)
{
    if(a<=0)return 0;
    return mul(add(mul(a,a),a),inv(2));
}
string s;
void solve()
{
    cin>>n>>a>>b;
    if(a>b)swap(a,b);

    int ans1=get_sum(n-b-a+1);
    ans1%=MOD;
    int ans2=(n-b+1)*(n-a+1);
    ans2%=MOD;
    //cout<<ans1<<" "<<ans2<<"\n";
    int ans3=get_sum(n-b-a+1);
    ans3=ans3*ans3;
    ans3%=MOD;
    ans3*=2;
    ans3%=MOD;
    int ans=ans1*ans2;
    ans%=MOD;
    ans*=2;
    ans%=MOD;
    ans=ans-ans3+MOD;
    ans%=MOD;
    ans=ans+ans;
    ans%=MOD;
    cout<<ans;
}

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    cin>>t;
    forn(i,1,t)
    {
        //cout<<":Case #"<<i<<": ";
        solve();
        nl;
    }

    return 0;

}


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

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

# define ll long long
# define C continue;

# define pb push_back
# define vi vector < int >
# define vll vector < ll >

# define I insert

# define pii pair < int , int >
# define pll pair < ll , ll >
# define F first
# define S second

# define vpii vector < pair < int , int > >
# define vpll vector < pll >

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

# define ld long double
# define PQ priority_queue

# define vc vector < char >
# define vb vector < bool >
# define vs vector < string >

# define vvi vector < vector < int > >
# define vvll vector < vector < ll > >
# define vvc vector < vector < char > >
# define vvb vector < vector < bool > >

# define allcomp(v) v.begin() , v.end() , comp

# define pp(n) printf("%.10Lf",n);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
/// Start using lower bound !!

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

    ll s = 0 ;
    ll &sum = s ;

    vi v ( n ) ;
    for ( int i=0 ; i < n ; i ++ )
    {
        int &val = v[i] ;
        cin >> val ;

        s += val ;
    }

    vvi temp ( 2 ) ;

    for ( int i=0 ; i < n ; i ++ )
    {
        int val ;
        cin >> val ;

        val = val - v[i] ;

        temp[i&1].pb ( val ) ;
    }

    sort ( allrev ( temp[0] ) ) ;
    sort ( allrev ( temp[1] ) ) ;

    int z = min ( temp[0].size() , temp[1].size() ) ;

    for ( int i=0 ; i < z ; i ++ )
    {
        int add = temp[0][i] + temp[1][i] ;

        if ( add <= 0 )
            break ;

        sum += add ;
    }

    cout << sum ; line ;
}

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

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

    return 0;
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

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

int main() {
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (auto &&i : A) scanf("%d", &i);
    for (auto &&i : B) scanf("%d", &i);
    ll ans = 0;
    for (int i = 1; i < n; i += 2) {
        swap(A[i], B[i]);
    }
    priority_queue<int> Q;
    for (int i = 0; i < n; ++i) {
        ans += A[i];
        Q.emplace(B[i]-A[i]);
    }
    for (int i = 0; i < n/2; ++i) {
        ans += Q.top(); Q.pop();
    }
    cout << ans << "\n";
    return 0;
}


#include <bits/stdc++.h>
//#include <bits/extc++.h>
//#include <immintrin.h>

using namespace std;

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for (auto &i : a)
        in >> i;
    return in;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    for (auto &i : a) {
        out << i << " ";
    }
    return out;
}

template<typename T, typename D>
istream &operator>>(istream &in, pair<T, D> &a) {
    in >> a.first >> a.second;
    return in;
}

template<typename T, typename D>
ostream &operator<<(ostream &out, const pair<T, D> &a) {
    out << a.first << " " << a.second;
    return out;
}

struct LogOutput {
    template<typename T>
    LogOutput &operator<<(const T &x) {
#ifdef DIVAN
        cout << x;
#endif
        return *this;
    }
} dout, fout;

typedef long long ll;
typedef unsigned long long ull;
typedef double dl;
typedef complex<double> cd;

#define nl '\n'
#define elif else if
#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) >= 0 ? ((x) % m) : ((((x) % m) + m) % m))
#define minq(x, y) x = min((x), (y))
#define maxq(x, y) x = max(x, (y))
#define forn(i, n) for (int i = 0; i < (n); ++i)

typedef vector<pair<int,int>> vpi;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

const ll INFL = 9187201950435737471;
const ll nINFL = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const long double PI = acos(-1);
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(seed);

inline void IO() {
#ifdef DIVAN
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#else
    //    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
}

struct Point{
    int coord;
    bool include;
    bool open;
    int num;
    Point(int a = 0, bool b = 0, bool c = 0, int x = 0) {
        coord = a;
        include = b;
        open = c;
        num = x;
    }
    bool operator<(const Point& x) const {
        if (coord != x.coord) {
            return coord < x.coord;
        }
        if (include ^ x.include) {
            return include;
        }
        if (x.open == open) {
            return 0;
        }
        return open;
    }
};

void Solve() {
    int n;
    cin >> n;
    vpi a(n);
    forn(i, n) {
        int t, l, r;
        cin >> t >> l >> r;
        l *= 2;
        r *= 2;
        if (t > 2) {
            ++l;
        }
        if (t == 2 || t == 4) {
            --r;
        }
        a[i] = {l, r};
    }
    int ans = 0;
    forn(i, n) {
        for (int j = i + 1; j < n; ++j) {
            if (a[i].first > a[j].second || a[j].first > a[i].second) {
                continue;
            }
            ++ans;
        }
    }
    cout << ans;
}

signed main() {
    auto startTime = chrono::high_resolution_clock::now();
    IO();
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; ++i) {
//        cout << "Case #" << i << ": ";
        Solve();
    }
    auto endTime = chrono::high_resolution_clock::now();
    chrono::duration<long double> duration = endTime - startTime;
    cout << setprecision(6) << fixed;
    fout << '\n' << "Time: " << duration.count();
    return 0;
}

using namespace std;
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(), x.end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define double long double

const int N = 2e3+3;
pair<int,int>a[N];

bool intersect(int i, int j)
{
    vector< pair<int,int> >v;
    v.push_back( a[i] );
    v.push_back( a[j] );
    sort( all(v) );
    return ( v[0].second >= v[1].first );
}

signed main()
{
    IOS;
    int n; cin >> n;
    for ( int i = 1; i <= n; ++i )
    {
        int t; cin >> t;
        cin >> a[i].first >> a[i].second;
        a[i].first *= 1e9;
        a[i].second *= 1e9;

        if ( t == 2 )
            a[i].second -= 1;

        if ( t == 3 )
            a[i].first += 1;

        if ( t == 4 )
        {
            a[i].first += 1;
            a[i].second -= 1;
        }
    }

    int ans = 0;

    for ( int i = 1; i <= n; ++i )
    {
        for ( int j = i + 1; j <= n; ++j )
            ans += intersect(i, j);
    }

    cout << ans << '\n';
}


#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(vector<bool>::reference b) { return to_string(int(b)); }
string to_string(char b) { return "'" + string(1, b) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) {
	string res = "{";
	for (const auto& x : v) res += (res == "{" ? "" : ", ") + to_string(x);
	return res + "}";
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug(T...);
}
#define db(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define db(...) 42
#endif
typedef long long ll;
typedef long double ld;
const int MOD = 998244353;
struct Mint {
	int val;
	Mint() { val = 0; }
	Mint(const ll& x) {
		val = (-MOD <= x && x < MOD) ? x : x % MOD;
		if (val < 0) val += MOD;
	}
	template <typename U>
	explicit operator U() const { return (U)val; }
	friend bool operator==(const Mint& a, const Mint& b) { return a.val == b.val; }
	friend bool operator!=(const Mint& a, const Mint& b) { return !(a == b); }
	friend bool operator<(const Mint& a, const Mint& b) { return a.val < b.val; }
	Mint& operator+=(const Mint& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	Mint& operator-=(const Mint& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	Mint& operator*=(const Mint& m) { val = (ll)val * m.val % MOD; return *this; }
	friend Mint modex(Mint a, ll p) {
		assert(p >= 0);
		Mint ans = 1;
		for (; p; p >>= 1, a *= a) if (p & 1) ans *= a;
		return ans;
	}
	Mint& operator/=(const Mint& m) { return *this *= modex(m, MOD - 2); }
	Mint& operator++() { return *this += 1; }
	Mint& operator--() { return *this -= 1; }
	Mint operator++(int) { Mint result(*this); *this += 1; return result; }
	Mint operator--(int) { Mint result(*this); *this -= 1; return result; }
	Mint operator-() const { return Mint(-val); }
	friend Mint operator+(Mint a, const Mint& b) { return a += b; }
	friend Mint operator-(Mint a, const Mint& b) { return a -= b; }
	friend Mint operator*(Mint a, const Mint& b) { return a *= b; }
	friend Mint operator/(Mint a, const Mint& b) { return a /= b; }
	friend ostream& operator<<(ostream& os, const Mint& x) { return os << x.val; }
	friend string to_string(const Mint& b) { return to_string(b.val); }
};
int main() {
	ll a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	a = a * (a + 1) / 2;
	b = b * (b + 1) / 2;
	c = c * (c + 1) / 2;
	printf("%d\n", (Mint(a) * Mint(b) * Mint(c)).val);
}

#include <bits/stdc++.h>

using namespace std;

int main(){
	int n, a , b;
	cin >> n >> a >> b;

	cout << (n - a) + b;

}


#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define all(v) v.begin(),v.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const int INF = 1e9;
const int TMX = 1 << 18;
const long long llINF = 5e18;
const long long mod = 1e9+7;
const long long hmod1 = 1e9+409;
const long long hmod2 = 1e9+433;
const long long base = 257;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;
typedef vector <pi> vecpi;
typedef long long ll;
int a[205];
int n,k;

int f(int x,int y) {
	if(x == y) return x;
	if(x > y) swap(x,y);
	if(x == 0&&y == 2) return 2;
	return x;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	for(int i = 1;i <= n;i++) {
		char x; cin >> x;
		if(x == 'R') a[i] = 0;
		if(x == 'S') a[i] = 1;
		if(x == 'P') a[i] = 2;
		a[n+i] = a[i];
	}
	for(int i = 1;i <= k;i++) {
		for(int j = 1;j <= n;j++) a[j] = f(a[j*2-1],a[j*2]);
		for(int j = 1;j <= n;j++) a[n+j] = a[j];
	}
	cout << (!a[1] ? 'R' : (a[1] & 1 ? 'S' : 'P'));
}

#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    auto convert = [](char a) { return a == 'R' ? 0 : a == 'P' ? 1 : 2; };
    auto match = [&](char a, char b) {
        int x = convert(a), y = convert(b);
        int z = (y - x + 3) % 3;
        return z == 1 ? b : a;
    };

    rep(i, k) {
        string t(s.size(), '_');
        rep(j, n) {
            t[j] = match(s[(2 * j) % n], s[(2 * j + 1) % n]);
        }
        s = t;
    }

    write(s[0]);
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

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

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else
    #define dbg(x)
#endif

#define pb push_back
#define ppb pop_back()
#define mp make_pair
#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 fi1(a, b) for (int i = a - 1; i >= b; i--)
#define fj1(a, b) for (int j = a - 1; j >= b; j--)
#define fk1(a, b) for (int k = a - 1; k >= b; k--)
#define fx(x, a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}

typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;

int MOD;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 101;
const double EPS = 1e-9;

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

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

ll sub(ll a, ll b) {
    a -= b;
    if (a < 0) return a + MOD;
    return a;
}

ll mult(ll a, ll b) {
    return a * b % MOD;
}

ll powmod(ll a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mult(a, powmod(a, p - 1));
    return powmod(mult(a, a), p / 2);
}

ll rev(ll a) {
    return powmod(a, MOD - 2);
}

int dp[MX][MX * MX * MX];
int mxs[MX];

int n, k;

void init() {
    mxs[0] = 0;
    dp[0][0] = 1;
    int kek = 0;
    for (int i = 1; i < n; ++i) {
        if (2 * i <= n - 1) {
            mxs[i] = mxs[i - 1] + i * k;
        } else {
            mxs[i] = mxs[n - 1 - i];
        }
        for (int s = 0; s <= mxs[i]; ++s) {
            for (int d = 0; d * i <= s && d <= k; ++d) {
                ++kek;
                dp[i][s] = add(dp[i][s], dp[i - 1][s - d * i]);
            }
        }
    }
}

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

    cin >> n >> k >> MOD;
    init();
    for (int x = 1; x <= n; ++x) {
        int ans = 0;
        for (int s = 0; s <= mxs[x - 1]; ++s) {
            ans = add(ans, mult(dp[x - 1][s], dp[n - x][s]));
        }
        cout << sub(mult(ans, k + 1), 1) << '\n';
    }
}


/*
  || Shree Ganeshay Namah ||

     || Jai Shree Ram ||
  || Nabh Sparsham Diptam ||
*/
#include<bits/stdc++.h>
using namespace std;
//typedef long long int ll;

#define mod 1000000007
#define block 180
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f1 first
#define s1 second
#define pb push_back
// to floor a/b you can do a/b and to ceiling a/b you can do (a+b-1)/b
int jai_shree_ram()
{
    return 1;
}
int shree_ganeshay_namah()
{
    return 1;
}

//End of Matrix Exponentiation
/*
Segment Tree
ll ar[200005];
ll st[800005];
void build(ll si,ll ss,ll se)
{
    if(ss==se)
    {
        st[si]=ar[ss];
        return ;
    }
    ll mid=(ss+se)/2;
    build(2*si,ss,mid);
    build(2*si+1,mid+1,se);
    st[si]=(st[2*si]+st[2*si+1]);
}
ll query(ll si,ll ss,ll se,ll l,ll r)
{

   if(l<=ss && se<=r)
     return st[si];
   if(l>se || r<ss)
    return 0;
   ll mid=(ss+se)/2;
   ll x=query(2*si,ss,mid,l,r);
   ll y=query(2*si+1,mid+1,se,l,r);
   return x+y;
}
void update(ll si,ll ss,ll se,ll qi)
{
    if(ss==se)
    {
        st[si]=ar[ss];
        return;
    }
    ll mid=(ss+se)/2;
    if(qi<=mid)
        update(2*si,ss,mid,qi);
    else
        update(2*si+1,mid+1,se,qi);
    st[si]=st[2*si]+st[2*si+1];
}
*/

int main()
{
    /*ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);*/
    long long int a,b,p,q,i;
    cin>>a>>b>>p>>q;
    double f = (double)(q*a+b*p)/(b+q);
    cout.precision(17);
    cout<<f;
    return 0;
}

#include<bits/stdc++.h>
#define loop(i, n) for(int i = 0; i < n; i++)
#define pb          push_back
#define ll          long long int
#define vi          vector<int>
#define pi          pair<int, int>
#define W(t)        int t; cin >> t; while(t--)
#define FIO         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ff          first
#define ss          second
#define rep(i, a, b)for(ll i = a; i <= b; i++)
#define dep(i, a, b)for(ll i = a; i >= b; i--)
#define all(x)      x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI                3.14159265
using namespace std;
const ll mod = (ll)(998244353);
vector<ll> read(int n){

    vector<ll> v(n);

    loop(i, n)
        cin >> v[i];
    return v;
}
vector<ll> fact, invf;
ll powmod(ll a, ll b) {
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

void build(int n) {
    fact = vector<ll>(n+1, 1);
    invf = vector<ll>(n+1, 1);
    for (int i = 2; i <= n; i++)
        fact[i] = fact[i-1] * i % mod;
    invf[n] = powmod(fact[n], mod-2);
    for (int i = n-1; i >= 2; i--)
        invf[i] = invf[i+1] * (i+1) % mod;
}

ll nChoosek(int n, int k) {
    if (n < k)
        return 0;
    return fact[n] * invf[k] % mod * invf[n-k] % mod;
}
ll test = 0;
void solve(){
    ll i, j, k, m, n, cnt = 0, ans = 0, sum = 0;

   double sx, sy, gx, gy;

   cin >> sx >> sy >> gx >> gy;

   double res = (gy*sx + gx*sy)/(sy+gy);

   cout <<fixed << setprecision(10) << res << "\n";

    test++;
}

int main(){
    FIO

    #ifndef ONLINE_JUDGE
	freopen("C:/Codeforces/input.txt", "r", stdin);
	freopen("C:/Codeforces/output.txt", "w", stdout);
	#endif
    ll i = 1;
    //W(t)
    solve();

    return 0;
}


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

typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb emplace_back
#define pii pair<int , int>
#define F first
#define S second
const int mod = 1000000007;
const int MAXX = 1e6 +5;

int t , n;
string s;
int a[MAXX];

signed main()
{
    _FastIO;
        cin >> n;
        cin >> s;/*
        vector<int> v(n + 2 , 0);

        q[0] = 0;
        int m = 0;
        int p = 0;
        int tp = 0;
        for(int i = 0; i < n; i++){
            if(s[i] == '<')
                m++;
            else{
                m--;
                if(m < p){
                    p = m;
                    tp = i + 1;
                }
            }
            q[i + 1] = m;
        }*/
        for(int i = 0; i <= n; i++){
            cin >> a[i];
        }
        int k = 100000;
        for(int i = 1; i <= n; i++){
            k = min(k , abs(a[i] - a[i - 1]));
        }
        cout << k << endl;
        vector<int> q(n + 2 , 0);
        vector<int> b(n + 2 , 0);
        for(int i = 0; i <= n; i++){
            b[i] = a[i] / (k);
            q[i] = a[i] % k;
        }
        for(int i = 1; i < k; i++){
            for(int j = 0; j <= n; j++){
                if(i <= q[j])
                    cout << b[j] + 1 << " ";
                else
                    cout << b[j] << " ";
            }
            cout << endl;
        }
        for(int i = 0; i <= n; i++){
            cout << b[i] << " ";
        }
        cout << endl;
    return 0;
}

#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("inline")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #define DEBUG

#ifdef DEBUG
#pragma region
#endif

using namespace std;
#define LL long long
#define PII pair<int, int>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define newl '\n'
#ifdef DEBUG
#define debug(...) cerr << '[', _debug(__VA_ARGS__)
#else
#define debug(...)
#endif

const int INF = 1e9;

template <typename T>
void _debug(T a) {
  cerr << a << ']' << endl;
}

template <typename T, typename... Args>
void _debug(T a, Args... args) {
  cerr << a << ", ";
  _debug(args...);
}

#ifdef DEBUG
#pragma endregion
#endif

int n;
array<int, 2> a[100];

void solve() {
  cin >> n;
  rep(i, n) { cin >> a[i][0] >> a[i][1]; }
  rep(i, n) {
    rep(j, n) {
      rep(k, n) {
        debug(a[i][0], a[i][1], a[j][0], a[j][1], a[k][0], a[k][1]);
        if (a[i] == a[j] || a[j] == a[k] || a[i] == a[k]) {
          continue;
        }
        if ((a[i][1] - a[j][1]) * (a[i][0] - (a[k][0])) ==
            (a[i][1] - a[k][1]) * (a[i][0] - (a[j][0]))) {
          cout << "Yes";
          return;
        }
      }
    }
  }
  cout << "No";
}

int main() {
  // freopen("live.in", "r", stdin);
  // freopen("live.out", "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  // cout << fixed << setprecision(7);
  // int n;
  // cin >> n;
  // rep(i, n)
  //     //
  solve();
  cout << flush;
}


//
// Created by K R, Siva Kumar on 02/01/21 at 5:31 PM.
//
#include <bits/stdc++.h>

using namespace std;

const double pi = 2 * acos(0.0);
const int mod = 1e9 + 7;

class Solver {
  string a, b;
public:
  void solve() {
    cin >> a >> b;

    int aa = 0, bb = 0;
    for (auto i : a) {
      aa += (i - '0');
    }

    for (auto i : b) bb += (i - '0');

    cout << max(aa, bb);

  }
};

int main() {
#ifndef ONLINE_JUDGE
  freopen("/Users/sivkr/Workspace/CompetitiveProgramming/HackerEarth/1.txt",
          "r", stdin);
  freopen("/Users/sivkr/Workspace/CompetitiveProgramming/HackerEarth/2.txt",
          "w", stdout);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);

  Solver s;
  s.solve();
}

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

int main(){
	int a,b;
	cin>>a>>b;
	int sum_a = 0;
	int sum_b = 0;
	while(a){
		sum_a += a%10;
		a = a/10;
		sum_b += b%10;
		b = b/10;
	}

	cout<<max(sum_a,sum_b)<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll mod = 1000000007;
ll mod2 = 998244353;

int main() {
	string n;
	ll k;
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		ll index = 1;
		ll ans = 0;
		for (int j = n.size() - 1; j >= 0; j--) {
			ans += (n[j] - '0') * index;
			index *= 10;
		}

		if (ans % 200 == 0) {
			ans /= 200;
			n = to_string(ans);
		}
		else {
			n += "200";
		}
	}
	ll ans2 = 0;
	ll index = 1;
	for (int j = n.size() - 1; j >= 0; j--) {
		ans2 += (n[j] - '0') * index;
		index *= 10;
	}
	cout << ans2 << endl;
	return 0;
}

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

int main(){
	ll n,k;
	cin>>n>>k;
	while(k){
		if(n%200==0)
			n/=200;

		else
			n=n*1000+200;

		k--;

	}
	cout<<n<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;

using namespace std;
using Graph = vector<vector<int>>;

struct UnionFind {
    vector<int> par, siz;

    UnionFind(int sz): par(sz), siz(sz, 1) {
        for (int i = 0; i < sz; ++i) par[i] = i;
    }
    void init(int sz) {
        par.resize(sz);
        siz.assign(sz, 1);
        for (int i = 0; i < sz; i++) par[i] = i;
    }

    int root(int x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

    int size(int x) {
        return siz[root(x)];
    }
};

int main(){
    int n, K;   cin >> n >> K;
    int a[n][n];
    for(int i=0; i<n; i++) for(int j=0; j<n; j++) cin >> a[i][j];
    //列に関して
    UnionFind ufc(n);
    //行に関して
    UnionFind ufr(n);
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            int cnt = 0;
            for(int k=0; k<n; k++){
                if(a[i][k] + a[j][k] <= K) cnt++;
            }
            if(cnt == n) ufc.merge(i,j);
        }
    }
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            int cnt = 0;
            for(int k=0; k<n; k++){
                if(a[k][i] + a[k][j] <= K) cnt++;
            }
            if(cnt == n) ufr.merge(i,j);
        }
    }

    vector<ll> floor(K+2,1);
    ll tmp = 1;
    for(int i=1; i<K+2; i++){
        tmp *= i;
        tmp %= MOD2;
        floor[i] = tmp;
    }

    vector<int> cc(n,0), cr(n,0);
    tmp = 1;
    for(int i=0; i<n; i++){
        int t = ufc.root(i);
        if(cc[t] == 0){
            tmp = tmp * floor[ufc.size(i)] % MOD2;
            cc[t] = 1;
        }
    }
    for(int i=0; i<n; i++){
        int t = ufr.root(i);
        if(cr[t] == 0){
            tmp = tmp * floor[ufr.size(i)] % MOD2;
            cr[t] = 1;
        }
    }
    print(tmp);
}

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

using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    ll ans = 0;
    vector<int> cnt(n);
    for (int i = 0; i < n; i++) cnt[i] = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    unordered_map<int,bool> mp[k];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < min(cnt[i],k); j++) {
            mp[j][i] = true;
        }
    }
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < n; j++) {
            if (!mp[i][j]) {
                ans += j;
                break;
            }
        }
    }
    cout << ans << endl;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <set>
#include <functional>
#include <map>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
using Interval = pair<ll,ll>;
using Graph = vector<vector<ll> >;
#define fi first
#define se second

struct Edge{
    ll to;
    ll w;
    Edge(ll to, ll w):to(to),w(w){}
};

using wGraph = vector<vector<Edge> >;

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

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

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

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

const ll INF = 1LL << 60;

ll a,b;

vector<ll> cnt(200010,0);

int main(){
    cin >> a >> b;

    repi(k,a,b+1){
        repi(i,1,b+1){
            if (i*i > k) break;
            if (k % i == 0){
                cnt[i]++;
                cnt[k/i]++;
                if (i == k/i){
                    cnt[i]--;
                }
            }
        }
    }

    ll ans = 0;

    rep(i,200010){
        if (cnt[i] >= 2){
            ans = max(ans,i);
        }
    }

    cout << ans << endl;

    return 0;
}

#include <stdio.h>

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

#define ALL(obj) (obj).begin()(obj).end()
#define DEBUG(x) cerr << #x << " = " << x << endl

using namespace std;

int main() {
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;
  std::set<std::pair<int, int>> undecided;

  for (int i = 0; i < n; i++) {
    undecided.insert(std::make_pair(i, s[i]));
  }

  auto pointer = undecided.begin();
  int ans = 0;

  while (pointer != undecided.end()) {
    auto origin_ptr = pointer;
    if (pointer->second == 'f') {
      pointer++;
      if (pointer != undecided.end() && pointer->second == 'o') {
        pointer++;
        if (pointer != undecided.end() && pointer->second == 'x') {
          pointer = origin_ptr;
          for (int i = 0; i < 3; ++i) {
            pointer = undecided.erase(pointer);
          }
          ans += 1;
          if (pointer != undecided.begin()) {
            pointer = std::prev(pointer);
          }
          if (pointer != undecided.begin()) {
            pointer = std::prev(pointer);
          }

          continue;
        }
      }
    }

    pointer = origin_ptr;
    pointer++;
  }
  std::cout << n - ans * 3 << std::endl;
}


#include "bits/stdc++.h"
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;

void solve(){
	int n;
	cin >> n;
	int a = 0;
	rep(i,0,n){
		int x;
		cin >> x;
		amax(a,x);
	}
	int b = 1002;
	rep(i,0,n){
		int x;
		cin >> x;
		amin(b,x);
	}

	cout << max(0LL,b-a+1);
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    cout << 2 * A + 100 - B << endl;
    return 0;
}


#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;
typedef pair<ll, ll> pairs;
typedef vector<pairs> p;
#define ALL(obj) (obj).begin(),(obj).end()
struct edge{
    ll to, cost;
};

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

// 数字の桁数
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// べき乗の余り
ll modpow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n = n >> 1;
    }
    return res;
}

// コンビネーション
ll MAXN = 2e5+10;
vector<ll> inv(MAXN);
ll nCk(ll n, ll k) {
	ll res = 1;
	for(ll i = 1; i <= k; i++) {
		res = res*(n-i+1) % MOD;
	}

	for(ll i = 1; i <= k; i++) {
		res = res*inv[i] % MOD;
	}
	return res;
}

// ---------------------------------------------
int main(){
    ll l;
    cin>>l;

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

    return 0;
}

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

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

    int N; cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];

    int ans = 0;
    for(int l = 0; l < N; l++){
        int x = a[l];
        for(int r = l; r < N; r++){
            x = min(x, a[r]);
            ans = max(ans, x * (r - l + 1));
        }
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	if(a*a+b*b<c*c)cout<<"Yes";else cout<<"No";
}

#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	int N,S,D; cin >> N >> S >> D;

	vector<int> X(N,0);
	vector<int> Y(N,0);

	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
		if (!(X[i] >= S or Y[i] <= D)) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}