semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int m,n,sum;
	sum=0;
	scanf("%d", &n);
	for(m=0;m<=n;m++)
	{
		switch(m)
		{
case 7:
break;
case 14:
break;
case 17:
break;
case 21:
break;
case 27:
break;
case 28:
break;
case 35:
break;
case 37:
break;
case 42:
break;
case 47:
break;
case 49:
break;
case 56:
break;
case 57:
break;
case 63:
break;
case 70:
break;
case 67:
break;
case 71:
break;
case 72:
break;
case 73:
break;
case 74:
break;
case 75:
break;
case 76:
break;
case 77:
break;
case 78:
break;
case 79:
break;
case 84:
break;
case 87:
break;
case 91:
break;
case 97:
break;
case 98:
break;
default:
sum+=m*m;
break;
		}
	}
	printf("%d", sum);
		return 0;
}
int main()
{
    int sum, flag, n; 
    while(cin >> n)
    {
        sum = 0;
        for(int i = 1; i <= n; i++)
        {
            flag = 0;
            if(i%7 == 0) continue;
            int tmp = i;
            while(tmp != 0)
            {
                if(tmp%10 == 7) flag = 1;
                tmp = tmp/10;
            }
            if(flag == 1) continue;
            sum = sum + i*i;
        }
        cout << sum << endl;
    }
    return 0;
}
int main()
{
   int n;
   int sum=0;
   scanf("%d",&n);
   while(n>0)   
  {
       if(n%7==0 || n%10==7 || n/10==7) 
       {
         sum=sum;
        }
      else if(n%7!=0&&n%10!=7&&n/10!=7)
       { 
         sum = sum+n*n;
       }
         n=n-1;
        
  }
   printf("%d",sum);
   return 0;
}
/**
* ??
* 2010?10?13
* ?7???????
*/
int main()
{
	int n = 0;
	cin >> n;     
	int i, x, g;     //x ??????? g???????i??????sum?????
	int sum = 0;
	for ( i = 1; i <= n ; i++)
	{
		x = i / 10;
		g = i - (i/10)*10;
		if (( i % 7 == 0 )||( i == 7) || ( x == 7) || ( g == 7))   //??i?7????i???????7?????????
		    continue;
		else 
			sum = sum + i * i;
	}
	cout << sum << endl;
	return 0;
}
int main ()
{
	int n, x, y, sum;
	cin >> n;
	x = 1;
	sum = 0;
	do
	{
		y = x % 7;
		if ( y == 0 ) x = x + 1;
		else
		{
			y = x % 10;
			if ( y == 7 ) x = x + 1;
			else
			{
				y = x / 10;
				if ( y == 7 ) x = x + 1;
				else
					sum = sum + x * x;
					x = x + 1;
			}
		}
	}
	while ( x <= n );
	cout << sum;
	return 0;
}
//******************************
//* ????7???????   ** 
//* ?????? 1300012948   ** 
//* ???2013.10.10          ** 
//******************************
int main()
{
    int n, sum = 0, a, b;        // ???????????????????????????????????????????sum????0 
    cin >> n;                    // ??????n 
    for(int i = 1; i <= n; i++)  // ?????????7??????? 
    if(i % 7 != 0)               // ???i??7?????0?????i???????????a????i???????????b 
    {           
         a = i / 10;             
         b = i - a * 10;         
         if(a != 7 && b != 7)    // ???i?????????????7???????i?????sum
         {
              sum = sum + i * i;
         }
    }
    cout << sum << endl;         // ??sum 
    return 0;
}
int main(int argc, char* argv[])
{
	int a,b,sum=0;
	scanf("%d",&b);
	for(a=1;a<=b;a++){
		if(a%7==0)continue;
		if(a%10==7)continue;
		if(a-a%10==70)continue;
		sum+=a*a;
	}
	printf("%d\n",sum);
	return 0;
}
int main(int argc, char *argv[])
{
    int n, i ,sum=0;
    cin>>n;
    for (i=1 ;i <= n;i ++)
    { 
    if ((i%7) == 0)
		;
    else
	{if ((i/10 ==7) || ((i %10) ==7))
	;
           else
           {sum= sum +i*i;}
           }
      }
cout<<sum<<endl;

    return EXIT_SUCCESS;
}
int main()
{
	int a[PI];
	int i,sum,num,tmp;

	scanf("%d",&num);
	sum=0;
	for (i=1;i<=num;i++)
	{
		a[0]=i%10;
		a[1]=i/10;
		tmp=i%7;
		if (a[0]!=7&&a[1]!=7&&tmp!=0)
		{
			sum+=i*i;
		}
	}
	printf("%d",sum);
	return 0;
}
int main()
{int n,a,c;
scanf("%d",&n);
int i=1;
int s=0;
while(i<=n){
a=i%10;
c=i%7;
int b=(int)(i/10);
if((a!=7)&&(b!=7)&&(c!=0)){
	s=s+i*i;}
i++;}
printf("%d",s);
return 0;
}
int main()
{
	int n,ans=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		if (i%7!=0&&(i%10)!=7&&(i/10)!=7)
		{
			ans+=i*i;
		}
	}
	cout<<ans<<endl;
	return 0;
}
int main()
{
		int a,n,i=1,sum=0;
	scanf("%d",&n);
	while (i<=n){
		if(i%7==0||i/10==7||i-i/10*10==7){
		sum=sum;
		i++;
		}
		else{
			sum+=i*i;
			i++;
				
		}
	}
    
	printf("%d",sum);
	return 0;
	}
