stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std; 

  

int main(){

	int aux,sum,j,k,i;

	int ar[5];

	int* max;



	scanf("%d%d%d%d",&ar[0],&ar[1],&ar[2],&k);



	max=max_element(ar,ar+3);



	sum=*max<<k;



	j=max-ar;



	for(i=0;i<3;i++)

		if(i!=j)

			sum+=ar[i];



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



	return 0;



}

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

#include<string.h>

#include<ctype.h>



int main(){

	int a, b, c;

	int k;

	scanf("%d %d %d", &a, &b, &c);

	scanf("%d", &k);

	if(a>b && a>c) printf("%d\n", (a<<k)+b+c);

	else if(b>a && b>c) printf("%d\n", a+(b<<k)+c);

	else printf("%d\n", a+b+(c<<k));

	return 0;

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

#include <algorithm>

#include <cstdio>



using namespace std;



int main(){

    long long n;

    cin>>n;

    long long result = n*(n-1)/2;

    cout<<result<<endl;

}


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

int main() {

    long long N;

    scanf("%lld",&N);

    N--;

    printf("%lld",N+(N*N-N)/2);

    return 0;

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



using namespace std;



#define el				'\n'

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

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

#define clr(v, d)		memset(v, d, sizeof(v))



double const EPS = 1e-8, PI = acos(-1);

const int N = 2e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;

const long long MOD = 1e9 + 7;



typedef long long ll;



void OUTPUT() {

	cout << fixed << setprecision(12);

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

}



void INPUT() {

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	//freopen("output.txt", "w", stdout);

#endif

	cout << fixed << setprecision(12);

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

}



vector<vector<int>> edges(N);

ll n, q, x, y;

ll counter[N];

bool vis[N];



int main() {

	OUTPUT();

//	INPUT();

	cin >> n;

	x = n;

	x--;

//	ll ans = (double(1 + x) / 2.0) * x;

	ll ans = x + (x * x);

	ans /= 2;

	cout << ans;

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

//		y += i % x;

//		cout << i % x << " " << i << el;

//		x--;

//	}

//	cout << y;



	return 0;



}


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

     

    using namespace std;

     

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

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

    #define pb push_back

    #define MP make_pair

    #define SZ(v) ((int)((v).size()))

    typedef long long ll;

     

    const ll MOD = 1e9 + 7;

    const int OO = (int)1e6;

    const int N = (int)1e7;

     

    void init(){

        ios_base::sync_with_stdio(0);

        cin.tie(0);

        cout.tie(0);

    }

     

    int main() {

    	#   ifdef LOCAL_PROJECT

            freopen("in.txt", "r", stdin);

        #   endif

        // int q;

        // scanf("%d",&q);

        // while (q--){

        //     ll n,k,a,b;

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

        //     k-=a*n;

        //     if(k>0)printf("%d\n",n);

        //     else{

        //         k*=-1;

        //         ll diff = a-b;

        //         ll cant = (k+diff)/diff;

        //         if(cant>n)puts("-1");

        //         else printf("%lld\n",n-cant);

        //     }

        // }

        ll n;

        scanf("%lld",&n);

        printf("%lld",(n*(n-1))/2);

        

        return 0;

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



int main()

{

	long long n;

	std::cin>>n;



	n--;

	std::cout<<(n*(n+1)/2)<<std::endl;

	

}

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

#include<cstring>

#include<iostream>

#include<queue>

#include<map>

#include<cstdlib>

#include<stack>

#include<algorithm>

#include<set>

#include<cmath>

#include<vector>

using namespace std;

int main()

{

	#ifdef local

	freopen("1.txt","r",stdin);

	#endif

	long long n;

	scanf("%lld",&n);

	printf("%lld",n*(n-1)/2);

}

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#define mst(a,b) memset(a,b,sizeof(a))

#define lowbit(x) ((x)&(-x))

#define X first

#define Y second

#define lc o<<1

#define rc o<<1|1

using namespace std;

using namespace __gnu_cxx;

using namespace __gnu_pbds;

typedef long long LL;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3f;

const int maxn = 100000+10;

const int maxm = 2000+10;

const int mod = 1e9+7;

const double eps = 1e-8;

int a[maxn];

int main() {

#ifdef local

    freopen("in.txt", "r", stdin);

//    freopen("out.txt", "w", stdout);

#endif

    ios::sync_with_stdio(0);

    cin.tie(0);cout.tie(0);

    int n; cin>>n;

    cout<<1ll*n*(n-1)/2<<"\n";

    return 0;

}


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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

using namespace std;

int main(){

	long long int n;

	cin>>n;

	long long int sum = 0 ;

	sum = n*(n-1)/2;

	cout<<sum<<endl;

	

	return 0;

}

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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



using namespace std;



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

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

#define pb push_back

#define MP make_pair

#define SZ(v) ((int)((v).size()))

typedef long long ll;



const ll MOD = 1e9 + 7;

const int OO = (int)1e6;

const int N = (int)1e7;



void init(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

}



int main() {

	#   ifdef LOCAL_PROJECT

        freopen("in.txt", "r", stdin);

    #   endif

    // int q;

    // scanf("%d",&q);

    // while (q--){

    //     ll n,k,a,b;

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

    //     k-=a*n;

    //     if(k>0)printf("%d\n",n);

    //     else{

    //         k*=-1;

    //         ll diff = a-b;

    //         ll cant = (k+diff)/diff;

    //         if(cant>n)puts("-1");

    //         else printf("%lld\n",n-cant);

    //     }

    // }

    ll n;

    scanf("%lld",&n);

    printf("%lld",(n*(n-1))/2);

    

    return 0;

}

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

using namespace std;

int main()

{   /// Standing in the hall of fame

    ios_base::sync_with_stdio() , cin.tie(NULL) , cout.tie(NULL);

    long long n;

    cin >> n;

    cout << n*(n-1)/2 << "\n";

    return 0;

}

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

#include <iomanip>

#include <stdio.h>

#include <math.h>

#include <string>

#include <cstring>

#include <bits/stdc++.h>

#include <search.h>

#include <algorithm>

#include <vector>

#include <deque>

#include <set>

#include<stack>

#include <utility>

using namespace std;

int main()

{

    long long int n;

    cin>>n;

    cout<<(n*(n-1))/2;

return 0;

}


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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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



using namespace std;



#define el				'\n'

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

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

#define clr(v, d)		memset(v, d, sizeof(v))



double const EPS = 1e-8, PI = acos(-1);

const int N = 2e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;

const long long MOD = 1e9 + 7;



typedef long long ll;



void OUTPUT() {

	cout << fixed << setprecision(12);

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

}



void INPUT() {

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	//freopen("output.txt", "w", stdout);

#endif

	cout << fixed << setprecision(12);

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

}



vector<vector<int>> edges(N);

ll n, q, x, y;

ll counter[N];

bool vis[N];



int main() {

	OUTPUT();

//	INPUT();

	cin >> n;

	x = n;

	x--;

//	ll ans = (double(1 + x) / 2.0) * x;

	ll ans = x + (x * x);

	ans /= 2;

	cout << ans;

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

//		y += i % x;

//		cout << i % x << " " << i << el;

//		x--;

//	}

//	cout << y;



	return 0;



}


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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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

     

    using namespace std;

     

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

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

    #define pb push_back

    #define MP make_pair

    #define SZ(v) ((int)((v).size()))

    typedef long long ll;

     

    const ll MOD = 1e9 + 7;

    const int OO = (int)1e6;

    const int N = (int)1e7;

     

    void init(){

        ios_base::sync_with_stdio(0);

        cin.tie(0);

        cout.tie(0);

    }

     

    int main() {

    	#   ifdef LOCAL_PROJECT

            freopen("in.txt", "r", stdin);

        #   endif

        // int q;

        // scanf("%d",&q);

        // while (q--){

        //     ll n,k,a,b;

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

        //     k-=a*n;

        //     if(k>0)printf("%d\n",n);

        //     else{

        //         k*=-1;

        //         ll diff = a-b;

        //         ll cant = (k+diff)/diff;

        //         if(cant>n)puts("-1");

        //         else printf("%lld\n",n-cant);

        //     }

        // }

        ll n;

        scanf("%lld",&n);

        printf("%lld",(n*(n-1))/2);

        

        return 0;

    }

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

#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>



using namespace std;

 

typedef long long ll;

#define For(i,x,y) for(int i=x; i<y; ++i)

#define mem(x,y) memset(x,y,sizeof(x))

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

#define PII pair<int,int>

#define INF 0x3f3f3f3f

#define DOF 0x7f7f7f7f

#define se second

#define fi first

#define endl '\n'



template <typename T>

inline void read(T &r){

    static char c; r=0; int f=1;

    for(c=getchar(); c<'0'||c>'9'; c=getchar()) if(c=='-')f=-1; 

    for(; c>='0'&&c<='9'; r=(r<<1)+(r<<3)+(c^48),c=getchar());

    r*=f;

} // -_-



const int N = 1e3 + 105;



int main(){

    ll n;

    scanf("%lld", &n);

    printf("%lld\n", (1 + n)*n/2 - n);

    // system("pause");

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



using namespace std;



#define el				'\n'

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

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

#define clr(v, d)		memset(v, d, sizeof(v))



double const EPS = 1e-8, PI = acos(-1);

const int N = 2e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;

const long long MOD = 1e9 + 7;



typedef long long ll;



void OUTPUT() {

	cout << fixed << setprecision(12);

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

}



void INPUT() {

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	//freopen("output.txt", "w", stdout);

#endif

	cout << fixed << setprecision(12);

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

}



vector<vector<int>> edges(N);

ll n, q, x, y;

ll counter[N];

bool vis[N];



int main() {

	OUTPUT();

//	INPUT();

	cin >> n;

	x = n;

	x--;

//	ll ans = (double(1 + x) / 2.0) * x;

	ll ans = x + (x * x);

	ans /= 2;

	cout << ans;

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

//		y += i % x;

//		cout << i % x << " " << i << el;

//		x--;

//	}

//	cout << y;



	return 0;



}


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

using namespace std;

#define int  long long

#define tc(t)  int t; cin>>t; while(t--)

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

#define endl   "\n"















int32_t main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

   int n;

   cin>>n;

   n=n-1;

   cout<<n*(n+1)/2<<endl;













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



using namespace std;



#define el				'\n'

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

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

#define clr(v, d)		memset(v, d, sizeof(v))



double const EPS = 1e-8, PI = acos(-1);

const int N = 2e5 + 9, M = 50 + 9, OO = (int) 1e9 + 1;

const long long MOD = 1e9 + 7;



typedef long long ll;



void OUTPUT() {

	cout << fixed << setprecision(12);

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

}



void INPUT() {

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	//freopen("output.txt", "w", stdout);

#endif

	cout << fixed << setprecision(12);

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

}



vector<vector<int>> edges(N);

ll n, q, x, y;

ll counter[N];

bool vis[N];



int main() {

	OUTPUT();

//	INPUT();

	cin >> n;

	x = n;

	x--;

//	ll ans = (double(1 + x) / 2.0) * x;

	ll ans = x + (x * x);

	ans /= 2;

	cout << ans;

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

//		y += i % x;

//		cout << i % x << " " << i << el;

//		x--;

//	}

//	cout << y;



	return 0;



}


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

#pragma GCC optimize("O2")

using namespace std;



# define mp make_pair

# define pb push_back

# define PI acos(-1)

# define ff first 

# define ss second 

# define endl '\n'

# define vt vector

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

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



typedef long long ll ; 

typedef long double ld ; 

typedef pair<int,int> pii ; 

typedef pair<ll,ll> pll ;



template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }

template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }



const int MOD = 1e9+9 ;

const ll inf = 1e18 ;  

const ll mod = 1e9+7 ;  



ll nCr(ll n,ll r){ll t=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){t*=(n-i);t/=(i+1);}return t;}

ll power(ll a, ll n) { ll r=1;while(n){if(n&1)r=(r*a)%MOD;n>>=1;a=(a*a)%MOD;}return r%MOD;}

ll sq(int x) { ll ans = x*x ; return ans ; }

ll gcd(ll a, ll b) 

{ 

    if (a == 0) 

        return b; 

    return gcd(b % a, a); 

} 

void read(vt<int> &a) {

	rep(i,0,a.size()) 

	cin >> a[i] ; 

}

void read(vt<ld> &a) {

	rep(i,0,a.size()) 

	cin >> a[i] ; 

}



// ==========Start Here==============



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(NULL) ; 

	

	ll n ; 

	cin >> n ; 

	n--; 

	cout << (n*(n+1))/2  ; 



 	

 	return 0 ; 

 	

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

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    int N, W;

    cin >> N >> W;

    int w[N + 1], v[N + 1];

    map<int, vector<int> > dict;

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

        cin >> w[i] >> v[i];

        dict[w[i]].push_back(v[i]);

    }

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

        vector<int>& vect = dict[w[1] + i];

        sort(vect.begin(), vect.end(), greater<int>());                     // descending order (greedy)

    }

    int max_value = 0;

    for (int a = 0; (size_t)a <= dict[w[1]].size(); a++) {                  // 'a': qty of w1

        if (a * w[1] > W)

            break;

        int value_a = 0;

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

            value_a += dict[w[1]][i];

        for (int b = 0; (size_t)b <= dict[w[1] + 1].size(); b++) {          // 'b': qty of w1+1

            if (a * w[1] + b * (w[1] + 1) > W)

                break;

            int value_b = 0;

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

                value_b += dict[w[1] + 1][i];

            for (int c = 0; (size_t)c <= dict[w[1] + 2].size(); c++) {      // 'c': qty of w1+2

                if (a * w[1] + b * (w[1] + 1) + c * (w[1] + 2) > W)

                    break;

                int value_c = 0;

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

                    value_c += dict[w[1] + 2][i];

                for (int d = 0; (size_t)d <= dict[w[1] + 3].size(); d++) {  // 'd': qty of w1+3

                    if (a * w[1] + b * (w[1] + 1) + c * (w[1] + 2) + d * (w[1] + 3) > W)

                        break;

                    int value_d = 0;

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

                        value_d += dict[w[1] + 3][i];

                    max_value = max(max_value, value_a + value_b + value_c + value_d);

                }

            }

        }

    }

    cout << max_value << "\n";



    return 0;

}

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

#include       <map>

#include     <queue>

#include     <cmath>

#include    <cstdio>

#include    <cctype>

#include    <vector>

#include   <cstring>

#include <algorithm>

using namespace std;



typedef long long ll;

const ll mod = 1e9+7;

const double eps = 1e-7;

const int maxn = 105;



ll fast_pow(ll a,ll b,ll mod){

    ll ans = 1;

    while(b){

        if(b&1)

            ans = ans*a%mod;

        a = a*a%mod;

        b>>=1;

    }

    return ans;

}



int w[maxn], v[maxn];

int dp[maxn*4][maxn];



int main(){

    int n, W, c;

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

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

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

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

        w[i] -= w[0]-1;

    c = w[0]-1;

    w[0] = 1;

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

        for(int j=(i+1)*4;j>=w[i];j--)

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

                dp[j][k] = max(dp[j][k],dp[j-w[i]][k-1]+v[i]);

    }

    int ans = 0;

    for(int j=n*4;j>=0;j--)

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

            if(1ll*k*c+j<=W){

                ans = max(ans,dp[j][k]);

            }

    }

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

    return 0;

}