stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

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

#define dll(x) scanf("%I64d",&x)

#define xll(x) printf("%I64d\n",x)

#define sz(a) int(a.size())

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

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

#define repd(i,x,n) for(int i=x;i<=n;i++)

#define pii pair<int,int>

#define pll pair<long long ,long long>

#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)

#define MS0(X) memset((X), 0, sizeof((X)))

#define MSC0(X) memset((X), '\0', sizeof((X)))

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define eps 1e-6

#define gg(x) getInt(&x)

#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;

using namespace std;

typedef long long ll;

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

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

ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}

inline void getInt(int* p);

const int maxn=1000010;

const int inf=0x3f3f3f3f;

/*** TEMPLATE CODE * * STARTS HERE ***/

int n;

ll a,b;

ll x[maxn];



int main()

{

	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);

	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);

	gbtb;

	cin>>n>>a>>b;

	repd(i,1,n)

	{

		cin>>x[i];

	}	

	ll ans=0ll;

	repd(i,2,n)

	{

		ll cha=x[i]-x[i-1];

		if(cha*a<=b)

		{

			ans+=cha*a;

		}else

		{

			ans+=b;

		}

	}

	cout<<ans<<endl;

	

	

    return 0;

}



inline void getInt(int* p) {char ch;do {ch = getchar();} 

while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');

while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}

else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9') 

{*p = *p * 10 + ch - '0';}}}

// Faster C++ solution for the same problem (measured speedup: 5.304658204993741x):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

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

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

using LL = long long;

//#define zerol

#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)

#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)

#ifdef zerol

#define dbg(x...) do { cout  << #x << " -> "; err(x); } while (0)

void err() { cout <<  endl; }

template<template<typename...> class T, typename t, typename... A>

void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }

template<typename T, typename... A>

void err(T a, A... x) { cout << a << ' '; err(x...); }

#else

#define dbg(...)

#endif



const int MAXN = 1e5+5;

const LL MOD = 1e9+7;



vector<int> p;

bool nop[MAXN];



int n;

LL a, b, x[MAXN];



int main() {

    scanf("%d%lld%lld", &n, &a, &b);

    FOR (i, 0, n) {

        scanf("%lld", &x[i]);

    }



    LL ans = 0;

    FOR (i, 1, n) {

        LL da = (x[i]-x[i-1]) * a, db = b;

        ans += min(da, db);

    }

    cout << ans << endl;





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2246175375450825x):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

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

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}
// Slower C++ solution:
#include <iostream>

typedef long long i64;

#define N 100005



i64 n, a, b, xarr[N];



int main()

{

	scanf("%lld%lld%lld", &n, &a, &b);

	for(int i = 1; i <= n; ++i) scanf("%lld", xarr + i);

	i64 ans = 0;

	for(int i = 2; i <= n; ++i)

		ans += std::min((xarr[i] - xarr[i - 1]) * a, b);

	printf("%lld\n", ans);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2028201356458075x):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

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

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = 0; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



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



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.184952843284235x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



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



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.172897313430582x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r1, r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r1.push_back(C[i] + C[j]);

				}

			}

		}



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



		r.push_back(r1[0]);



		for (int i = 0; i < r1.size(); i++)

		{

			if (r1[i - 1] != r1[i])

			{

				r.push_back(r1[i]);

			}

		}



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.179240181015241x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



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



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc] + r[rc]); lc++;

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.172550659494547x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



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



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc++] + r[rc]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.172549655397392x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C(N + 1); C.push_back(0);



		for (int i = 1; i <= N; i++)

		{

			scanf("%d", &C[i]);

		}



		vector<int> r;



		for (int i = 0; i <= N; i++)

		{

			for (int j = i; j <= N; j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



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



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc++] + r[rc]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.171955936992423x):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

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

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}
// Slower C++ solution:
//Bokan ga bokka--nn!!

//Daily Lunch Special Tanoshii !!

//これは、頭が悪く競プロが世界で一番できないHIR180が

//IOI2014日本代表になるまでのN日間の記録である。

#include <cstdio>

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <ctime>

#include <cassert>

#include <string>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