int main()
{
    int n,i,sum=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
      if(i%7!=0&&(i-((int)(i/10))*10)!=7&&i!=71&&i!=73&&i!=74&&i!=75&&i!=76&&i!=78&&i!=79&&i!=72){
             sum+=i*i;
        }
    }
      printf("%d",sum);
      return 0;
}
//********************************************************
//*    ??   1100012931                                 *
//*    ??   ???????????                     *
//*    ???  2011.10.16                                *
//********************************************************
int main()
{
	int n,m,t,d,k,all=0;
	cin>>n;
	for(m=1;m<=n;m++)
	{
		if(m%7==0)  continue;//*??????
		t=0;d=m;  //*????t?d????????????
		do
		{
			k=d%10;
			if(k==7)
			{t++;break;}//*break?????????
			d=d/10;
		}while(d>1);
		if(t==0) all+=m*m;  
	}cout<<all<<endl;
	return 0;
}
int main()
{
    int n,i,a=0,b,c,d;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        b = i % 7;
        c = i / 10;
        d = i % 10;
        if(b!=0&&c!=7&&d!=7)
            a = a + i * i;
    }
    cout << a <<endl;
  return 0;
}
int main()
{
	int n=0,sum=0;
	int i=1;
	cin>>n;
	while(i<=n)
	{
	
	int mark=0;//?7??
	//??7??
	int t=i;
	while(t!=0)
	{
		if(t%10==7)mark=1;//mark=1???7??
		t=t/10;
	}
	//??7???
	if(i%7==0)mark=1;
	if(mark==0)sum+=pow((double)i,2);
	i++;
	}
	cout<<sum<<endl;
	return 0;
}
//********************************
//*????7???????   **
//*?????? 1300012934 **
//*???2013.10.14  **
//********************************


int main()
{  
	int n , sum ; //??n????
	sum = 0;
	cin >> n ;
	for (int i = 1 ; i <= n ; i++)
	{
		if ( i % 7 != 0 ) //????7
		{
			if (i % 10 != 7)  //?????7
			{ 
				int x = i / 10; //?????
				if ( x != 7 ) //?????7
					sum = sum + i * i; //i???????i???
			}
		}
	}

	cout << sum << endl;
	return 0;
}
int main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i%7==0||i==17||i==27||i==37||i==47||i==57||i==67||i==87||i==97||i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79)
		{
		}
		else
			sum=sum+i*i;
	}
	cout<<sum<<endl;
	return 0;
}
int main () 
{
	int n, sum = 0, i, j, t1 = 0;
	scanf("%d",&n);
    for (j = 1; j <= n; j++)
	{
			if (j % 7 != 0)
			{
				int t2 = j;
				int m = (int)log10(t2), a[3];
				for (i = 0; i < t2; i++)
					{
						a[i] = t2 % 10;
						if (a[i] == 7)
						{t1 = 1; break;}
						else t1 = 0;
						t2 = t2 / 10;
					}
				if (t1 == 0)
					{	
						sum = sum + j*j;
					}
			}
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{int n , i , sum;
cin>>n;
sum=0;
for (i=1;i<=n;i++)
{	if (i%7!=0 && i%10!=7 && (i/10)%10!=7 )
{  sum=sum+i*i;
}
}
cout<<sum;
return 0;
}
/*???:?7???????
**?  ?:??
**?  ?:2010?10?16?
*/
int main()
{
	int n, i, sum = 0;//??????
	cin >> n;
	if (n > 0 && n < 100)
		for (i = 1;i <= n;i++)
		{
			if (i % 7 != 0)//?i???7???
			{
				if (i <= 9)//i?1???
			{sum = sum + i * i;}//????
				else if ((i / 10) != 7 && (i % 10) != 7)//?i?2????????7?
					sum = sum + i * i;//????
			}
		}
		cout << sum << endl;
		return 0;
}
int main()
{
	int n;
	cin >> n;
	int num = 1, sum = 0;
	int a, b;
	while (num <= n)
	{
		if (num % 7 == 0)
			num += 1;
		else
		{
			a = num / 10;
			b = num - a * 10;
			if ((a == 7) || (b == 7))
				num += 1;
			else
				{
					sum = sum + num * num;
					num += 1;
				}
		}
	}
	cout << sum << endl;
	return 0;
}
int pd(int i)
{
	if(i%7==0) return 0;
	while(i!=0)
	{
		if(i%10==7) return 0;
		i/=10;
	}
	return 1;
}
int main()
{
	int i,j,n,sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(pd(i))
		sum+=i*i;
	}
	cout<<sum<<endl;
	return 0;
}
//******************************************
//*  ? ? ?:-1.2-                        * 
//*  ?    ?:???                       * 
//*  ????:10.6                         * 
//*  ????:??7?????              * 
int main()
{
  float n;
  int S=0;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    int xi,yi,zi;
    if(i%7!=0)
    {
       xi=i;
       if(floor(xi/10.0)!=7)
       {
         yi=xi;
         if(yi%10!=7)
         {
           zi=yi;
           S=S+zi*zi;
         }
       }
    }  
   }
   cout<<S<<endl;
   return 0;
}
int main()
{
	int n,s,x,i;
	scanf("%d",&n);
	s=0;
    for(i=1;i<=n;i++){
		x=i/10;		
		if(i % 7 == 0 || x == 7 || i-(x*10) == 7)
		{
			;
		}		
		else
		{
			s=s+i*i;
		}	
	}
	printf("%d",s);
	return 0;
}
int main()
{
  int n,i,j=0,k=0,p=0,q=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{ 
  j+=i*i;
}
for(i=1;i<=n;i++)
{
  if(i%7==0)
  {
    k+=i*i;
   }
}
for(i=1;i<=n;i++)
{
  if(i/10==7)
  {
    p+=i*i;
   }
}
for(i=1;i<=n;i++)
{
  if(i%10==7)
  {
    q+=i*i;
   }
}
if(n<7)
printf("%d",j);
if(n<70&n>=7)
printf("%d",j-k-p-q+7*7);
if(n>=77)
printf("%d",j-k-p-q+7*7+70*70+77*77*2);
if(n>=70&&n<77)
printf("%d",j-k-p-q+7*7+70*70);
return 0;
}
int main()
{
	int n,a,m,s,b,c,d;
	cin>>n;
	a=1;
	s=0;
	while (a<=n)
	{
		m=a-7;
	    b=a%7;
	    c=m%10;
		d=a-70;
		if(d<0||d>=10)
			if(b!=0&&c!=0)
				s=s+a*a;
		a=a+1;
	}
	cout<<s<<endl;
	return 0;
}
int work(int n)
{
	int i,j,k=n;
	if(n%7==0)return 0;
	while(n>=1)
	{
		if(n%10==7)return 0;
		n/=10;
	}
	return k*k;
}
int main()
{
int a[101];
int i,j,sum=0,n;
cin>>n;
for(i=1;i<=n;i++)
sum+=work(i);
cout<<sum;
	return 0;
}
int main()
{
	int i,n,sum=0,c,d;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
	    c=i%10;
		d=i/10;
		if(i%7==0)continue;
		if(d==7)continue;
		if(c==7)continue;
		sum+=i*i;
	}
		printf("%d",sum);
	return 0;
}
void main()
{int a[30]={7,14,17,21,27,28,35,37,42,47,49,56,57,63,67,70,71,72,73,74,75,76,77,78,79,84,87,91,97,98};
 int n,s1=0,s2=0,i,j;
 scanf("%d",&n);
 for(i=1;i<=n;i++)
	 s1+=i*i;
 for(j=0;j<30;j++)
 {if(a[j]<=n) 
 s2+=a[j]*a[j];}
 printf("%d\n",s1-s2);
}
//******************
//?7???????**********
int main()
{
	int n=0,i=1,a[100],sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		a[i]=i;
	}
	for(i=1;i<=n;i++)
	{
		if(a[i]%7==0)
		a[i]=0;
		if(a[i]%10==7)
		a[i]=0;
		if(((a[i]-a[i]%10)/10)==7)
			a[i]=0;
	}
	for(i=1;i<=n;i++)
	{
		sum=sum+a[i]*a[i];
	}
	cout<<sum<<endl;
	return 0;
}
/*
 * 1000012826_????_05.cpp
 *
 *  Created on: 2010-11-16
 *      Author: Administrator
 */

