stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <algorithm>

#include <cstdio>

#include <iostream>

#include <cfloat>

#include <climits>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <queue>

#include <sstream>

#include <stack>

#include <time.h>

#include <vector>

#include <complex>

#include <map>

#include <set>

#include <iomanip>

#include <math.h>

#include <stdlib.h>

#include <list>

#include <utility>

#include <memory>

#include <cstring>

#include <fstream>

#include <numeric>

#include <assert.h>

#include <bits/stdc++.h>

using namespace std;

#define f first

#define s second 

const int INF=1<<29;

typedef pair<int,int> pii;

int N,M;

int a[200004];

bool vis[200004];

vector <pii> g[200004];

int maxn,minn;

void dfs(int x){

	minn=min(a[x],minn);

	maxn=max(a[x],maxn);

	for (int i=0;i<g[x].size();i++){

		int n=g[x][i].f;

		if (vis[n]){

			if (a[n]!=a[x]+g[x][i].s){

				puts("No");

				exit(0);

			}

		}

		else{

			vis[n]=1;

			a[n]=a[x]+g[x][i].s;

			dfs(n);

		}

	}

}

int main(){

	cin>>N>>M;

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

		int x,y,d;

		cin>>x>>y>>d;

		g[x].push_back(pii(y,d));

		g[y].push_back(pii(x,-d));  

	}

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

		if (vis[i]) continue;

		maxn=-INF,minn=INF;

		vis[i]=1;

		a[i]=0;

		dfs(i);

		if (maxn-minn<=1e9);

		else{

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

int n,m;

int f[100004],h[100004];

int F(int x){

	if(f[x]==x)return x;

	int pa=F(f[x]);

	h[x]+=h[f[x]],f[x]=pa;

	return f[x];

}

int main(){

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

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

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

		int L,R,D;scanf("%d%d%d",&L,&R,&D);

		int l=F(L),r=F(R);

		if(l==r){

			if(h[R]-h[L]!=D){

				puts("No");

				return 0;

			}

		}else{

			f[r]=l;

			h[r]=D+h[L]-h[R];

		}

	}

	puts("Yes");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



int main(){



 int a,b,c;

    cin>>a>>b>>c;

    if(a+b+c < 22){

    cout<<"win\n";}



    else if(a+b+c >= 22){

    cout<<"bust\n";}





}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

  int num1, num2, num3;

  scanf("%d %d %d", &num1, &num2, &num3);

  (num1 + num2 + num3 >= 22) ? puts("bust") : puts("win");

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

          long long int a,b,c;

          cin>>a>>b>>c;

          if((a+b+c)>=22)

          {

                    cout<<"bust\n";

          }

          else

                    cout<<"win\n";

return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

  int num1, num2, num3;

  scanf("%d %d %d", &num1, &num2, &num3);

  (num1 + num2 + num3 >= 22) ? puts("bust") : puts("win");

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int a,b,c,n;

    cin>>a>>b>>c;

    n=a+b+c;

    if(n<22)

        cout<<"win"<<endl;

    else

        cout<<"bust"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int num1, num2, num3;

	scanf("%d %d %d", &num1, &num2, &num3);

	(num1+num2+num3>=22)?puts("bust"):puts("win");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std ;



int main()



{

    int a,b,c ;



    cin>>a>>b>>c ;



    if(a+b+c>=22)

    {

        cout<<"bust"<<endl ;



    }

    else

    {

        cout<<"win"<<endl ;

    }

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int num1, num2, num3;

	scanf("%d %d %d", &num1, &num2, &num3);

	(num1+num2+num3>=22)?puts("bust"):puts("win");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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=1;i<=n;i++)

#define endl   "\n"















int32_t main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int  a,b,c;



    cin>>a>>b>>c;

    if(a+b+c>=22) cout<<"bust"<<endl;

    else cout<<"win"<<endl;







    















}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int num1, num2, num3;

	scanf("%d %d %d", &num1, &num2, &num3);

	(num1+num2+num3>=22)?puts("bust"):puts("win");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

 

#define ll long long

#define ull unsigned long long

 

using namespace std;

 

