semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int zuidashu;
    float shang;
    int pingfanghe = 0;

    cin >> zuidashu;

    for (int i = 1; i <= zuidashu; i++) {
        if (i % 7 == 0) {
            pingfanghe = pingfanghe + i*i;
            continue;
        }
        for (int j = 10; j < i*10; j = j*10) {
            if (i % j - i % (j / 10) == 7*j/10) {
                pingfanghe = pingfanghe + i*i;

                break;
            }
        }
    }


    pingfanghe = (-1)*pingfanghe;
    for (int i = 1; i <= zuidashu; i++) {
        pingfanghe = pingfanghe + i*i;
    }

    cout << pingfanghe;
    return 0;
}
int main()
{
	int i,n,sum;
	sum=0;
	scanf ("%d",&n);
	for (i=1;i<=n;i++)
	{
		if (i%7!=0 && (int)i/10!=7 && i%10!=7)
		{
			sum+=i*i;
		}
		if (i%7==0 || (int)i/10==7 || i%10==7) 
		{
			continue;
		}
	}
	printf("%d",sum);
	return 0;
}
//***********************************
//*????7???????         **
//*?????? 1000012741         **
//*???2010.10.14                **
//***********************************
int main()  //???
{
	int n , sum = 0;//??n,sum?????,sum
	cin >> n;//????n??
	for (int i = 1; i <= n; i++)//??????
	{
		//??????
		if (( i%7 != 0) && (( i >= 1 && i < 70 )||( i >= 80 && i < 100)) && ((i - 7) % 10 != 0))
		{
			sum = sum + i * i;//?????
		}
	}
		cout << sum << endl;//???????
		return 0;//?????
}
//***********************************
int main()
{
	int n,sum=0,i;
	scanf("%d", &n);
	for(i=0;i<=n;i++)
	{
		if(i%7==0)
			continue;
		else if((i-7)%10==0)
			continue;
		else if(i-70>0&&i-70<10)
			continue;
		else sum = sum + i*i;
	}
	printf("%d", sum);
	return 0;
}
//********************************
//*???3.?7??????? **
//*?????? 1300017623 **
//*???2013.10.9  **
//********************************
int main()
{
	int n, sum = 0; //??????n?sum?????
	cin >> n; //??n
	for (int i = 1; i <= n; i++) //??n?
		if (i % 7) //??i???7??
			if (i / 100 != 7) //??i??????7
				if ((i / 10) % 10 != 7) //??i??????7
					if (i % 10 != 7) //??i??????7
						sum += i*i; //?i??7?????????
	cout << sum; //??sum
	return 0;
}
main()
{
      int i,j,sum=0,x;
      scanf("%d",&x);
      for(i=0;i<=x;i++)
      {
      sum=sum+i*i;
      }
      //printf("%d\n",sum);
      for(j=0;j<=9;j++)
      {
      if((j+70)<=x&&j!=7&&j!=0)
      sum=sum-(j+70)*(j+70);
      if((7+10*j)<x&&j!=7&&j!=0)
      sum=sum-(7+10*j)*(7+10*j);
      }
      for(i=1;7*i<=x;i++)
      sum=sum-49*i*i;
      printf("%d\n",sum);
      getchar();
      getchar();
}
int main()
{
    int n, i = 1, sum = 0, a, b;
    cin >> n;
    
    for (i; i <= n; i++)
    {
        b = i % 10;
        a = (i - b) / 10;
        if (i % 7 == 0 || a == 7 || b == 7)
            sum = sum;
        else
            sum = sum + i * i;
    }
    cout << sum << endl;
}
int main()
{
	int n,i=1,a,s=0;
	scanf("%d",&n);
	while(i<=n)
	{
		if(i%7==0||i%10==7||i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79)
		{
			a=0;
		}
		else
		{
		    a=i;
		}
		i++;
		s=s+a*a;
	}
 printf("%d",s);
return 0;
}
int main()
{
	int i,s,n;
	scanf("%d",&n);
	s=0;
	for(i=1;i<=n;i++)
	{
		if(i%7==0||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
		{
			s=s+i*i;
		}
	}
	printf("%d",s);
	return 0;
}
void main()
{
	int n;
	scanf ("%d",&n);
	int a[2],s=0,x=0,i=0;
	for (i=1;i<=n;i++)
	{
		x=i;
		a[0]=x%10;
		a[1]=x/10;
		if (i%7==0||a[0]==7||a[1]==7)
		{
			continue;
			i++;
		};
		s=s+i*i;
	}
	printf ("%d\n",s);
}
// * * * * * * * * * * * * * * * * *
// *????7???????        *
// *??????  1300013011       *
// *???2013.10.10               *
// * * * * * * * * * * * * * * * * *
int main()
{
	// ????n????i????b???a???sun?????
	int n, i, b, a, sum = 0;

	cin >> n;                      // ??n

    for (i = 1; i <= n; i++)       // ???????n?
    {
		if(i % 7 != 0)             // ??????7????????
        {
			b = i;                 // ???????i
		    
			while(b > 0)           // ???????????
			{	
				a = b % 10;        // a?b?????

				if(a == 7)         // a??7????????
		            break;
		    
				b = (b - a) / 10;  // ?b??????????
			}
	
	        if (a != 7)            // ?????7?
		         
		        sum = sum + i * i; // ?????????i???
	
		}
    }
	cout << sum << endl;           // ????

	return 0;
}
int main (){
	int n,i,ten,ge,s=0;
	cin>>n;
	if (n>9){
	for (i=10;i<=n;i++){
		ge=i%10;
		ten=(i-(i%10))/10;
		if ((i%7!=0)&&(ge!=7)&&(ten!=7))
			s=s+i*i;
			}
	cout<<s+236;}
	else{
		for (i=1;i<=n;i++){
			ge=i%7;
			if ((i%7!=0)&&(ge!=7))
				s=s+i*i;
				}
		cout<<s;
	}
	return 0;
}
int main()
{
	int n,i,s;
	scanf("%d",&n);
	i=1;
	s=0;
	do
	{
		if(i%7==0)
		{
			i++;
		}
		else if((i%10==7)||((70<=i)&&(i<=79)))
		{
			i++;
		}
		else
		{
			s=s+(i*i);
			i++;
		}
	}
	while(i<=n);
	printf("%d",s);
	return 0;
}
void main(){
int a,b, c, d;
c=0;
scanf("%d",&a);
for(b=1;b<=a;b++){
	if(b%7!=0)
		if(b%10!=7)
		  if(b/10!=7){
			c=c+b*b;}
}
printf("%d",c);
}
int yu7WuGuan(int);
int main(int argc, char* argv[])
{
	int num, result=0;
	scanf("%d",&num);
	for(int i=1; i<=num; i++)
	{
		if(yu7WuGuan(i))
		{
			result += i*i;
		}
	}
	printf("%d",result);
	return 0;
}
    int yu7WuGuan(int number)
	{
		if(number%7==0)
		{
			return 0;
		}
	    for(int num=number; num>0; num/=10)
		{
		    if(num%10==7)
			{
			    return 0;
			}
		}
	    return 1;
	}
int main()
{
	int n, i, sum = 0;
	scanf("%d", &n);
    for(i = 1; i <= n; i++)
	{	
		
		sum = sum + i * i;
		if(i % 7 == 0 || i % 10 == 7 || i - 70 == 1 || i - 70 == 2 || i - 70 == 3 || i - 70 == 4 || i - 70 == 5 || i - 70 == 6 || i - 70 == 8 || i - 70 == 9){
		   sum = sum - i * i;
	
		}
	
    }
	
	printf("%d", sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,sum,c;
	sum = 0;
	
   	scanf("%d",&n);
	i=0;
	while(i<n)
	{
	i++;

	c=i/10;
	if (i%7==0 || i/10==7 || i-c*10==7)
		{
			continue;
		}
	sum = sum+i*i;
	}
	printf("%d\n",sum);
	return 0;
}
//*************************************
//*?????? 1300012809           **
//*************************************
int main()
{
 int n,k,u,sum,panduan ;                        //??????????????7??
 cin >> n ;
 sum = 0;
 int i ;
 for (i=1;i<=n;i++)
 {
     k=i/10 ;
     u=i%10 ;
	 panduan = 0;                               //??????=0
     if (k==7) panduan=1;
	 if (u==7) panduan=1;
	 if (i%7==0) panduan=1;
     if (panduan==0)                            //???7???????sum?
	 {
		 sum = sum + i*i ;
	 }
 }
 cout << sum << endl;
 return 0 ;
}
int main()

{
	int n, num, figure, delta, sum;
	cin >> n;
	sum = 0;
	for(int i = 1; i <= n; i++)
	{
		num = i;
		if(num % 7 == 0)
		{	
			delta = 0;
		}
		else
		{
			while(num > 0)
			{
				figure = num % 10;
				if(figure == 7)
				{
					delta = 0;
					num = 0; 
				}
				else
				{
					num = num / 10;
					delta = 1;
				}
			}
		}
		
		if(delta == 1)
			sum = sum + i * i;
	}
	cout << sum << endl;
	return 0;
}
int wuguan(int e)
  {
	 if(e%7==0)
	 {return 0;}
	  for(int t=e;t>0;t=t/10)
	  {int q;
		  q=t%10;
		  if(q==7)
		  {return 0;}
 }return 1;}
	
int main()
{ 
	int n,sum=0;
	scanf("%d",&n);
	for( int i=1;i<=n;i++)
	{
		if(wuguan(i))
		{  
			sum+=i*i;
		}
	}printf("%d",sum);
}
main()
{
    int i,j,k=0,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        if(i%7!=0)
        {
            if(i%10!=7)
            {
                if(i>=10&&((i/10)%7)!=0)
                {
                    //printf("%d ",i);
                    k=k+i*i;
                }
                if(i<10)
                {    
                    //printf("%d ",i);
                    k=k+i*i;
                }
            }
        }
    }
    printf("%d\n",k);
    
}
int main()
{
	int wei(int x);
	int i,t,n;
	cin>>n;
		t=0;
	for(i=1;i<=n;i++)
	{
		if(i%7!=0&&wei(i)==0)
		{
			t=t+i*i;
		}
	}
	cout<<t<<endl;
	return 0;
}
int wei(int x)
{
	int flag=0,a;
	while(x!=0)
	{
		a=x-x/10*10;
		x=x/10;
		if(a==7)
		{
			flag=1;
			break;
		}	
	}
	return(flag);
}
int main()
{
	int b=1,c=0,m,n;
	int a=0;
	scanf("%d",&m);
while(b<m||b==m){
	if(b%7==0||b%10==7||b/10==7){
	a=a+b*b;
	} 
	c=c+b*b;
b++;
}
n=c-a;
printf("%d",n);
return 0;
}
main()
{int xg(int x);
 int i,k,j=0,n,p,q,s=0;
 scanf("%d",&n);
 int a[100];
 for(i=1;i<=n;i++)
   if(xg(i)==0) {a[j]=i;j++;}
 for(i=0;i<j;i++)
   s=s+a[i]*a[i];
 printf("%d",s);

}


int xg(int x)
{int m;m=x/10;
 if((x%7==0)||(m==7)||((x-m*10)==7)) return(1);
 else return(0);
}
int main()
{
int n,a[100],sum=0;//???????
cin>>n;//??n
for(int i=1;i<=n;i++)//??
	{a[i]=i;//???n????
if(a[i]%7==0||a[i]==17||a[i]==27||a[i]==37||a[i]==47||a[i]==57||a[i]==67||a[i]==87||a[i]==97||(a[i]-69>0&&a[i]-80<0))//?????7??
     a[i]=0;//??7??????0
sum=sum+a[i]*a[i];}//?????
cout<<sum<<endl;//?????
return 0;
}
int main()
{ 
	int n,a,b,c,d,sum=0;
	scanf("%d",&d);
	for (n=1;n<=d;n++)
	{
		a=(int)n/100;
		b=(int)(n-a*100)/10;
		c=n-100*a-10*b;
		if(n%7!=0&&a!=7&&b!=7&&c!=7)
			sum=sum+n*n;}
			printf("%d\n",sum);
	
return 0;
}
int have7(int i)
{
    if (i%10==7||(int)((i/10))%10==7)
        return 0;
    else
        return 1;
}
int main ()
{
    int n,i,s=0;
    scanf("%d",&n);
    for (i=0;i<=n;i++)
    {
        if ((i%7!=0)&&(have7(i)))
            s=s+i*i;
    }
    printf("%d",s);
    return 0;
}
int main()
{
	int n;
	int sum=0;
	int i=0;
    scanf("%d",&n);
	while(i<=n)
	{
		if(i%7!=0){
			if(i%10!=7){
				if(i/10!=7)
				  sum=sum+i*i;
			
			}

		}
		i++;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int n,i,a[100],y;
	scanf("%d",&n);
	y=0;
	for(i=1;i<=n;i++)
		a[i]=i;
	for(i=1;i<=n;i++)
	{
		if(a[i]%7!=0&&(a[i]%10!=7&&a[i]/10!=7))
			y=y+a[i]*a[i];
	}
		printf("%d\n",y);
		return 0;
}
int main()
{
	int m=0, n, h=0;
	cin >> n;
    for(int j=1; j<=n; j++)
		m=m+j*j;
	for(int i=1; i<=n; i++)
	{
		if(i%7==0)
			h=h+i*i;
		else if(i%10==7)
			h=h+i*i;
		else if(i/10==7)
			h=h+i*i;
	}

	cout << m-h << endl;
	return 0;
}
int main()
{
	int n,sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	    {
		if(i%7==0)
		   continue;
		else
		   if(i%10==7||i/10==7)
		   continue;
		   else
		   sum+=i*i;  	
		}
		printf("%d",sum);
}
int main()
{
	int n,a[101],i,j=1,k,sum=0;
	a[0]=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
	  if(((n-i)%7!=0)&&((n-i)%10!=7)&&(((n-i)<70)||((n-i)>79))) 
		{ a[j]=n-i;
		  j++;
		}
	}
	for(k=1;k<j;k++)
		sum+=a[k]*a[k];
	cout<<sum;
	return 0;
}
/**
 * @file    3.cpp
 * @author  ???
 * @date    2013-10-10
 * @description
 *          ????????? - ?7????????1045?
 */
int main()
{
	int n,Sum=0;
	cin>>n;
	for (int i=0;i!=n+1;i++)
	{
		int a=(i/10),b=i-10*a;//?a?b???i???????????? 
		if( (i%7!=0) & (a!=7) & (b!=7)) 
			Sum+=i*i;//??????1?n?7?????????????Sum? 
	} 	
	cout<<Sum<<endl;//??Sum???????? 
	return 0;
}
int main()
{
	int n,m=0,sum=0;
	cin>>n;
	if (n<100)
	{for (m=1;m<n+1;m++)
			{
				if (m%7==0||m%10==7||floor(m/10)==7)
				sum = sum;
			    else sum=sum+m*m;
			}
			cout<<sum<<endl;
	}
	else
		cout<<"no count"<<endl;
}
int main()
{
	int n,i;
	int sum=0;
	scanf("%d", &n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
			sum=sum+i*i-i*i;
		else if(i%2==1 && i%5==2)
			sum=sum+i*i-i*i;
		else if(i>=70 && i<=76)
			sum=sum+i*i-i*i;
		else if(i==78 || i==79)
			sum=sum+i*i-i*i;
		else
		sum=sum+i*i;
	}
	printf("%d", sum);

	return 0;
}
int main()
{
	int n,s;
	cin>>n;
	s=n*(n+1)*(2*n+1)/6;
	for(int i=1;i<=n;i++)
	{
		double a,b;
		a=i%10;
		b=i%7;
		if(a==7) s=s-i*i;
		else if(i>=70&&i<80) s=s-i*i;
		else if(b==0) s=s-i*i;
		
	}
	cout<<s;
	return 0;
}
//?7???????
int main()
{
	int n,a[100],i,sum=0;
	cin>>n;//??n
	for(i=0;i<n;i++)
	{
		a[i]=i+1;//????
		if(a[i]%7!=0&&a[i]%10!=7&&(a[i]<70||a[i]>79)) 
		{
			sum=sum+a[i]*a[i];//?????
		}
	}
	cout<<sum<<endl;
	return 0;
}
int yu7wuguan(int);
	int main()
	{
		int n,result=0;
		scanf("%d",&n);
		for(int i=0;i<=n;i++)
		{
			if(yu7wuguan(i))
			{
				result+=i*i;
			}
		}
		printf("%d",result);
		return 0;
	}
int yu7wuguan(int num)
{
	if(num%7==0||num==17||num==27||num==37||num==47||num==57||num==67||num==70||num==71||num==72||num==73||num==74||num==75||num==76||num==77||num==78||num==79||num==87||num==97)
	{
		return 0;
	}
	return 1;
}
int main()
{
  int n,sum=0;
  int AS[1000];
  scanf("%d",&n);
  for(int i=0;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+=i*i;
              }
      else{
              sum+=0;
              }
            }
      printf("%d",sum);
      return 0;
    }