#include <functional>

#include <iostream>

#include <map>

#include <set>

using namespace std;

typedef pair<int,int> P;

typedef pair<int,P> P1;

typedef pair<P,P> P2;

typedef long long ll;

#define pu push

#define pb push_back

#define mp make_pair

#define eps 1e-7

#define INF 2000000000

#define f first

#define s second

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

P za[100005];

int main()

{

	srand((unsigned int)time(NULL));

	int n,x,y;  scanf("%d",&n);

	int lx=INF,ly=INF,rx=-INF,ry=-INF;

	for(int i=0;i<n;i++)

	{

		scanf("%d%d",&x,&y);

		za[i]=mp(x+y,x-y);

		lx=min(lx,x+y);

		rx=max(rx,x+y);

		ly=min(ly,x-y);

		ry=max(ry,x-y);

	}

	int ret1=0,ret2=0;

	for(int i=0;i<n;i++)

	{

		//(lx,ly)(rx,ry)

		ret1=max(ret1,min(max(za[i].f-lx,za[i].s-ly),max(rx-za[i].f,ry-za[i].s)));

		//(lx,ry)(rx,ly)

		ret2=max(ret2,min(max(za[i].f-lx,ry-za[i].s),max(rx-za[i].f,za[i].s-ly)));

	}

	printf("%d\n",min(ret1,ret2));

}

// Faster C++ solution for the same problem (measured speedup: 5.166241966669994x):
#include <stdio.h>

#define INF 100000000

int a[100005],b[100005];

int min(int a,int b){ return a<b?a:b;}

int max(int a,int b){ return a>b?a:b;}

int main()

{

	int n,x,y;  scanf("%d",&n);

	int lx=INF,ly=INF,rx=-INF,ry=-INF;

	for(int i=0;i<n;i++)

	{

		scanf("%d%d",&x,&y);

		a[i]=x+y;b[i]=x-y;

		lx=min(lx,x+y);

		rx=max(rx,x+y);

		ly=min(ly,x-y);

		ry=max(ry,x-y);

	}

	int ret1=0,ret2=0;

	for(int i=0;i<n;i++)

	{

		//(lx,ly)(rx,ry)

		ret1=max(ret1,min(max(a[i]-lx,b[i]-ly),max(rx-a[i],ry-b[i])));

		//(lx,ry)(rx,ly)

		ret2=max(ret2,min(max(a[i]-lx,ry-b[i]),max(rx-a[i],b[i]-ly)));

	}

	printf("%d\n",min(ret1,ret2));

}
// Slower C++ solution:
//test https://blog.csdn.net/rising_shit/article/details/80739593

#include<iostream>

#include<stdio.h>

#include<string.h>

#include<algorithm>

#define maxn 2005

#define _x1 x1

#define _x2 x2

using namespace std;

typedef long long ll;

const ll mod=1e9+7;

int n,m;

ll v;

int fa[maxn],id[maxn],x[maxn],y[maxn];

ll w[maxn];

int getfa(int now)

{

	return fa[now]==now ? now : fa[now]=getfa(fa[now]);

}

int cmp(int i,int j)

{

	return w[i]<w[j];

}

ll kruskal(int now)

{

	for(int i=1;i<=n;i++) fa[i]=i;

	ll ans=0;

	if(now)

		fa[x[now]]=y[now],ans+=w[now];

	for(int i=1;i<=m;i++)

	{

		int pos=id[i];

		int x1=getfa(x[pos]),y1=getfa(y[pos]);

		if(x1!=y1)

		{

			ans+=w[pos];

			fa[x1]=y1;

		}

	}

	return ans;

}

ll quickpow(ll p,ll k)

{

	ll ans=1;

	while(k)

	{

		if(k&1)

			ans=(ans*p)%mod;

		p=(p*p)%mod;

		k>>=1;

	}

	return ans;

}

int main()