int main() {

	int A, B, C;

	cin >> A >> B >> C;

 

	if (A+B+C >= 22){

	cout << "bust" ;

 	} else {

	cout << "win" ;

 

 	}

 

 

 

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int num1, num2, num3;

	scanf("%d %d %d", &num1, &num2, &num3);

	(num1+num2+num3>=22)?puts("bust"):puts("win");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

using  namespace std;

int main()

{

	int a,b,c;

	while(scanf("%d%d%d",&a,&b,&c)!=EOF)

	{

		if(a+b+c>=22)

		printf("bust\n");

		else

		printf("win\n");

	}

 } 

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main(){

	int A1, A2, A3;

	scanf("%d %d %d", &A1, &A2, &A3);

	int sum = A1 + A2 + A3;

	(sum >= 22) ?puts("bust") : puts("win"); 

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

int  s1,s2,s3;

cin>>s1>>s2>>s3;

if(s1+s2+s3>=22){

  cout<<"bust"<<endl;

}

else{

   cout<<"win"<<endl;

}

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main(){

	int A1, A2, A3;

	scanf("%d %d %d", &A1, &A2, &A3);

	int sum = A1 + A2 + A3;

	(sum >= 22) ?puts("bust") : puts("win"); 

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;





int main()

{

    int a,b,c;



    cin >> a >> b >> c;



    if((a+b+c) >=22)

    {

        cout << "bust" << endl;

    }

    else

    {

        cout << "win" << endl;

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main(){

	int A1, A2, A3;

	scanf("%d %d %d", &A1, &A2, &A3);

	int sum = A1 + A2 + A3;

	(sum >= 22) ?puts("bust") : puts("win"); 

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



void fun(int A1, int A2, int A3)

{

      if((A1+A2+A3)>=22)

      {

           cout<<"bust";

      }

      else

       cout<<"win";

}

int main()

{

     int A1,A2,A3;

     cin>>A1>>A2>>A3;

    fun(A1,A2,A3);

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main(){

	int A1, A2, A3;

	scanf("%d %d %d", &A1, &A2, &A3);

	int sum = A1 + A2 + A3;

	(sum >= 22) ?puts("bust") : puts("win"); 

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//

//  main.cpp

//  vjudge

//

//  Created by Sudipto Mondal on 7/9/20.

//  Copyright © 2020 Sudipto Mondal. All rights reserved.

//



#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {

    long long int a,b,c;

    cin>>a>>b>>c;

    

    if((a+b+c)>=22){

        cout<<"bust"<<endl;

    }else{

        cout<<"win"<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

  int num1, num2, num3;

  scanf("%d %d %d", &num1, &num2, &num3);

  (num1 + num2 + num3 >= 22) ? puts("bust") : puts("win");

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    cin >> a >> b>> c;

    if(a+b+c<22)

        cout << "win\n";

    else

         cout << "bust\n";

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

  int num1, num2, num3;

  scanf("%d %d %d", &num1, &num2, &num3);

  (num1 + num2 + num3 >= 22) ? puts("bust") : puts("win");

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{ 

     int   a1,a2,a3,sum;

     

     cin>>a1;

     cin>>a2;

     cin>>a3;

     

     sum = a1 + a2 + a3;

     if(sum>=22)

     { 

          cout<<"bust";

     }

     else 

     {

         cout<<"win";

     }

      return 0;

} 


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main()

{

  int num1, num2, num3;

  scanf("%d %d %d", &num1, &num2, &num3);

  (num1 + num2 + num3 >= 22) ? puts("bust") : puts("win");

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main(){

	int a, b, c;

	cin >> a >> b >> c;

	if (a + b + c >= 22){

		cout << "bust";

	}else {

	cout << "win";

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int a, b, c;

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



  if(a + b + c < 22) puts("win");

  else puts("bust");

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{ int i,x,u;







     cin>>i >>x>>u;

     if(i+x+u>=22)

        cout<<"bust";

     else

        cout<<"win";

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int a, b, c;

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



  if(a + b + c < 22) puts("win");

  else puts("bust");

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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()

{

int a1,a2,a3;

cin>>a1>>a2>>a3;

if(a1+a2+a3 >= 22) cout<<"bust";

else cout<<"win";

return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int a, b, c;

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



  if(a + b + c < 22) puts("win");

  else puts("bust");

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

	int b,c,d;

	cin>>b>>c>>d;

	if(b+c+d>=22)

	cout<<"bust";

	else

	cout<<"win";

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int a, b, c;

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



  if(a + b + c < 22) puts("win");

  else puts("bust");

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() 

{

  int a,b,c;

  cin>>a>>b>>c;

  if(a+b+c>=22)

  {

    

    cout<<"bust";

  }

  else{

    cout<<"win";

  }

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

  int a, b, c;

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



  if(a + b + c < 22) puts("win");

  else puts("bust");

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <iomanip>

#include <cmath>

#include <stdio.h>

#include <queue>

#include <deque>

#include <cstdio>

#include <set>

#include <map>

#include <bitset>

#include <stack>

#include <cctype>

using namespace std;

int gcd(int a, int b)

{

	if (a % b == 0)

	{

		return(b);

	}

	else

	{

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

	}

}

int main(){

	int k;

	cin >> k;

	int ans = 0;

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

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

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

				ans += gcd(gcd(i, j), l);

			}

		

		}

	}

	cout << ans << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <algorithm>

#include <vector>

#include <iomanip>

#include <cmath>

#include <stdio.h>

#include <queue>

#include <deque>

#include <cstdio>

#include <set>

#include <map>

#include <bitset>

#include <stack>

#include <cctype>

using namespace std;

long long e[100010];

int main() {

    long long n, k;

    cin >> k;

    n = 3;

    long long ans = 0;

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

        long long m = k / i;

        long long b = 0;

        for (long long j = 1; j * j <= i; j++) {

            if (i % j == 0) {

                b += e[j];

                if (j != i / j && j != 1) {

                    b += e[i / j];

                }

            }

        }

        if (i == 1) {

            b = 0;

        }

        long long n1 = n;

        long long ans1 = 1;

        while (n1 > 0) {

            if ((n1 & 1) == 1) {

                ans1 = ans1 * m % 1000000007;

            }

            m = m * m % 1000000007;

            n1 >>= 1;

        }

        ans += ans1 * (i - b) % 1000000007;

        ans %= 1000000007;

        e[i] = (i - b);

    }

    cout << ans << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

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

using ll = long long;

using vi = vector<int>;

using vvi = vector<vi>;



int main(){

  int k;

  cin >> k;

  int ans = 0;

  for(int a=1; a<=k; a++)for(int b=1; b<=k; b++)for(int c=1; c<=k; c++){

    int mx = 0;

    mx = min(a, b);

    mx = min(mx, c);

    for(int i=mx; i>=1; i--){

      if(a%i==0 && b%i==0 & c%i==0){

        ans += i;

        break;

      }

    }

  }

  cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

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

using ll = long long;

using vi = vector<int>;

using vvi = vector<vi>;



int main(){

  int k;

  cin >> k;

  int ans = 0;

  for(int a=1; a<=k; a++)for(int b=1; b<=k; b++)for(int c=1; c<=k; c++){

    ans += gcd(a, gcd(b, c));

  }

  cout << ans << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
    #include <bits/stdc++.h>

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

     

    using namespace std;  

    using ll = long long;

    using P = pair<int,int>; 

    

    int main() {

   

     int k;

     cin >> k;

     ll count = 0;

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

     	for(int j = 1; j <= k; j++){//b

     		for(int m = 1; m <= k; m++){//c

     			int a = i;

     			int b = j;

     			int c = m;

     			

     			int min = a;

     			if(min>=b)	min = b;

     			if(min>=c)	min = c;

     			

     			int go = 1;

     			

     			for(int h = 1; h <= min; h++){

     				if(a%h == 0 && b%h == 0 && c%h == 0) go = h;

     			}

     			count += go;

     		}

     	}

     }

     	cout << count <<'\n';

     

     return 0;

    }

// Optimized solution to the same problem (faster):
     #include <bits/stdc++.h>

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

     

    using namespace std;  

    using ll = long long;

    using P = pair<int,int>; 

    

    ll gcd(ll x,ll y){

    	if(y==0) return x;

    	else	 return gcd(y,x%y);

    }

    int main() {

    int k;

    cin >> k;

    ll sum = 0;

    

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

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

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

    			sum += gcd(gcd(a,b),c);

   		    }

    	

        }

    }

    

    cout << sum <<'\n';

     

     return 0;

    }

    

    

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef vector< int > vi;

typedef vector< vi > vvi;

typedef pair< int,int > ii;

#define ll	long long

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

#define pb push_back

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

#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 ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);



int gcd(int a, int b, int c) {

	return __gcd(a, __gcd(b, c)); 

}

int main() {	

	int k, sum = 0;

	cin>>k;

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

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

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

				sum += gcd(a, b, c);

			}

		}

	}

	cout<<sum;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

 

using namespace std;

 

typedef vector< int > vi;

typedef vector< vi > vvi;

typedef pair< int,int > ii;

#define ll	long long

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

#define pb push_back

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

#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 ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define hell 1000000007

#define PI 3.141592653589793



int main() 

{	ios;

	int t = 1;

	//cin>>t;

	while (t--) {

		int n = 3, k;

		cin>>k;

		unsigned ll dp[k+1];

		dp[0] = 0;

		dp[k] = 1;

		for (int h = k-1; h >= 1; --h) {

			int base = k/h;

			dp[h] = int(pow(base, n) + 0.5);

			//cout<<h<<" "<<ans[h]<<"\n";

			for (int mul = 2; h*mul <= k; mul++) {

				dp[h] -= dp[h*mul];

			}

			//cout<<"after mul "<<ans[h]<<"\n";

		}

		//for (auto x : dp) cout<<x<<" ";

		unsigned ll sum = 0;

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

			sum += i*dp[i];

		}

		sum %= hell;

		cout<<sum;

		cout<<"\n";

	}

    return 0; 

} 

/*

look for out of bounds

look for integer overflow, long long vs int

*/


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

  int N;

  cin >> N;

  long ans = 0;

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

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

      for (int k = 1; k <= N; k++) ans += gcd(gcd(i, j), k);

  cout << ans << "\n";

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

  int N;

  cin >> N;

  vector<int> V(N);

  for (int i = N; i > 0; i--) {

    V.at(i - 1) += (N / i) * (N / i) * (N / i);

    int j = i * 2;

    while (j <= N) V.at(i - 1) -= V.at(j - 1), j += i;

  }



  int ans = 0;

  for (int i = 0; i < N; i++) ans += V.at(i) * (i + 1);

  cout << ans << "\n";

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)

#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)

#define rep(i, n) FOR(i, 0, n)

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

using namespace std;

using ll = long long;

template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;

constexpr int mod = 1e9 + 7;

constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {

    if(a >= b) return false;

    a = b;

    return true;

}

template <typename T> constexpr bool chmin(T &a, const T &b) {

    if(a <= b) return false;

    a = b;

    return true;

}



/*-------------------------------------------*/



int main() {

    cin.tie(0);

    ios::sync_with_stdio(0);



    int k;

    cin >> k;

    ll ans = 0;

    FOR(i, 1, k + 1)

    FOR(j, 1, k + 1) FOR(l, 1, k + 1) ans += __gcd(i, __gcd(j, l));



    cout << ans << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)

#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)

#define rep(i, n) FOR(i, 0, n)

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

using namespace std;

using ll = long long;

template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;

constexpr int mod = 1e9 + 7;

constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {

    if(a >= b) return false;

    a = b;

    return true;

}

template <typename T> constexpr bool chmin(T &a, const T &b) {

    if(a <= b) return false;

    a = b;

    return true;

}



/*-------------------------------------------*/



int G[201][201];



int mygcd(int a, int b) {

    if(G[a][b]) return G[a][b];

    return G[a][b] = G[b][a] = __gcd(a, b);

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(0);



    int k;

    cin >> k;

    ll ans = 0;

    FOR(i, 1, k + 1)

    FOR(j, 1, k + 1) FOR(l, 1, k + 1) ans += mygcd(i, mygcd(j, l));



    cout << ans << endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



main()

{

int A,B,C,D, a[1000],b[1000],c[1000],n,aaa,k,i,r=0,rr=0,d1,dd=0,d2,d3,ck=0,m,j,aa,bb,cc;

//char cr[1000];

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

//cin>>A>>B>>C>>D;

cin>>n;



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



        for(j=1;j<=n;j++){



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

                aa=i;

                bb=j;

                cc=k;





        int x,y,z;

   // cout<<a[i]<<b[i]<<c[i]<<endl;









    if((aa<bb)&&(aa<cc)){

        x=aa;

    }

    else if((bb<aa)&&(bb<cc)){

        x=bb;

    }

    else{

        x=cc;

    }

  vvv:  if((aa%x==0)&&(bb%x==0)&&(cc%x==0)){

            y=x;



        dd=dd+y;

        x=123456;

    }



   if(x!=123456){

    x=x-1;

   }

    if(x!=123456)goto vvv;







}



}}



  cout<<dd;

//printf("%lld",dd);



    return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define MAXN 100010

const long long M = 1000000007;

using namespace std;

long long dp[MAXN];

long long N, K;



int pot(long long a, long long b){

    long long ans = 1;

    while(b){

        if(b&1){

            ans = (ans * a) % M;

        }

        a = (a * a) % M;

        b >>= 1;

    }

    return ans;

}

int main(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    N = 3;

    cin >> K;

    long long ans = 0;

    for(int i = K; i > 0; i--){

        dp[i] = pot(K / i, N);

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

            dp[i] -= dp[j];

        }

        dp[i] = ((dp[i] % M) + M) % M;

        ans += i * dp[i];

        ans %= M;

    }

    

    ans = ((ans % M) + M) % M;

    cout << ans << "\n";

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

using namespace std;

int main()

{

    long int n,s=0;

    cin>>n;

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

    {

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

        {

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

            {

                g=__gcd(j,k);

                s=__gcd(g,i)+s;

            }

        }

    }

    cout<<s;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define MAXN 100010

const long long M = 1000000007;

using namespace std;

long long dp[MAXN];

long long N, K;



int pot(long long a, long long b){

    long long ans = 1;

    while(b){

        if(b&1){

            ans = (ans * a) % M;

        }

        a = (a * a) % M;

        b >>= 1;

    }

    return ans;

}

int main(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    N = 3;

    cin >> K;

    long long ans = 0;

    for(int i = K; i > 0; i--){

        dp[i] = pot(K / i, N);

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

            dp[i] -= dp[j];

        }

        dp[i] = ((dp[i] % M) + M) % M;

        ans += i * dp[i];

        ans %= M;

    }

    

    ans = ((ans % M) + M) % M;

    cout << ans << "\n";

    return 0;

}

// Fastest known solution for this problem: