semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
 int n;
 int result=0;
 scanf("%d",&n);
 for (int i=1;i<= n;i++){
	 if (i%7!=0) {
      for (int k=i;k>0;k/=10){
          if (k%10==7) break;
          if(k/10==0){
             result+=i*i;
		  }
	  }
	 }
 }
 printf("%d",result);
 return 0;
}
int main()
{  int n, i, sum;
   sum=0;
   scanf("%d", &n);
 for(i=1;i<=n;i++){
  if(i%10==7){
   sum+=i*i;}
  else if(i%7==0){
   sum+=i*i;}
  else if(i>=70 && i<=79){
   sum+=i*i;}
    }
    printf("%d", n*(n+1)*(2*n+1)/6-sum);
   return 0;
  }
int main(){
int n,sum=0,k;//????
scanf("%d",&n);//??N
for(k=1;k<=n;k++){
if (yuqiwuguan(k)==1){//???wu???????????
sum+=k*k;}
}
printf("%d",sum);//????
return 0;
}
int yuqiwuguan(int number){ 
int i;                       //???7?????
if(number%7==0){
return 0;}
for(i=number;i>0;i/=10){
if(i%10==7)
return 0;}
return 1;
}
int main()
{
	int n,i,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<=79))
			continue;
		else

			sum=sum+i*i;
	}
	printf("%d",sum);

	return 0;
}
int main()
{
	int n,i,sgn[100];				//sgn??????1????0
	double sum=0;
	cin>>n;
	for(i=1;i<=n;i++)				//???????
	{
		if(i%7==0)
		sgn[i]=0;
		else if(i>10&&(i/10)==7)
			sgn[i]=0;
		else if(i>10&&(i-(i/10)*10)==7)
			sgn[i]=0;
		else						//??????
			sgn[i]=1;
	}
	for(i=1;i<=n;i++)
		sum+=i*i*sgn[i];
	cout<<sum;
	return 0;
}
int main()
{
	int i, n, s;
	s = 0;
	cin >> n;
	for (i = 1; i <= n; i = i + 1)
	{
		if (i % 7 == 0)
		s = s;
	else if (i % 10 == 7)
			s = s;
		else if (7 <= (i / 10) && (i / 10)< 8)
		s = s;
    else 
		s = s + i * i;
	}
	cout << s << endl;
	return 0;
}
int main(){
	int n;
	cin>>n;
	int i,j;
	int a[101];
	double t=0;
	for(i=1;i<=n;i++)
		a[i]=i;
	for(j=1;j<=n;j++)
		if(j%7!=0&&(j-7)%10!=0&&!((j-70)<10&&(j-70)>0)){
			t=t+pow(a[j],2.0);
		}
	cout<<t<<endl;
	return 0;
}
/*************************************
*file                           ******
*author                           ****
*date                              ***
*description                         *
*************************************/

int main()
{
	int n,sum=0;
	cin>>n;
	int i,j,k,l;
	for(i=1;i<=n;i++)
	{
		j=i/10;
		if(i%7==0||i%10==7||j%10==7) continue;
		sum+=i*i;
	}
	cout<<sum<<endl;
	return 0;
}
int cor(int x);

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