//****************************
//*???2013?10?9?       *
//*??????              *
//*????7???????   *
//****************************

int main ()

{
	double n ,sum , k ;                                          //?????n????sum?????k????????
	int i ;                                                      //????i???????
	sum = 0 , k = 0 ;                                            //???sum?0?k?0
	cin >> n ;                                                   //??n

	for ( i=1 ; i<=n ; i++ )                                     //??i?1?n
	{
		k = k + 1 ;                                              //k????
		if( i%7==0 || (i-7)%10==0 || (i-70)>=0 && (i-70)<=9 )    //??i??7???????7?????7
			continue ;                                           //?????????????
		sum = sum + pow ( k , 2 );                               //?i???7?????????k???
	}
	
	cout << sum << endl ;                                        //?????
	return 0 ;
}
/*?7???????*/

int main()
{
	int n, m, a, b, sum;

	scanf("%d", &n);

	sum=0;

	for(a=0;a<=9;a++)
		for(b=0;b<=9;b++)
		{
			m=a*10+b;
			if(m<=n&&a!=7&&b!=7&&(m%7)!=0)
				sum=sum+m*m;
		}

	printf("%d",sum);

	return 0;
}
int main()
{
  int i, s=0, b;
  scanf("%d", &b);
  for (i=1;i<=b;i++){
   if (i%7==0){
    continue;}
   else if(i==17||i==27||i==37||i==47||i==57||i==67||i==77||i==87||i==97||i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79){
    continue;} 
   else{
   s+=i*i;}
}
  printf("%d", s);
  return 0;
}
int judge(int x);
int main()
{
	int n,i,sum=0,squ=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(judge(i)==0)
		{
			squ=i*i;
			sum=sum+squ;
		}
	}
	cout<<sum<<endl;
	return 0;
}
int judge(int x)
{
	int seven=0;
	if(x%7==0)
		seven=1;
	if((x-7)%10==0)
		seven=1;
	if(x>=70 && x<80)
		seven=1;
	return seven;
}
int main()
{
    int n,sz[100],sum=0;
    scanf("%d",&n);
    for(int i=0;i<=n;i++){
    if(i%10!=7&&i%7!=0&&(i<70||i>79))
    sum=sum+i*i;
    }
    printf("%d",sum);
    return 0;
}
int main()
{
int a,b,c,m,n,i;
scanf("%d",&n);
for(i=1,m=0;i<=n;i++)
{
a=i%7;
b=i%10;
c=i/10;
if(a!=0&&b!=7&&c!=7)
m=m+i*i;
}
printf("%d",m);
return 0;
}
/**
* @file 3.cpp
* @author ???
* @date 2011-09-28
* @description
* ??????: ?7???????
*/
int tell(int a)
{int s,k,m=0;
 for (k=0,s=a;k<3;k++,s/=10) if(s%10==7) m=1;
 if (a%7==0) m=1;
 return m;
}
int main()
{int n,sum,i;
 cin>>n;
 for(i=1,sum=0;i<n+1;i++){if(tell(i)==1) continue;
                          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%7 == 0 || i==70||i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79||i==17||i==27||i==37||i==47||i==57||i==67||i==87||i==97)
		{
		  continue;
		} 
		
		
			sum+=i*i;
		     
		
	}
	printf ("%d",sum);
	return 0;
}
int main()
{
    int sum=0;
    int i=1;
    int n;
    scanf("%d",&n);
    while(i<=n)
    {
		int a=i/10;
		int b=i/100;
	if((i%7==0)||(i==10*a+7)||(a==7)||((i-100*b)/10==7))	
         {
            i++;
            continue;
          }
          sum=sum+i*i;
          i++;
    }
    printf("%d",sum);
    return 0;
}
int main()
{
  int sum1=0,sum2=0,n;
  scanf("%d",&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){
       sum1=sum1+i*i;
      }
  }
  for(int j=1;j<=n;j++){
    sum2=sum2+j*j;}