int main(){
	int n,i,sum=0;
	int c[100],p[100];
	cin>>n;
	for(i=0;i<n;i++)
		c[i]=i+1;
	for(i=0;i<n;i++)
	{if((c[i]%7==0)||((c[i]-7)%10==0)||(c[i]>69&&c[i]<80))//?????7??
		c[i]=0;}//??7??????0
	for(i=0;i<n;i++)
		p[i]=c[i]*c[i];
	for(i=0;i<n;i++)
		sum=sum+p[i];
	cout<<sum<<endl;
}
int main()
{ 
	int i,a,sum=0;
	scanf("%d",&a);
	for(i=a;i>=0;i--){
		if(i%7!=0&&(i-7)%10!=0&&(int)(i/10)!=7)
	sum+=i*i;
	}
	printf("%d",sum);
	return 0;
}
int main()
{
    int a[101]={0},i=0;//???????i???? 
    int n=0,k=0;
    int res[101]={0};//???
    int s=0,t=0;//???? 
    cin>>n;//??? 
    for(i=1;i<=n;i++)
    {
        a[i]=i;//????n?? 
        if(a[i] %7 != 0 && a[i] % 10 != 7 && a[i] / 10 != 7)  
        {k++ ;//?????? 
         res[t]=i;
         t++;
        }       
    }
    for(i=0;i<k;i++)
    {
       s=s+a[res[i]]*a[res[i]];                           
    } 
    cout<<s<<endl;
    getchar();
    return 0;
}
int main()
{
	int n;
	int sum=0;
	scanf("%d",&n);
	int i=1;
	for(; i<=n;i++){
		if(i%7==0 || (i>11)&&(int)(i/10)%7==0 || (i>7) && i-((int)(i/10))*10==7 )
			continue;
			sum+=i*i;
	}
	printf("%d", sum);
	return 0;
}
int main()
{
	int Sum = 0, N;
	cin >> N;
	for (int I = 1; I <= N; I++)
	{
		int K = I,Flag = 0;
		while (K)
		{
			if (K % 10 == 7) Flag = 1;
			K = K / 10;
		}
		if (I % 7 == 0) Flag = 1;
		if (!Flag) Sum += I*I;
	}
	cout << Sum <<endl;
	return 0;
}
int yu7WuGuan(int); 
    
    int main(){
         int num, i, result = 0; 
         scanf("%d", &num); 
         for(i = 1; i <= num; i++) { 
               if(yu7WuGuan(i)) { 
               result += i*i; 
               } 
         }
               printf("%d", result);
               return 0;
               }
         int yu7WuGuan(int number){
         int num; 
         if(number%7 == 0) {
                     return 0;
         } 
         for(num = number; num > 0; num /= 10) { 
         if (num%10 == 7) {
                     return 0; 
                     } 
         } 
         return 1;
    }
int main(int argc, char* argv[])
{
	int n,sum,i,s,g;
	scanf("%d",&n);
	sum=0;
	for (i=1;i<=n;i++)
	{
		if (i%7!=0)
		{
			g=i%10;
			s=i/10;
			if (g!=7 && s!=7)
			{
				sum = sum + i*i;
			}
		}		
	}
	printf("%d",sum);
	return 0;
}
void main()
{
	int n,i,num=0,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0||i==7||i==17||i==27||i==37||i==47||i==57||i==67||i==77||i==87||i==97||i==70||i==71||i==72||i==73||i==74||i==75||i==76||i==77||i==78||i==79)
			continue;
		else
			num=i*i;
		sum=sum+num;
	}
	printf("%d",sum);
}
int main()
{ 
	int i,n,sum=0,mod,judge;
	cin>>n;
	for(n;n>0;n--)
	{
		if(n%7==0||n%10==7||(n/10)==7)
		   continue;	
		sum+=n*n;
	}
	cout<<sum<<endl;
	return 0;
}
int main(){
	char a[2]={'0','1'};//a??????n??
	int n,i,s=0;//s???????
	cin>>n;
	for(i=1;i<=n;i++,a[1]++){
		if(i%7!=0&&a[0]!='7'&&a[1]!='7')s=s+i*i;//?????7??
		if(a[1]=='9'){
			a[0]++;
			a[1]='0'-1;
		}
	}
	cout<<s<<endl;
}
//?7?????????
int main()
{
	int n,a[100],sum=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		a[i]=i+1;
		if((a[i]%7!=0)&&(a[i]%10!=7)&&(a[i]/10!=7))//????????n????????7????
			sum=sum+a[i]*a[i];
	}
	cout<<sum<<endl;
	return 0;
}
int main()
{
	int n,sum=0,i,b;
	int a[100];
	cin>>n;
	for(i=1;i<=n;i=i+1)
	{
		b=0;
		if(i%7==0)b=1;
		if(i%10==7)b=1;
		if((i-i%10)%100==70)b=1;
		if(b==0)sum=sum+i*i;
	}
	cout<<sum;
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
	   if((i%7!=0)&&(i%10!=7)&&(i/10!=7)) 
	   sum+=i*i;
	}
    printf("%d",sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int m;
	int sum=0;
	int i;
	scanf("%d",&m);

	for(i=1;i<=m;i++)
	{
		if(i%10==7||i/10==7||i%7==0)
			sum+=i*i;
	}
	
	int SUM=0;
	int n;
	for(n=0;n<=m;n++)
	{
		SUM+=n*n;
	}
	printf("%d",SUM-sum);
	return 0;
	
}
int main()
{
	int n, i, k;
	int sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0) continue;
		else
		{
			for(k=i;k>0;k/=10)
			{
				if(k%10==7) break;
			}  
	        if(k==0) sum+=i*i;
		}	
	}
	printf("%d",sum);
	return 0;
}
int main()
{  
	int n,i,s=0,k;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
			continue;   //??????????????????
		k=i;
		while(k!=0)
		{
			if(k%10==7)
			{
				s-=i*i;       //????????????????????????
				break;
			}
			else k=k/10;
		}
		s+=i*i;  //????????????
	}
	cout<<s<<endl;
return 0;
}
void main()
{
int a[100];
int n,i,sum=0;
for(i=0;i<100;i++){
a[i]=i+1;
}

scanf("%d",&n);
for(i=0;i<n;i++){
if(a[i]%7==0){
a[i]=0;
}
else if((a[i]-7)%10==0){
a[i]=0;
}
else if((a[i]/10)-7==0){
a[i]=0;
}
}

for(i=0;i<n;i++){
sum=sum+a[i]*a[i];
}

printf("%d\n",sum);
}
int main()
{
long n,s=0;
cin>>n;
for(;n>0;n--)
{
if(n/10==7||n%10==7||n%7==0) continue;
else s+=n*n;
}
cout<<s;
return 0;
}
int yu7wuguan(int i);
int main() {
    int n,i,x;
	int s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(yu7wuguan(i)){
			s+=i*i;
		}
	}
	printf("%d",s);
	return 0;
}
int yu7wuguan(int num){
	if(num%7==0){
		return 0;
	}
	for(int n=num;n>0;n/=10){
		if(n%10==7){
			return 0;
		}
	}
	return 1;
}
//****************************
//**Title:?7??????? **
//**Author:???1300017687 **
//**Date?2013.10.9         **
//**File?3.cpp             **
//**No Function				**
//****************************