int cor ( int x )
{
	if ( x % 7 == 0 )
	{
		return 0;
	}
	int i = 10;
	do 
	{
		if ( x % i == 7 )
		{
			return 0;
		}
		else
		{
			x = x / i;
		}
		i *= i;
	}while ( x != 0 );
	return 1;
}
int main()
{
int n,i,s=0;
cin>>n;
for(i=1;i<=n;i++)
{
 if(i%7!=0)
{
 if(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)
	 s=s+i*i;
 else s=s+0;
 }
 else s=s+0;
 }
 cout<<s<<endl;
 return 0;
}
int main()
{
	int n,i;
	scanf("%d",&n);
	unsigned int S=0;
	for(i=1;i<=n;i++)
	{
		if(n<100&&n>0)
		  if(i%7==0)
		      S+=0;
		  else if((i-7)%10==0)
              S+=0;
		  else if((i-70)<10&&(i-70)>0)
			  S+=0;
		  else
			  S+=i*i;



	}
	printf("%u\n",S);
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i=1,sum1=0,sum2=0,sum;
	scanf("%d",&n);
	
		if(n<=9)
		{
            for(i=1;i<=n;i++)
			{
			if(i!=7)
			{
				sum1 = sum1 + i*i;
			}
			}
			printf("%d",sum1);
		
		}
		else
		{
			for(i=1;i<=n;i++)
			{
		    if(i<=9)
			{
				if(i!=7)
				{
			
				sum1 = sum1 + i*i;
				}
			}
			
			else
			{
				if((i/10!=7)&&(i%10!=7)&&(i%7!=0))
				{
					sum2 = sum2 + i*i;
				}
			}
			}
			sum = sum1 + sum2;
			printf("%d",sum);
		}
		return 0;
}
void main()
{
    int n,i,a,b,c;
    int he;
    
    scanf("%d",&n);
    
    he=0;
    for(i=1;i<=n;i++)
    {
    	a=i/10;
    	b=i-a*10;
    	c=i-(i/7)*7;
    	if((a!=7)&&(b!=7)&&(c!=0))
    	he=he+i*i;
    }
    
    printf("%d",he);
}
int main()
{
	int n;
	scanf("%d",&n);
	int i,j,s,g,shi;
	s=0;
	for(i=1;i<=n;i++)
	{
        
		j=i;
		if(i%7==0)
			j=1;
		else
		{
			g=i%10;
			shi=(i-g)/10;
			if((g==7)||(shi==7))
				j=1;
			else
				s=s+j*j;
		}
	}
	printf("%d",s);
	return 0;
}
main()
{
	int n,i,m,r,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
			continue;
		else{
			m=i;
			while(m!=0)
			{
				r=m%10;
				m=m/10;
				if(r==7) break;
			}
			if(m!=0||r==7) continue;
			else{//printf("i=%d\n",i);
			sum=sum+i*i;}
		}
	}
	printf("%d\n",sum);
}
int main()
{
int n,i,j,s,t;
s=0;
cin>>n;
int a[19]={7,17,27,37,47,57,67,70,71,72,73,74,75,76,77,78,79,87,97};

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

if((i%7)!=0)
{                    
for(j=0,t=0;j<=18;j++)  
{if(i==a[j]) t=1;}
}
else t=1;

if(t!=1) s=s+i*i;
}

cout<<s<<endl;
return 0; 
}
//*************************************
//*?????7??????
//*?????? ?? 1200012904
//*???20121008
//************************************
int main()
{
    int n;
	int a, b, c;
	int i;
	int sum = 0;
	cin >> n;
	for (i=1; i<=n; i++)
	{
	    a = i % 7 ;
		b = i - 7;
		c= b % 10;
		if(a==0)
			sum = sum;                          //??i???7?????i
		else if (i>=70 && i<=79)
			sum = sum;                          //??i?????7?????i
		else if (c==0)
			sum =sum;                           //??i?????7?????i
		else
			sum = sum + i*i;                    //?????i??7??
	}
	cout << sum << endl;
	return 0;
}
int with7(int x)
{
    if(x%7==0)  return 1;
    while(x>0)
    {
              if(x%10==7) return 1;
              x=x/10;
    }
    return 0;
}


int main()
{
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
        if(!with7(i))
            sum+=(i*i);
    cout<<sum<<endl;
    return 0;
}
int main(int argc, char* argv[])
{
	int n,i,sum=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		if (i>=10)
		{
			if((i%7!=0)&&(i%10!=7)&&(((i-i%10)/10)%10!=7))
		    sum=sum+i*i;
		}
		else if(i!=7)
		{
			sum=sum+i*i;
		}
	}
	printf("%d",sum);
	return 0;
}
int main()
{
int a=0,n,i;
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!=78 && i!=79)
a=a+i*i;
printf("%d",a);
return 0;
}
void main(){
	int n;
	int sum,i,a,b;
	scanf("%d",&n);
	sum=0;
	for(i=1;i<=n;i++){
		a=i/10;
		b=i%10;
		if(i%7==0 || a==7 || b==7)
			continue;
		sum=sum+i*i;
	}
	printf("%d\n",sum);
}
//*********************
//*???:3.cpp **
//*?????? 1300012754 **
//*???2013.10.11 **
//*??????7??????? **
//*********************
int main()
{
	int n;    //????????
	int result = 0; //?7????????
	cin >> n; //???????????

	for (int i = n; i >= 1; i--)  //?n?????1
	{
		if (i % 10 == 7) //??n????7
		{
			continue;   //???????
		}
		if ((i - 70) >= 0 && (i - 70) <= 9)  //??n????7
		{
			continue;   //???????
		}
		if (i % 7 == 0)  //??n??7??
		{
			continue;   //???????
		}
		result = result + i * i;  //??????????
	}
	cout << result << endl;      //????
	return 0;
}
int main()
{
	int n,i=1,c;
	int sum=0;
	cin>>n;
	while(i<=n&&i<=10)
	{
        if((i%7)&&((i-7)%10))
			sum+=i*i;
		i=i+1;
	}
	while(i<=n)
	{
		c=i/10;
		if((i%7)&&((i-7)%10)&&(c%7))
			sum+=i*i;
		i=i+1;
	}
		cout<<sum<<endl;
	return 0;
}
int main()
{
	int sum=0;
	int n;
	int i;
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		if(i%7==0||(i-7)%10==0||(i>70&&i<80))
		{
			sum=sum;
		}
		else
		{
			sum=sum+i*i;
		}
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int i, n, c=0;
	scanf("%d", &n);
    for(i=1;i<n+1;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==78||i==79){
			continue;
		}
		else
			c+=pow(i,2);
	}
	printf("%d\n", c);
	return 0; 
}
int main(int argc, char* argv[])
{
	int n,i,sum;
	sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		if (i%7!=0&&(int)i%10!=7&&(int)i/10!=7){
			sum+=i*i;
		}
	printf("%d",sum);
	return 0;
}
void main()
{
 int n,a,b,sum=0,i=1;
 scanf("%d",&n);
 for(;n>0;n--)
 {
 if(n%7!=0)
 {
        b=n;
  while(b>=1)
  {
   a=b%10;
   b=(b-a)/10;
   if(a==7)
    i=0;
   }    
    if(i==1)
          sum+=n*n;
    i=1;
 }
 }
 printf("%d",sum);
}
int main()
{
	int n,i,a,b,c,x,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		b=(i%10);
		a=((i-b)/10);
		if(b==0) b=1;
		b=b%7;
		a=a%7;
		if(i<10) a=1;
		c=i%7;
		if(a*b*c==0) continue;
		sum+=i*i;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int a,b,c,e=0,n;
	scanf("%d",&n);
	a=0;
	for(int d=1;d<=n;d++){
		b=d%10;
		c=(d-b)/10;
		if(d%7==0 || b==7 || c==7){
			e=0;
		}else{
			e=d*d;
		}
		a=a+e;
	}
	printf("%d",a);
	return 0;
}
void main()
{
	int n,a,b,c,d,t1=0,t2=0,t;
	scanf("%d",&n);
	for(a=1;a<=n;a++)
	{
		if(a<10&&a!=7)
		{
			c=a*a;
			t1=t1+c;
		}
		else if(a>9)
		{
			b=a/10;
			if((a%7!=0)&&(b!=7)&&(a-b*10!=7))
			{
				d=a*a;
				t2=t2+d;
			}
		}
	}
	t=t1+t2;
	printf("%d",t);
}
int main()
{
	int a;
	scanf("%d",&a);
	int sum=0;
	int i=1;
	while(i<=a)
	{
		if(i%7!=0&&i!=70&&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!=77&&i!=78&&i!=79)
		{
			sum+=i*i;}	
		i++;
	}
printf("%d",sum);
return 0;
}
int main()
{
	int n, i;
    int sum=0 ;
	scanf("%d", &n);
	for(i=0; 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)
			sum=sum;
		else sum=sum+i*i;
	}
	printf("%d", sum);
	return 0;
}
int main()
{
	int n;
	long long int sum=0;
	cin>>n;
	if(n>=10){
		for(int i=1;i<10;i++){
			int ok=1;
			ok=(i%7);
			if(ok)  sum+=i*i;


		}
		for(int i=10;i<=n;i++){
			int ok[3]={1,1,1};
			ok[0]=(i%7);
			ok[1]=((i%10)%7);
			int j=i;
			ok[2]=((j/10)%7);
			if(ok[1]&&ok[0]&&ok[2])
				sum+=i*i;}

}
	else{
		for(int i=1;i<=n;i++){
					int ok=1;
					ok=(i%7);
					if(ok)  sum+=i*i;}



	}
  int k=n;
  k=k/10;
	for(int i=1;i<=k;i++)
		sum+=100*i*i;
	if(n>=70)
		sum=sum-4900;
    cout<<sum<<endl;
    return 0;

	}
int main() 
{
      int n,i,a[1000],b=0;
      cin>>n;
      for(i=0;i<n;i++)
          {
            a[i]=i+1;
            
            if(a[i]%10==7 )
                 b = b;  
            else if(a[i]%7==0)
                 b = b;  
            else if(69<a[i]&&80>a[i])
                 b = b;
            else b=b+a[i]*a[i];            
          }
      cout<<b;
      int c;cin>>c;
      return 0;
      
      
      
      }
int main(){
    int sum=0;
    int n;
    scanf("%d",&n);
    for(int num=1;num<=n;num++)
    {
                       
            if(num%7==0||(num-70<=9&&num-70>0)||num%10==7)
            {
                continue;
            }
            sum+=num*num;
            
    } 
    printf("%d",sum);
    getchar();getchar();
    return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	unsigned long sum=0;
	for(i=1;i<=n;i++)
	{
		sum=sum+i*i;
	}
	if(n<7)
	{
		sum=sum;
	}
	if(n>=7)
	{
		sum=sum-7*7;
	for(i=8;i<=n;i++)
	{
		if(i%7==0||(i-7)%10==0||i/10==7)
		{
			sum=sum-i*i;
		}
		else
		{
			continue;
		}
	}
	}
	printf("%ld",sum);
	return 0;
}
//******************************************** 
//**  ????7???????               ** 
//**  ?????? 1300012917               **
//**  ???2013.10.11                      **
//********************************************
main()
{
	int n, i, s, a, b, c;                        //?????? 
	cin >> n;                                    //??n 
	s = n * (n + 1) * (2 * n + 1) / 6;           //???n??????? 
	//?n<7????s 
	if (n < 7)
	{
		cout << s;
		return(0);
	 }
	 
	//??17?n??????7?????? 
	a = 0;
	for (i = 17; i <= n; i += 10)
	  a = a + i * i;
	
	//????n?7??????? 
	b = 0;
	for (i = 7; i <= n; i += 7)
	  b = b + i * i;
	  
	//????n?????7?????? 
	c = 0;
	if (n > 70)
	  for (i = 71; (i <= n) && (i <= 79); i++) 
	    c = c + i * i;
	     
	s = s - a - b - c;                           //?s???a, b, c 
	if (n >= 77)
	  s += 2 * 77 * 77;                          //???77???3????? 
	cout << s;                                   //??s 
	return(0); 
 }
int main ()
{
	int n,i=0,j=0,sum=0;
	int a[10][10]={0};
	cin >>n;
	while(i<=9)
	{
		while(j<=9)
		{
			if((i==7)||(j==7)||(i*10+j)%7==0)
				a[i][j]=0;
			else a[i][j]=i*10+j;
			sum=sum+a[i][j]*a[i][j];
			j++;
			if (i*10+j>n)
				break;
		}
		if(i*10+j>n)
			break;
		j=0;
		i++;
	}
	cout <<sum <<endl;
	return 0;
}
int main()
{   int n,a[100],i,j=0,sum=0;
  cin>>n;
  for(i=1;i<=n;i++)
  { if (i%7!=0&&(i-7)%10!=0&&i/10!=7)
  { a[j]=i;j++;}
  }
  for(i=0;i<j;i++)
  {  sum=sum+a[i]*a[i];}
  cout<<sum<<endl;

  
	return 0;
}
int main()
{
	int n,sum=0,number;
	cin>>n;
	for(int i=0;i<=n;i++)
	{
		number=i;
		if(number<=10)
		{
		   if(number!=7)
		       sum+=number*number;
		}
		else
		{
			if((number%7!=0)&&(number/10!=7)&&(number%10!=7))
               sum+=number*number;
		}
	}
	cout<<sum<<endl;
	return 0;
}
int main()
{
	int n,i,sum;
	
scanf("%d",&n);

		sum=0;
		for(i=1;i<=n;i++)
		{
			if(i!=7 && i!=14 && i!=21 && i!=28 && i!=35 && i!=42 && i!=49 && i!=56 && i!=63 && i!=70 && i!=77 && i!=84 && i!=91 && i!=98 && 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)
				sum=sum+i*i;
			else
				continue;
		}
		printf("%d",sum);
	return 0;
}
int main()
{
	int n,sum;
	sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		if(i!=7&&i!=14&&i!=21&&i!=28&&i!=35&&i!=42&&i!=49&&i!=56&&i!=63&&i!=70&&i!=77&&i!=84
			&&i!=91&&i!=98&&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)
		{
		    sum=sum+i*i;
		}
	cout<<sum<<endl;
	return 0;
}
int main()
{
    int n;
	int result=0;
	scanf("%d",&n);	
	for(;n>0;n--)
	{
		if(!(n%7==0 || n%10==7 || (9>= n-70 && n-70>=0)))
			result+= n * n;
	}
	printf("%d",result);
	return 0;
}
int main()
{
	int i,n,s=0,a[101];
	cin>>n;
	for (i=1;i<101;i++)  //???7?????a[i]???0
	{
		a[i]=i;
		if (a[i]%7==0)
			a[i]=0;
		if (a[i]>69&&a[i]<80)
			a[i]=0;
		if (a[i]-a[i]/10*10==7)
			a[i]=0;
	}
	for (i=1;i<=n;i++)  //??????n??7??????????
		s+=a[i]*a[i];
	cout<<s<<endl;
	return 0;
}
int main()
{
	int n,i,j=0;
	scanf("%d",&n);
	printf("\n");
	int a[100],b,c,sum=0;
	for(i=1;i<=n;i++)
	{b=i%10;
	c=(i-b)/10;
	if((i%7!=0)&&(b!=7)&&(c!=7))
		sum+=i*i;}
	printf("%d",sum);
	return 0;
}
int main()
{
	int n, i;
	int sum = 0;
	scanf("%d", &n);
	for(i=0;i<=n;i++)
	{
		if(i%7==0||(i-7)%10==0||(int)(i/10)==7)
		{
			continue;
		}
		{
			sum = sum + i*i;
		};
	};
	printf("%d", sum);
	return 0;
}
int ref(int num);

int main()
{
	int n,i,sum=0;

	scanf("%d",&n);

	for(i=1;i<=n;i++)
		sum+=ref(i)*ref(i);

	printf("%d",sum);

	return 0;
}

int ref(int num)
{
	if((num%10==7)||(num/10==7)||(num%7==0))
		return 0;
	return num;
}
int main ()
{
	int n,l,yushu,k,s=0;
	cin>>n;
	for (int i=1; i<=n; i++)
	{
		if (i%7==0)
			continue;
		else
		    k=i;
                while ( k!=0)
                {
                    yushu=k%10;
                    if (yushu==7)
                    break;
                    else
                    k=(int)k/10;
                }
        if ( k>=0&&k<=9&&yushu!=7)
        s=s+i*i;
        else
        s=s;
    }
	cout<<s;
return 0;
}
int main(int argc, char* argv[])
{
	int n;
	int t,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{ 
		if(i%7==0) continue;
		else if((i-7)%10==0) continue;
		else if (i-70<=9&&i-70>=0) continue;
    	else t=i;
        sum+=t*t;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int n=0,i=0,a=0,b=0,c=0,d=0;
	cin>>n;
	for(i=1;i<=n;i=i+1)
		a=a+i*i;
	for(i=7;i<=n;i=i+7)
		b=b+i*i;
	for(i=70;i<=n&&i<80;i=i+1)
		c=c+i*i;
	for(i=17;i<=n;i=i+10)
		d=d+i*i;
	a=a-b-c-d;
	if(n>=77)
		a=a+70*70+77*77*2;
	else if(n>=70)
		a=a+70*70;
	cout<<a<<endl;
	return 0;
}
int main()
{
int i,n,sum;
sum=0;

0<n&&n<100;
scanf ("%d",&n);
for(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)

sum +=i*i;

}
printf ("%d\n",sum);
return 0;
}
int main()
{
    int a,b,c,d,s=0,n,i=1;
	scanf ("%d",&n);
	do
	{
		a=i/10;
		b=i-a*10;
		c=i/7;
		d=i-7*c;
		s=s+i*i;
        if(a==7||b==7||d==0)
		{
			s=s-i*i;
		}
		i++;
	}while(i<=n);
	printf("%d",s);
	return 0;
}
int main()
{
	int n,i,sum;
	sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0) sum=sum+0;
		else if(i%10==7) sum=sum+0;
		else if((i-i%10)/10==7) sum=sum+0;
		else sum=sum+i*i;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
    int n,i,sum=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
     {
         if(i%7!=0&&i%7!=7&&i!=71&&i!=72&&i!=73&&i!=74&&i!=75&&i!=76&&i!=78&&i!=79&&i%10!=7){
            sum=sum+i*i;}
     }
   printf("%d",sum);
return 0;
}
int main(){
	int n,i,a[100],j,sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
		a[i]=i;
	for(j=1;j<=n;j++)
		if(j%7==0||(j-7)%10==0||j/10==7)
			a[j]=0;
	for(i=1;i<=n;i++)
		sum=sum+a[i]*a[i];
	cout<<sum;
	return 0;
}
int main(void)
{
	int n,sum=0;
	cin >>n;
	for(int i=1;i<=n;i++)
	{
		if (i%7==0) continue;
		else if ((i-7)%10==0) continue;
		else if (i>69&&i<80) continue;
		else sum+=i*i;
	}
	cout <<sum;
}
int main()
{
int n,i;
int sum=0;
scanf("%d",&n);
for(i=0;i<=n;i++){
if(i%7==0||i%10==7||i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79){
continue;
}
sum+=i*i;
}
printf("%d",sum);
return 0;
}
int main()
{
	int n;
	cin>>n;
	int sum = 0;
	for(int i=1;i<=n;i++)
	{
		if (i%7==0||(i>=70&&i<=79)||(i%10==7))
		{
		} 
		else
		{
			sum = sum + i * i;
		}
	}
	cout<<sum<<endl;
	return 0;
}
int main()
{double n,t,p,q,r,o,s;
cin>>n;
t=0;
s=0;
while(t<n)
{t=t+1;
p=fmod(t,7);
q=fmod(t,10);
o=t/10;
r=floor(o);

if (p==0||q==7||r==7)
s=s;
else s=s+t*t;}
cout<<s;
return 0;
}
//******************************
// * 1.cpp
// *   ?7???????
// *  Created on: 2012-10-9
// * Author: ?? 1200012934
// *****************************
int main()
{
	int n = 0, i = 0, sum = 0;  //?????????????????
	do          //????????if???????n?????????
	{
		cin >> n;     //????
		if (n >=100 || n <=0)   //??n??????????????
		{
			cout << "wrong!again:" << endl;
			continue;
		}
		//n???????1?n????7??????????
		for (i = 1; i <= n; i++)
		{
		    if (i < 10 && i != 7)   //?i????????
		    	sum = sum + i*i;
		    else     //?i????????
		    {  if (i % 7 !=0 && i % 10 != 7 && i /10 != 7)
		    	   sum = sum + i*i;
		    }
		}
		break;   //????????
	}while(1);
		cout << sum;     //??????
	return 0;
}
int main()
{
	int c,d,e,f=0,i;
	scanf("%d",&e);
	for (i=1;i<=e;i++)
	{
		c=i/10;
		d=i-c*10;
		if (c!=0&&d!=0&&c%7!=0&&d%7!=0&&i%7!=0)
		{
			f=f+i*i;
		}
		else if (c==0&&i%7!=0)
		{
			f=f+i*i;
		}
		else if (c!=0&&d==0&&i%7!=0)
		{
			f=f+i*i;
		}
	}
	printf("%d\n",f);
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		if(i%10==7||i>69&&i<80||i%7==0)
			continue;
		else
			sum+=i*i;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int n,a[100];  //??a?????7????
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(i%7==0 || i%10==7 || (i-70>=0 && i-70<10)) //???7???????a????1????0
			a[i]=1;
		else
			a[i]=0;
	}
	int sum=0; //??????0
	for(int i=1;i<=n;i++)
	{
		if(a[i]==0)
			sum+=i*i;    //??7????????
	}
	cout<<sum<<endl; //????
	return 0;
}
int main()
{
    int n,i,c,sum,m=0;
    cin >> n;
    for(sum=0,i=1;i<=n;i++)
    {
                           for(c=1,m=0;c<=i;c=c*10)
                           {
                                               if((((i/c)-7)%10==0)||(i%7==0))
                                               {
                                                                  m=1;
                                                                  break;
                                               }
                           }
                           if(m!=1)
                           sum=sum+i*i;
                           }
                           cout << sum <<endl;
                           return 0;
                           }
int main()
{
	int n,s=0,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i/10==7);
		else
		{
			if(i%10==7);
			else
			{
			if(i%7==0);
			else s=s+i*i;
			}
		}

	}
	printf("%d",s);
	return 0;
}
int main()
{
int n, i, sum = 0;//????n,i,sum,k,??sum?????0
cin >> n;
for (i=1;i<=n;i++)
{
//???????k????????7????k==0,??7???
 ;
if ( ( ( i % 7 == 0 ) + ( 69 < i  && i < 80 ) + ( i - ( i / 10 ) * 10 == 7 ))== 0)
sum = sum + i * i;//??7??????????
}
cout << sum << endl;
return 0;
}
int main() 
{
	int n,i;
	double sum;
	sum=0;
	cin>>n;//???? 
	for(i=1;i<=n;i++)
	{
		if(i%7==0){sum=sum;}//??7??? 
		else if((i-7)%10==0){sum=sum;}//?????7?? 
		else if(i/10==7){sum=sum;}//?????7?? 
		else
		{
			sum=sum+i*i;//????????? 
		}
	}
	cout<<sum<<endl;
}
/**
 * @file    3.cpp              
 * @author  ??? 1100013230               
 * @date    2011-9-29         
 * @descrption        
 *          ????????7??????        
*/
int main()
{   
    int n, m, sum;                                      // sum??7??????
	cin>>n;
	sum = 0;
	for (m = 1; m <= n; m = m + 1)
	{
	    if (m % 10 == 7 || m % 7 == 0 || m / 10 == 7)   // ????7?????sum??
			sum = sum;
		else                                            // ????7???sum????????
			sum = sum + m * m;
	}
	cout<<sum;		
    return 0;
}
/*
 * ?7???????.cpp
 *
 *  Created on: 2010-11-19
 *      Author: taoshibo
 */
int main()
{
	int n,i,sum=0;//????n?????i?????sum
	cin>>n;
	int a[n+1];
	for(i=1;i<n+1;i++){//???????
		if((i%7==0)||(i%10==7)||i/10==7)//??i?7??????0
			a[i]=0;
		else a[i]=i*i;//???????????
	}
	for(i=1;i<n+1;i++)//???????
		sum=sum+a[i];
	cout<<sum<<endl;//?????
	return 0;
}
int main(){
	int n,i,s,a;
 s=0;
 scanf("%d",&n);
for(i=1;i<=n;i++)
{
		a=(i-i%10)/10;
	if(i%7==0)
      continue;
	else if(i%10==7){
	continue;
	
	}
	else if(a==7){
		continue;
	}
	s=s+i*i;
}
   printf("%d",s);
    return 0;
}
int xiangguan(int n)
{if(n%7==0)
 return(0);
 else if(n%10==7||n/10==7)
 return(0);
 else return(1);
}

int main()
{int n;
 scanf("%d",&n);
 int i,sum=0;
 for(i=1;i<=n;i++)
 if(xiangguan(i)) 
 sum+=i*i;
 printf("%d",sum);
}
int main()
{
    int n=0;
    int sum=0;
    cin >> n;
    int a[n];
    for (int i=0;i<n;i++)
    {a[i]=i+1;}
    for (int i=0;i<n;i++)
    {
     if(a[i]<10&&a[i]%7!=0)
     {sum=sum+a[i]*a[i];}
     if(a[i]>9&&a[i]%7!=0&&a[i]%10!=7&&(a[i]-a[i]%10)%7!=0)
     {sum=sum+a[i]*a[i];}
    }
    cout << sum << endl;
    return 0;
}
int main()
{
	int n, sum = 0, i;
	cin >> n;
	for(i = 1; i <= n; i++)
	{
		if(i % 7 == 0 )
		
		continue;
	
		else
			if(i % 10 == 7)
				
			continue;
			
			else 
				if(i / 10 == 7)
			
				continue;
			
		sum = sum +i*i;
	}
	cout << sum << endl;
	return 0;
}
void main()
{
	int n,i,s=0;
	scanf("%d",&n);
	if(n>=10)
	{
	    for(i=1;i<=n;i++)
		{
		    if((i%7==0)||((i/10)==7)||((i%10)==7))
			{
				continue;
			}
			if((i%7!=0)&&((i/10)!=7)&&((i%10)!=7))
			{
				s=s+i*i;
			}
		}
	}
	if(n>=1&&n<10)
	{
		for(i=1;i<=n;i++)
		{
		    if(i%7!=0)
			{
				s=s+i*i;
			}
			else continue;
		}
	}
	printf("%d\n",s);
}
int yuqiwuguan(int);
int main()
{
	int n;
	int sum=0;
	scanf("%d",&n);
	for(int i=0;i<=n;i++)
	{
		if(yuqiwuguan(i))
		{
			sum+=i*i;
		}
	}
	printf("%d",sum);
	return 0;
}
int yuqiwuguan(int i)
{
	int r;
	if(i%7==0||i%10==7||i/10==7)
	{
		r=0;
	}
	else
	{
		r=1;
	}
	return r;
}
/*
 * 123.cpp
 *
 *  Created on: 2012-10-13
 *      Author: Administrator
 */
int main()
{
int n,i,sum=0;
cin>>n;
for(i=1;i<=n;i++)
{if(i%7!=0&&((i/10)%7!=0 && (i/10)!=0 || (i/10)==0)&&((i-(i/10)*10)%7!=0 && i%10!=0 || i%10==0))
	{sum=sum+i*i;}
}
cout<<sum<<endl;
return 0;
}
int main()
{int n,sum=0;
cin>>n;
for(;n>0;n--)
{if(n%7==0||n%10==7||(n/10)%10==7) continue;
sum+=n*n;
}
cout<<sum<<endl;



return 0;
}
/*??:???
??:1100012822
??:2011.9.28
??:?7???????.cpp*/


int main()
{
    int n , i = 1 , s = 0;
    cin>>n;
    while(i <= n)
    {
        if((i-7) % 10 == 0 || i % 7 == 0 || (i >= 70 && i < 80)) i += 1;
        else
        {
            s += i * i;
            i += 1;
        }
    }
    cout<<s<<endl;

    return 0;
}
int main()
{ 
	int sum=0, n;
	scanf("%d", &n);
	for(int i=1; i<=n; i++){
		if(i<7){
			sum+=i*i;
		} 
		else{ 
			if(i>=7&&i%7==0||i>10&&(i-7)%10==0||i>70&&(i%70)<=9){
			
			}
			else{
				sum+=i*i;
			}
		}
	}
	printf("%d\n", sum);
	return 0;
}
int main()
{
 int n;
 int result=0;
 int sum1=0,sum2;
 scanf("%d",&n);
for(int i = 0;i <= n;i++){if(i%7 == 0){result += i*i;}
  else if(i%10 == 7){result += i*i;}
  else if(i%100 == 71 || i%100 == 72 || i%100 == 73 || i%100 == 74 || i%100 == 75 || i%100 == 76 || i%100 ==78 || i%100 == 79){result += i*i;}
}
for(int e = 0;e <= n;e++){scanf("%d",&e);sum1 += e*e;}
   sum2 = sum1 - result;
   printf("%d",sum2);
return 0;
}