{

	scanf("%d%d%lld",&n,&m,&v);

	for(int i=1;i<=m;i++)

		scanf("%d%d%lld",&x[i],&y[i],&w[i]),id[i]=i;

	sort(id+1,id+1+m,cmp);

 

	ll temp=kruskal(0);

 

	if(temp>v)

	return printf("0\n"),0;

 

	if(temp==v)

	{

		int cnt1=0,cnt2=0;

		for(int i=1;i<=m;i++)

		{

			if(kruskal(i)==temp)

				cnt1++;

			else

				cnt2++;

		}

		ll res1=(quickpow(2,cnt1)-2+mod)%mod;

		ll res2=quickpow(2,cnt2)%mod;

		return printf("%lld\n",res1*res2%mod),0;

	}

	else

	{

		int cnt1=0,cnt2=0;

		for(int i=1;i<=m;i++)

		{

			ll res1=kruskal(i);

			if(res1==v)

				cnt1++;

			else if(res1>v)

				cnt2++;

		}

		ll res1=2ll*((quickpow(2,cnt1)-1+mod)%mod)%mod;

		ll res2=quickpow(2,cnt2);

		printf("%lld\n",res1*res2%mod);

	}

}


// Faster C++ solution for the same problem (measured speedup: 5.138509655553447x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#define ll long long

#define MOD 1000000007



//define

ll X;

int n, m;

struct Data{

	int x, y, v;

	bool operator<(const Data a)const{

		return v < a.v;

	}

}d[2333];



void input(){

	scanf("%d %d", &n, &m);

	scanf("%lld", &X);

	for(int i = 1; i <= m; i++)

		scanf("%d %d %d", &d[i].x, &d[i].y, &d[i].v);

	std::sort(d + 1, d + m + 1);

}



//work

ll ans;

int fa[1111];

int ls, mr, eq;



int find(int a){

	if(fa[a] == a) return a;

	return fa[a] = find(fa[a]);

}



void Kruskal(int a){

	ans = 0;

	for(int i = 1; i <= n; i++) fa[i] = i;

	ans = d[a].v;

	fa[d[a].x] = d[a].y;

	for(int i = 1; i <= m; i++){

		if(i == a) continue;

		int u = find(d[i].x), v = find(d[i].y);

		if(u == v) continue;

		fa[u] = v;

		ans = ans + d[i].v;

	}

	if(ans < X) ls++;

	if(ans == X) eq++;

	if(ans > X) mr++;

}



int Ans;



ll quickpow(ll p,ll k)

{

	ll tmp=1;

	while(k)

	{

		if(k&1)

			tmp=(tmp*p)%MOD;

		p=(p*p)%MOD;

		k>>=1;

	}

	return tmp;

}



void work(){

	/*p[0] = 1;

	for(int i = 1; i <= n; i++)

		p[i] = p[i - 1] * 2 % MOD;*/

	for(int i = 1; i <= m; i++) Kruskal(i);

	if(eq == 0) puts("0");

	else if(ls == 0)

		printf("%lld\n", 1ll * ((quickpow(2, eq) - 2 + MOD) % MOD) * quickpow(2, mr) % MOD);

	else

		printf("%lld\n", 2ll * ((quickpow(2, eq) - 1 + MOD) % MOD) % MOD * quickpow(2, mr) % MOD);

}