int main()
{
	int n;					//n???????
	int sum = 0;			//sum?????7???????

	cin >> n;				//??n

	for (int af = 1; af <= n ; af++)	//??????af,af?1?n
	{
		//??af??7?0(?af??7??)???af??10?7(?af???7)
		//??af??10??????7(?af???7),???7??
		if (((af % 7 == 0)||(af % 10 == 7)||(af / 10 == 7)) == 0)		
			sum += af * af;			//sum ?? sum ? af*af
	}

	cout << sum << endl;			//??sum
	return 0;
	cin.get();
	cin.get();
}
int main()
{
    int n, i, m;
    m = 0;
    scanf("%d", &n);
    for(i=1;i<=n;i++)
    {
            if(i==17) m = m;
            else if(i==27) m = m;
            else if(i==37) m = m;
            else if(i==47) m = m;
            else if(i==57) m = m;
            else if(i==67) m = m;
            else if(i>=71&&i<77) m = m;
            else if(i>=78&&i<80) m = m;
            else if(i==87) m = m;
            else if(i==97) m = m;
			else if(i%7==0) m = m;
            else m = m + i * i;
    }
    printf("%d", m);
    return 0;
}
int nseven(int n)
{
	if(n%7==0) return 0;
	while(n/10!=0)
		{if(n%10==7) return 0;n=n/10;}
	if(n%10==7) return 0;
	else return 1;
}

int main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		if(nseven(i)) sum+=i*i;
	printf("%d\n",sum);
	return 0;
}
int main()
{
int n,sum=0;
double s1,s2,i;
cin>>n;
for (i=0.0;i<=n;i++)
{    
	s1=floor(i/100);
	s2=floor((i-s1*100)/10);
if(i/7==floor(i/7))
	continue;

else if (s1==7||s2==7||i-s1*100-s2*10==7)
	continue;
sum+=i*i;

}
cout<<sum<<endl;
return 0;



}
/*
 * ?7????????1045?.cpp
 *
 *  Created on: 2010-11-16
 *      Author: Administrator
 */

int main(){
	int n;
	cin>>n;
	int s=0;
	for(int i=1;i<=n;i++){
	int a=i%10,b=(i-a)/10;
	if(a!=7&&b!=7&&i%7!=0)
		s=s+i*i;
	}cout<<s;
	return 0;

}
//********************************
//*????7???????   **
//*?????? 1300012855 **
//*???2013.10.11  **
//********************************


int main(void)
{
	int n, sum = 0; // ??????n?????????n?????sum????????0 
 	cin >> n;
 	for(int i = 1; i <= n; i++) // ??????i?????n?
	{
		
// ?????????7????????????????7?????????????7 
		if( (i%7 != 0) && ((i / 10) != 7) && ((i - (i / 10) * 10) != 7))  
			sum += i * i; // sum???i??? 
	} 
	cout << sum << endl;
	return 0;
}
int main()
{
	int n=0;
	cin>>n;
	int i=0,sum=0,a1=0,a2=0,a3=0;
	for(i=1;i<=n;i++)
	{
		a1=i%10;
		a2=i%7;
		a3=(i-a1)/10;
		if(a1!=7 && a2!=0 && a3!=7)
		{
			sum=sum+i*i;
		}
	}
    cout<<sum<<endl;
	return 0;

}
int main()
{
int n,i,s;
scanf("%d",&n);
s=0;
i=0;
while(i<=n){
if(i%7==0||i%10==7||i/10==7)
{s=s;}
else{
	s=s+i*i;}
i++;
}
printf("%d",s);
return 0;
}
void main ()
{
	int n,sum,i;
	sum=0;
	int a[2];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		a[1]=i%10;
		a[0]=(i-i%10)/10;
		if(a[1]!=7&&a[0]!=7&&i%7!=0)
			sum=sum+pow(i,2);
	}
	printf("%d\n",sum);
}
int main()
{
    int n;
	int sum=0;
	scanf("%d",&n);
	while(n>0)
	{
	if(n<100)
		if(n%7!=0)
			if(n/10!=7)
				if(n%10!=7)
		sum=sum+n*n;
		n--;
	}
	printf("%d",sum);
	return 0;
}
int main(){
 int n,i,j;
 int sum=0;
 scanf("%d",&n);
 int sz[100];
 for(i=0;i<n;i++){
 sz[i]=i+1;
 if(sz[i]!=7&&sz[i]%7!=0&&sz[i]/10!=7&&sz[i]-sz[i]/10*10!=7){
 sum+=sz[i]*sz[i];};}
 printf("%d\n",sum);
 return 0;
}
int main()
{
	int n=0,i=0,sum=0;
	cin>>n;
    for(i=1;i<=n;i++)
	{
		if(i%7==0)
			sum=sum;
		else if(i/10==7)
		    sum=sum;
		else if(i-i/10*10==7)
			sum=sum;
		else
			sum=sum+i*i;
	}
	cout<<sum<<endl;
	return 0;
}
void main()
{
int a,ss=0,i;
scanf("%d",&a);
for(i=1;i<=a;i++)
   {if(i%7==0) ss=ss;
    else if(i>=70&&i<80) ss=ss;
	else if(i%10==7) ss=ss;
	else ss=ss+i*i;
	}
printf("%d\n",ss);
}
int main()
{
	int n;
	scanf("%d",&n);
	int i=1;
	int sum=0;
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
		{
		}
		else if(i%10==7)
		{
		}
		else if((i/10)%10==7)
		{
		}
		else
		{
			sum=sum+i*i;
		}
	}
	printf("%d",sum);
	return 0;
}
int unrelatedNumber(int num, int sum)
{
     if (num == 0)
    {
              return sum;
    }
    if (num % 7 == 0 || num % 10 == 7 || num / 10 == 7)
    {
              return  unrelatedNumber(num - 1, sum);
    }
    return  unrelatedNumber(num - 1, sum + num * num);
}

int main(int argc, char ** argv)
{
    int num, sum = 0;
    scanf("%d", &num);
    if (num >= n || num <= 0)
    {
              printf("Input a illegal number.\n");
              return -1;
    }
    printf("%d", unrelatedNumber(num, sum));
    return 0;
}
int main()
{
 int n,i;
 cin>>n;
 float a,b,c,d,e,s=0;
 for(i=1;i<=n;i++)
 {
  a=i%7;
  if(a==0)s=s+0;
  else{ b=i%10;
        c=b/7;
 
        if(c==1)s=s+0;
        else{d=i-b;
             e=d/70;
  
             if(e==1)s=s+0;
             else s=s+i*i;
             }
      } 
  }
 
 cout<<s<<endl;
 getchar();
 getchar();
 return 0;
 }
int main()
{
	int n,i,a,b;
	long int sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
	a=i/10;
	b=i%10;
	if(a!=7&&i%7!=0&&b!=7)
		sum=sum+i*i;
	}
	cout<<sum;
	return 0;
}
int isnum(int);

int main()
{
int n,sum=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
if (isnum(i)==1)
{
	sum+=i*i;
}
}
printf("%d",sum);
return 0;
}

int isnum(int i)
{
if (i%10 == 7)
{
return 0;
}
if ((i/10)*10==70)
{
return 0;
}
if (i%7==0)
{
return 0;
}
return 1;
}
int main()
{
	int n,sum=0,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	if((i%7==0)||(i%10==7)||(i/10%10==7))
		continue;
	else
		sum=sum+pow(i,2);
	printf("%d",sum);
	return 0;
}
int main()
{
    int n,i,x,sum;
    sum=0;
    cin>>n;
    for (i=1;i<=n;i++)
    {
        x=0;
        if (i%7==0) x=1;
        if (i%10==7) x=1;
        if (i/10==7) x=1;
        if (x==0) 
        {
           sum+=i*i;
          // cout<<i<<endl;
        }
    }
    cout<<sum;
    return 0;
}
void main()
{
int num,i,j,sum=0,mark;
scanf("%d",&num);
for(i=1;i<=num;i++)
{
mark=1;j=i;
if(!(j%7)) mark=0;
while(j)
{
if(j%10==7){mark=0;break;}
else j/=10;
}
if(mark) sum+=i*i;
}
printf("%d",sum);
}
int yu7wuguan(int n)
{
	if(n%7==0)
	{
		return 0;
	}
	for(int i=n;i>0;i/=10)
	{
		if(i%10==7)
		{
			return 0;
		}
	}
	return 1;
}


int main()
{
	int n,sum=0,y=0,i=1;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		y=0;
		if(yu7wuguan(i))
		{
			y=i*i;
			sum+=y;
		}
		else
		{
			continue;
		}
	}
	printf("%d",sum);
	return 0;
}
void main()
{
	int n,i,a[100],sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		a[i]=i+1;
		if(a[i]%7!=0&&a[i]%10!=7&&a[i]/10!=7)
			sum=sum+a[i]*a[i];
	}
	printf("%d\n",sum);
}
//***************************************************
//???
//???2013.10.4
//***************************************************
int main()
{
	int n=0,sum=0,i=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i%7!=0&&i!=17&&i!=27&&i!=37&&i!=47&&i!=57&&i!=67&&i!=71&i!=72&&i!=73&&i!=74&&i!=75&&i!=76&&i!=78&&i!=79&&i!=87&&i!=97)
		{
			sum=sum+i*i;
		}
	}
	cout<<sum<<endl;
  return 0; 
}
int main()
{
	int n,s=0,i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
	     if(i%7!=0)
	     {
			 if(i%10!=7)
			 {
				 if(i/10!=7)
				 {
					 s=s+i*i;
				 }
			 }
	     }
	}
	cout<<s;
	return 0;
}
main()
{
int n,i,c,a;
long T;
scanf("%d",&n);
T=0;

for(i=1;i<=n;i++)
{	 if (i>70) a=i-70;
		else a=70-i;
	c=i-7;
if (i%7!=0&&c%10!=0&&i/10!=7) T=T+i*i;

}
printf("%d\n",T);

return 0;
}
int main()
{
    int n, i, j, p, sum;
    scanf("%d", &n);

    sum=0;
    for(i=1; i<=n; i++)
    {
        p=0;     
		j=i;
		if(j%7==0) p=1;
		else
		{
			while(j>=7)
			{
				if(j%10==7)
				{
					p=1;
			 	    break;
				}
                j=(j-j%10)/10;
			}
		    if(p==0) sum+=i*i;
		}
    }

    printf("%d\n", sum);
    return 0;
}
int main()
{
	int i,n;
	int s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
		{
			s=s;
		}
		else if(i%10==7)
		{
			s=s;
		}
		else if((i-i%10)/10==7)
		{
			s=s;
		}
		else
			s=s+i*i;
	}
	printf("%d",s);
	return 0;
}
int main()
{
	
	int x=0,n=0,i=1;
	scanf("%d",&n);
		for(i=1;i<=n;i++)
		{
			if(i%7!=0&&i!=7&&i!=17&&i!=27&&i!=37&&i!=47&&i!=57&&i!=67&&i!=77&&i!=87&&i!=97&&i!=70&&i!=71&&i!=72&&i!=73&&i!=74&&i!=75&&i!=76&&i!=77&&i!=78&&i!=79)
			{
				x+=i*i; 
			}
			
		}
		
printf("%d",x);



	return 0;
}
void main()
{
	int n;
	int sum=0;
	scanf("%d", &n);
	if(n==0)
	{
		printf(0);
	}
	else
	{
		int i=0;
	    for(i=0; i<=n; i++)
		{
			if(i%7 != 0 && i%10 !=7 && i/10 !=7)
			{
				sum = sum + i*i;
			}
	      	 
		}
	}printf("%d\n", sum);
		
}
int main()
{
 int b,i;
 int a=0,s=0,k=0,d=0,x=0,r=0;
 scanf("%d",&b);
 for (i=1;i<=b;i++)
 {
  if (i%7==0)
  s+=i*i;
  else if (i%10==7)
  k+=i*i;
  else if (i/10==7)
  d+=i*i; 
 }
 a=s+d+k;
 for (i=1;i<=b;i++)
 {
  r+=i*i;
 }
 x=r-a;
 printf("%d",x);
 return 0;
}
int main()
{
	int j,n,s=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		if(i%7==0){
			continue;
		}
		if(i%10==7){
			continue;
		}
		j=i;
		j=j/10;
		if(j%10==7){
			continue;
		}
		s+=i*i;

	}
	printf("%d",s);
	return 0;
}
void main()
{
	int n,a[100],b[100],c[100],i,t,s;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		a[0]=1;
		if(i>=1)
			a[i]=a[i-1]+1;
		t=a[i]/10;
		s=a[i]%10;
		if(a[i]%7==0||t==7||s==7)
			b[i]=0;
		else
			b[i]=a[i];
	}
	for(i=0;i<n;i++)
	{
		c[0]=b[0]*b[0];
		if(i>=1)
			c[i]=c[i-1]+b[i]*b[i];
	}
	printf("%d",c[n-1]);
}
int main(){
	int n,sum,a,b;
	scanf("%d",&n);
	int i=1;
	sum=0;
		while(i<=n){
		a=i/10;
		b=i%10;
			if(i%7==0||a==7||b==7){
				sum=sum;
			}else{
				sum+=i*i;
                           }
			
			i++;
		}
		printf("%d\n",sum);

	return 0;
}