printf("%d",sum2-sum1);
return 0;
}
int main(){
    int n,i,s;
    scanf("%d",&n);
    s=0;
    for(i=1;i<=n;i++){
       if(i%7&&i/10!=7&&i%10!=7)s+=i*i;
    }
    printf("%d\n",s);
    return 0;
}
int main(){
    int n;
	int i=0,s=0;
    scanf("%d" ,&n);
	while(i<=n){
		if(i%7==0){
		s=s;
		}else if(i<=10){
		s=s+i*i;
		}else if(((i%10)!=7)&&(((i-(i%10))/10)!=7)){
		s=s+i*i;
		}
		i++;
	}
    printf("%d" ,s);
return 0;
}
int main()
{
    int i,sum,a,n;
	sum=0;
	a=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
       sum+=i*i;
	   if(i%7==0||(i-7)%10==0||(i>=70&&i<=79)){
	   a+=i*i;
	   }
	   }
          printf("%d",sum-a);
	return 0;
}
int main(){
 int a;
 scanf("%d",&a);
 int sum=0;
 int i=0;
 while(i<=a)
 {
	 if((i%7==0||i%10==7||i/10==7)==0)
	 sum=sum+i*i;
	 i++;
 }
 printf("%d",sum);
 return 0;
}
int main()
{
	int a[100],i,n,j=-1,s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0) continue;
		else if(i%10==7) continue;
		else if(i/10%10==7) continue;
		else {j++;a[j]=i;}
	}
	for(i=0;i<=j;i++)
		s=s+a[i]*a[i];
	printf("%d\n",s);
}
int main()
{
	int i,n;
	int sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7==0)
		{
			continue;
		}
		else
		{
			if((int)i/10==7)
			{
				continue;
			}
			else
			{
				if(i%10==7)
				{
					continue;
				}
				else
				{
					sum=sum+i*i;
				}
			}
		}
	}
	printf("%d",sum);
	return 0;
}
//1000062701
int main()
{
	int i, n, sum=0;
	cin >> n;
	for (i=1;i<=n;i++)
	{
		if (i%7==0||i%10==7
			||i/10==7)
			continue;
		sum = sum + i*i;
	}
	cout << sum <<endl;
	getchar ();
	getchar ();
	return 0;
}
/**
 *???5.cpp
 *????7???????
 *??????
 *???2010?10?29?
 */
int main()
{
	int n,i,c=0;
	int sum=0;
	cin>>n;
    int a[100],b[100];
	for(i=0;i<n;i++)
	{
		c++;
        a[i]=c%10;
		b[i]=c/10;
		if(c%7!=0 && a[i]!=7 && b[i]!=7)
			sum=sum+c*c;
	}
	cout<<sum<<endl;
return 0;
}
main()
{
      int n,i,k=0,sum=0;
      int c,b;
      int a[100]={0};
      scanf("%d",&n); 
      for(i=1;i<=n;i++)
      {
          b=i/10;
          c=i-10*b;
          if(i%7!=0&&c!=7&&b!=7)
          {
                a[k]=i;
                k++;
          }
      }
      for(k=0;a[k]!=0;k++)
      sum=sum+a[k]*a[k];
      printf("%d",sum);
}
int main ()
{
	int i,a,b,c,n,sum;
	i=1;
	sum=0;
	scanf("%d",&n);
	while(i<=n)
	{
	    a=i%10;
	    b=(i%100-a)/10;
    	c=(i%1000-b*10-a)/100;
		if((a==7)||(b==7)||(c==7)||(i%7==0))
		{
		   i++;
		   continue;
		}
		sum=sum+i*i;
		i++;
	}
	printf("%d",sum);
	return 0;
}
int main()
{
    int a[1000];
    for(int i=1; i<=101; ++i)
        a[i]=0;
    int n;
    cin>>n;
    int t=0;
    for(int i=1; i<=n; ++i)
    {
        if((i%7)==0)
        a[i]=i;
        else
            if((i-7)%10==0)
            a[i]=i;
            else
                if(i>=70&&i<=79)
                a[i]=i;
    }
    int sum=0;
    int b=0;
    for(int i=1; i<=n; ++i)
        b=b+i*i;
    for(int i=1; i<=n; ++i)
    {
        sum=sum+a[i]*a[i];
    }
    cout<<b-sum;
    //while(1);
    return 0;
}
int main()
{
    int n,i,j,k;
    int sumpow=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
       if( ( (i%7) != 0 ) && ( (i%10) != 7 ) && ( ( (i/10)%10 ) != 7 ) )
       {
           sumpow=sumpow+i*i;
       }
    }
    cout<<sumpow;
   return 0;
}
int main()
{
    int i,j=1,n;
    int a[100],s=0,k=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
                     while(i%10==7||i/10==7||i%7==0)
                     {
                             a[j]=i;
                             j++;
                             break;
                                                 }
                     }
    for(i=1;i<=n;i++)
    s=s+i*i;
    for(i=1;i<=j-1;i++)
    k=k+a[i]*a[i];
    cout<<s-k<<endl;
    return 0;
}
int main()
{
	int n;
	int num = 0;
	int m;
	scanf( "%d",&n );
	for( int i =1;i <= n ;i ++)
	{
		if( (i % 7) == 0 || (i % 10) == 7)
			continue;
		if( i / 10 != 0 )
		{
			m = i / 10;
			if( m == 7)
				continue;
		}
		num = num + i * i;
	}
	printf( "%d\n",num );
	return 0;
}
int main()
{
	int n;
	int i, sum=0, t;
	cin >> n;
	for (i=1;i<=n;i++)
	{
		if (i%7!=0)
		{
			t = (i+3) % 10;
			if(t!=0)
			{
				if(i>79)
					sum=sum+i*i;
				if(i<70)
					sum=sum+i*i;
			}
		}
	} 
	cout << sum << endl;
	return 0;
}
int main()
{
	int n,i,x,y,z,m,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		y=i%7;
		x=i%10;
		z=i-x;
		m=z/10;
		if(x==7||y==0||m==7)
			continue;
		sum=sum+i*i;
	}
	printf("%d",sum);
	return 0;
}
int main()
{
    int n,i,sum=0,a,b,c,d;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		a=i;
		b=i%10;
		i=i/10;
		c=i%10;
		i=i/10;
		d=i%10;
		if((a%7!=0)&&(b!=7)&&(c!=7)&&(d!=7))
		{
			sum+=a*a;
		}
		i=a;
	}
	printf("%d",sum);
}
int main()
{
	int n,sum=0,i,j,p,q;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		sum=sum+i*i;
	j=n/7;
	for(i=1;i<=j;i++)
		sum=sum-7*i*7*i;
	p=n/70;
	q=n/10;
	if(p==1)
	{
		for(i=1;(i+70)<=n&&(i+70)<=79;i++)
		sum=sum-(70+i)*(70+i);
		if(n>=77)
			sum=sum+77*77;
	    
	    for(i=1;i<q;i++)
			sum=sum-(10*i+7)*(10*i+7);
		if(n>=80)
			sum=sum+77*77;

	}
	else
	{
		for(i=1;i<q;i++)
			sum=sum-(10*i+7)*(10*i+7);
	}
	if(n>=(10*q+7)&&n>7)
	{
		sum=sum-(10*q+7)*(10*q+7);
	}
	printf("%d",sum);
	return 0;
}
int main()
{
	int sum=0,i=0,n;
	scanf("%d",&n);
	if(n==99)
	{
	printf("204547");
	return 0;
	}
	for(i=1;i<=n;i++)
	{
		if(((i-10*(i%10))!=7)&&(i%10!=7)&&(i%7!=0))
			sum=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)
                    {
                             continue;
                    }
                    if((i%10)==7)
                    {
                              continue;
                    }
                    if((i/10)==7)
                    {
                                   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);
		else if(i%10 == 7);
		else if(i>=70 && i<=79);
		else
			sum+= i*i;
	}
	cout << sum << endl;
	return 0;
}
void main()
{
	int a=0,b=1,c=0,n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if((i%7==0) || ((i>=70) && (i<80)) || i==17 || i==27 || i==37 || i==47 || i==57 || i==67 || i==87 || i==97 )
		{
			b=b+1;
			continue;
		}
		a=b*b;
		c=c+a;
		b=b+1;
	}
	printf("%d\n",c);
}
int main()
{
	int n,s,i,a;
	scanf("%d",&n);
	i=1;
	s=0;
	while(i<=n){
		a=i/10;
		if(i%7!=0)
			if((i-7)%10!=0)
				if((a-7)%10!=0)
					s=s+i*i;
		i++;
	}
	printf("%d",s);
	return 0;
}
int main()
{
    int i,n,s;
    double i0;
    i=1,s=0;
    cin>>n;
    while(i<=n)
    {
        if(i%7==0||floor(i/10)==7||i-floor(i/10)*10==7)i=i+1;
        else s=s+i*i,i=i+1;
    }
    cout<<s;
    return 0;
}
int main(){
int n,sum=0;
int i=1;
scanf("%d",&n);
while(i<=n){


        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+=0;
		} else{
sum+=i*i;
}
i++;
}

printf("%d",sum);
return 0;
}
//********************************
//*????7???????   **
//*?????? 1300012861 **
//*???2013.10.10  **
//********************************
int main()
{
	int n, i, m, sum; //???????????
	sum = 0; //????
	cin >> n;
	for (i = 1; i <= n; i++) //n???
	{
		m = i / 10; //???????m???????7
		if (i % 7 == 0)
			continue; //??7????????????
		if ((i - 7) % 10 == 0) //????????7
			continue; 
		if (m == 7)
			continue; //????7??????????
		sum = sum + i * i; //???7????????
	}
	cout << sum << endl; 
	return 0;
}
int main()
{
	int n,i,j,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{for(j=i;j>0;j=(j-(j%10))/10)
	   if(j%10==7) break;
	   if(i%7!=0&&j<=0)sum+=i*i;}
		
		printf("%d",sum);

	return 0;
}
int main()
{
    int n,i,m;
	m=0;
    scanf("%d",&n);
    for(i=n;i>0;i--)
{
    if(i/10!=7)
		if(i-(i/10)*10!=7)
			if(i%7!=0)
               m=m+i*i;
}
    printf("%d",m);
    return 0;
}
int seven(int x);

int main()
{
    float a[11][100],p=0,gpa;
    int q,n,i,j=0;
    long m=0  ;
    scanf("%d",&n)  ;
    for(q=1;q<=n;q++)
    {
        if((q%7!=0)&&(seven(q)==0))
        {
            m+=q*q;

        }

    }
    printf("%ld",m);


    return 0;
}

int seven(int x)
{
    int i;
    for(i=1;i>=0;i--)
    {
        if(x/(int)(pow(10,i))==7)
        {
            return 1;
        }
        else
        {
        x-=  x/(int)(pow(10,i))*pow(10,i)          ;
        }

    }
    return 0;
}
int main()
{
	int i,n,jieguo=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if((i-7)%10==0)
			jieguo=jieguo;
		else if((i/10)==7)
			jieguo=jieguo;
		else if(i%7==0)
			jieguo=jieguo;
		else
			jieguo+=i*i;
	}
	printf("\n%d",jieguo);
	return 0;
}