int main(){

	input();

	work();

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long LL;



LL f[20];



LL p[20];



int main(){

    LL n;scanf("%lld",&n);



    f[0]=1;

    for(int i=1;i<=12;++i)f[i]=26ll*f[i-1];

    for(int i=2;i<=12;++i)f[i]+=f[i-1];



    p[0]=1;

    for(int i=1;i<=12;++i)p[i]=26ll*p[i-1];



    int idx=1;

    while(f[idx]<n)++idx;



    string res;



    LL cnt;

    if(idx==1)cnt=0;

    else cnt=f[idx-1];



    for(int i=1;i<=idx;++i){

        for(int ch=0;ch<=25;++ch){

            LL t=cnt+1ll*(ch+1)*p[idx-i];

            if(t>=n){

                res+=ch+'a';

                cnt+=1ll*ch*p[idx-i];

                break;

            }

        }

    }



    cout<<res;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.331821655599768x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

typedef int int_;

#define int long long

#define maxn 200010

const int inf=1e9+7;

inline int read(){

	int ret=0,ff=1;

	char ch=getchar();

	while(ch<'0'||ch>'9'){

		if(ch=='-') ff=-ff;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9'){

		ret=ret*10+ch-'0';

		ch=getchar();

	}

	return ret*ff;

}



int gcd(int a,int b){

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

}

int ksm(int a,int b,int p){

	int ret=1;

	while(b){

		if(b&1) ret=ret*a%p;

		a=a*a%p;

		b>>=1;

	}

	return ret%p;

}

bool vis[maxn];

int a[maxn],ans[maxn];

int qwq[maxn];

int_ main(){

	int n=read();

	int cnt=0;

	while(n--){

		ans[++cnt]=n%26;

		n/=26;

	}

	while(cnt){

		printf("%c",'a'+ans[cnt]);

		--cnt;

	}

}
// Slower C++ solution:
#include <iostream>

#include <string>

#include <algorithm>

using namespace std;

int main(){

	long long n,i=1;

	string k ="";

	cin >> n;

	while(n!=0){

		k+=char('a'+((n-1)%26));

		n--;

		n/=26;

	

	};

	reverse(k.begin(),k.end());

	cout <<  k << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.389926415166663x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

typedef int int_;

#define int long long

#define maxn 200010

const int inf=1e9+7;

inline int read(){

	int ret=0,ff=1;

	char ch=getchar();

	while(ch<'0'||ch>'9'){

		if(ch=='-') ff=-ff;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9'){

		ret=ret*10+ch-'0';

		ch=getchar();

	}

	return ret*ff;

}



int gcd(int a,int b){

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

}

int ksm(int a,int b,int p){

	int ret=1;

	while(b){

		if(b&1) ret=ret*a%p;

		a=a*a%p;

		b>>=1;

	}

	return ret%p;

}

bool vis[maxn];

int a[maxn],ans[maxn];

int qwq[maxn];

int_ main(){

	int n=read();

	int cnt=0;

	while(n--){

		ans[++cnt]=n%26;

		n/=26;

	}

	while(cnt){

		printf("%c",'a'+ans[cnt]);

		--cnt;

	}

}
// Slower C++ solution:


#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <vector>

#include <map>

#include <cmath>

#include <queue>

#include <set>

#include <ctime>

#define rep(i,j,k) for(int i = j; i <= k; i++)

#define dow(i,j,k) for(int i = j; i >= k; i--)

#define ez(i,x) for(int i = h[x]; i; i = e[i].next)

#define fi first

#define se second

#define MS(x) memset(x, 0, sizeof(x))

using namespace std;



long long f[100];



int main() {

	f[1] = 1;

	f[2] = 26;

	rep(i,3,80) f[i] = f[i-1] * 26;

	rep(i,2,80) f[i] += f[i-1];

	long long a;

	string s;

	cin >> a;

	int b = 0;

	rep(i,1,50) {

		//cout << a << " " << f[i] << endl;

        if (a < f[i]) {

        a -= f[i-1], b= i-1;;

       

        break;

        }

	}

	rep(i,1,b) {

		s.push_back(a % 26 + 'a');

		a /= 26;

	}

	reverse(s.begin(), s.end());

	cout << s << endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.391477621144406x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

typedef int int_;

#define int long long

#define maxn 200010

const int inf=1e9+7;

inline int read(){

	int ret=0,ff=1;

	char ch=getchar();

	while(ch<'0'||ch>'9'){

		if(ch=='-') ff=-ff;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9'){

		ret=ret*10+ch-'0';

		ch=getchar();

	}

	return ret*ff;

}



int gcd(int a,int b){

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

}

int ksm(int a,int b,int p){

	int ret=1;

	while(b){

		if(b&1) ret=ret*a%p;

		a=a*a%p;

		b>>=1;

	}

	return ret%p;

}

bool vis[maxn];

int a[maxn],ans[maxn];

int qwq[maxn];

int_ main(){

	int n=read();

	int cnt=0;

	while(n--){

		ans[++cnt]=n%26;

		n/=26;

	}

	while(cnt){

		printf("%c",'a'+ans[cnt]);

		--cnt;

	}

}