semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,i,a,sum;
	sum=0;
	a=0;
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		a=i%10;
		if(i%7==0)
		{
			continue;
		}
		else if(a==7)
		{
			continue;
		}
		else if(i==70+a)
		{
			continue;
		}
		sum=sum+i*i;
	}
	printf("%d",sum);
	return 0;
}
main()
{
      int n,i=1,b,c,s=0;
      scanf("%d",&n);
      
      while (i<=n)
      {
            c=i-i/10*10;
            b=i/10; 
          
            if(i%7==0)
            {i++;
            continue;}
            if (b==7||c==7)
           { i++;
            continue;}
                             s=s+i*i;
                 i++;
        }    
            printf("%d",s);
      
return 0;
}
int main()
{
	int a, b, i, j, k, s;

	cin >> a;
	s = 0;
	for(i = 1;i <= a;i ++)
	{
		k = 0; 
		if(i % 7 == 0)
			k ++;
		b = i;
		while(b != 0)
		{
			j = b % 10;
			if(j == 7)
				k ++;
			b = b / 10;
		}
		if(k == 0)
			s = s + i * i;
	}
	cout << s << endl;

	return 0;
}
int main()
{
	int k=0,i=0,sum=0;
	cin>>k;
	for(i=0;i<k+1;i++)
	{
		if(i%7!=0)
		{
			if((i-7)%10!=0)
			{
				if((i-(i%10))/10!=7)
					sum=sum+(int)pow(1.0*i,2.0);
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}
int main()
{
	int i,  n, sum = 0;
	scanf("%d", &n);
    for (i = 1; i <= n;i++){
			if (i % 7 == 0) continue;
			else if (i > 69&&i < 80) continue;
			else if ((i - 7) % 10 == 0) continue;
			else 
		sum += i*i;
	}
	printf("%d",sum);
	return 0;
}
int main()

{

	
	int a[100][3]={0},b[100]={0},i,n,sum=0;

	cin>>n;
	
	for(i=0;i<n;i++)

	{

		a[i][0]=i+1;

		a[i][1]=a[i][0]%10;

		a[i][2]=a[i][0]/10;

	}

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

	{

		if(a[i][0]%7!=0&&a[i][1]!=7&&a[i][2]!=7)

			b[i]=a[i][0];

	}

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

		sum=sum+b[i]*b[i];

	cout<<sum;



	return 0;

}
int main()
{
	int s=0,n,a[100];
	scanf("%d",&n);
	int i ;
	for(i=0;i<n;i++){
		a[i]=i+1;
		if(a[i]%7==0||a[i]%10==7||(int)a[i]/10==7){
			continue;}
		else
			s+=a[i]*a[i];}
	printf("%d",s);
	return 0;
}
int judge(int x)
{
    if(x%7==0) return 1;
    int temp=10;
    while(x>0)
    {
     if(x%temp==7) return 1;
      x=x/temp;
     }
     return 0;
     }
     
int main()
{
    int n;
    cin>>n;
    int a[100];
    int len;len=0;
    for(int i=0;i<=n;i++)
    {
     if(judge(i)==0)
      a[len++]=i;}
    int sum=0;
    for(int j=0;j<len;j++)
    {
     sum=sum+a[j]*a[j];}
    cout<<sum;
    return 0;
    }
//************************************
//????1000012825_3               *
//??????                       *
//?????2010.10.15               *
//????????7???????    *
//************************************
int main ()
{ 
	int sum = 0 , i , n = 1 ;                                                      // ???? ? ???
	cin >> i ;                                                                     // ?? i
	while (n <= i )                                                                // ????
	{
       if ( ( n % 7 == 0 ) ||  ( n % 10 == 7 ) || ( ( n > 69 ) && ( n< 80 ) )  )   // ??????7 ????
	      sum = sum ;
		  else
		  sum = sum + n * n ;                                                         // ??
	      n = n + 1 ;                                      
    }
	cout << sum << endl ;                                                          // ????
	return 0;
}
int main(){
	int n;
	int i=1;
	int s=0;
	scanf("%d",&n);
	while(i<=n){
		if(i%7!=0){
			if(i!=7){
				if((int)(i/10)!=7){
					if(i%10!=7){
						s+=i*i;
					}
				}
			}
		}
		i++;
	}
	printf("%d",s);
	return 0;
}
/*
?????7???????
??????
?????2011.9.4
*/
int main()
{
	int i,n,s,a,b,c;
	cin >> n;
	if (n < 100 && n > 0 )
	{
		s = 0;
	    for (i=1;i<=n;i++)
		{
			a = i % 7;                                   //a?7?i???
			b = i % 10;                                  //b?i????
			c = i / 10;                                  //c?i????
			if( a == 0 || b == 7 || c == 7 )
				s = s;
			else
				s = s + i * i;
		}
        cout << s << endl;
	}
	else
		cout << "error" << endl;
	return 0;

}
int main()
{
	int n,sum=0,i=1;
	scanf("%d",&n);
	while(i<=n)
	{
		if(i%7==0)
		{
			i++;
			continue;
		}
		if(i/10==7)
		{
			i++;
			continue;
		}
		if(i%10==7)
		{
			i++;
			continue;
		}
	    sum+=i*i;
		i++;
	}
	printf("%d",sum);
}
int main()
{
	int k, s = 0, n, i, a[100] = {0};
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		if (i % 7 == 0) 
			a[i] = 1;
		else
		{
			k = i;
			while (k != 0) 
			{
				if (k % 10 == 7)
				{
					a[i] = 1;
					break;
				}
				k = k / 10;
			}
		}
	}
	for (i = 1; i <= n; i++)
		if (a[i] != 1) 
			s = s + i * i;
	cout << s;
	return 0;
}
int main()
{
    int n;
    cin>>n;
    int i,j,m,t;
    long sum=0;
    for (i=1;i<=n;i++)
    {
        t=0;
        int k=((int)log(n))+1;
        if(i%7!=0)
        {
            for(j=0;j<k;j++)
            {
             if((i/(int)pow(10,j))%10==7)
             {
                t=1;
                break;
             }
             }
            if (t==0)
            sum+=i*i;
        }
    }
    cout<<sum;
    return 0;
}
int main()
{
	int n;(0<n<100);//???????n(n<100)
	cin>>n;//??n
	int sum=0;//???7???????sum
         int k;
	int i;
	for(i=1;i<=n;i++)
	{
		if(i%7==0)//i??7??
			continue;
		if(i%10==7)//i?????7
			continue;
		k=i/10;
		if(k%10==7)//i?????7
			continue;
		sum=sum+i*i;
	}
	cout<<sum<<endl;//??sum
	return 0;
}
int main()
{
	int n, i, k, l, sum=0;
	scanf("%d",&n);
	
	for(i=1;i<=n;i++)
	{
           l = i%10;
	  k = (i - l) / 10;
		if(i%7==0||i%10==7||k%10==7)
		{
			continue;
		}
		sum+=i*i;
	}
    printf("%d", sum);
    return 0;
}
int main()
{
    int n, i, sum = 0, a, b;
    cin >> n;
    for (i = 0; i <= n; i++)
    {
        a = i / 10;
        b = i - a * 10;
        if ((i <= 10 && i % 7 != 0) || (i % 10 == 0 && i % 7 != 0))
            sum += i * i;
        else if (i % 7 != 0 && b % 7 != 0 && a % 7 != 0)
            sum += i * i;
    }
    cout << sum << endl;
    return 0;
}
int main(int argc, char* argv[])
{
	int n,s=0,m;
	scanf("%d",&m);
	for(n=1;n<=m;n++){
		if(n%7!=0&&n/10!=7&&(n-(n/10*10))!=7){
              s=s+n*n;
		  }
	}
		  printf("%d\n",s);
     return 0;
}
int Dec();
int Dec(int x)
{ int i;
    if((x==7)||(x==17)||(x==27)||(x==37)||(x==47)||(x==57)||(x==67)||(x==77)||(x==87)||(x==97)) return 0;
    for(i=7;i<=100;i=i+7)
    {
        if(x==i) return 0;                  
    }    
    if((x<80)&&(x>69)) return 0;
    return 1;
}
int main()
{ int i,n;
scanf("%d",&n);
    int sum=0;
    for(i=1;i<=n;i++)
    {   if (Dec(i)==1) sum=sum+i*i;   
    }
printf("%d",sum);
}
int main()
{
	int n;
	int sum = 0;
	cin >> n;
	for( int i = 1; i <= n; i ++)//i?1?n????
	{
		int n1 = i;
		//???????
		int A = ( i % 7 != 0 );
		//???????
		int B = 1;
		while( n1 >= 1 )
		{
			if( (n1 - n1 / 10 * 10) == 7)
			{
				B = 0;
				break;
			}
			n1 = n1 / 10;
		}
		if( ( A && B ) == 1 )
			sum = sum + i * i;
	}
	cout << sum;
	return 0;
}
int main()
{
	int n,i,a,b,c;
	a=0;
	cin >> n;
	for (i = 1;i <= n;i++)
	{
		b = i / 10;
		c = i - (10 * b);
		if(i%7==0||b==7||c==7)
			continue;
		a = a + (i*i);
	}
	cout << a << endl;
	cin.get();
	cin.get();
	return 0;
}
int main(){
	int n;
	int i,sum=0;
	cin>>n;
	for(i=1;i<=n;i++){
		if(i%7==0||i%10==7||(i-i%10)/10==7)
			continue;
		else
			sum=sum+pow((double)i,2.0);
	}
	cout<<sum<<endl;
	return 0;
}
int main()
{
	int n, sum = 0, i = 1;
	cin >> n;
	while (i <= n)
	{
		int a = i%10, b = i - a;
		if (i%7 == 0) i++;
		else 
		{
			if (a == 7) i++;
		         else 
			{
				if (b == 70) i++;
		                  else sum = sum + i * i;
				         i++;
			}
		}
	}
	cout << sum << endl;
	return 0;
}
main()
{
int i,j,k,m=0,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if((i/10)==7||(i%10==7)||(i%7==0))
continue;
else
m=m+i*i;
}
printf("%d",m);
}
int res[102];
int n;
int main()
{
	cin >> n;
	memset(res, 0, sizeof(n));
	for(int i = 1; i <= 100; i++)
	{
		if(i % 10 == 7 || i % 7 == 0 || i / 10 == 7)
			res[i] = res[i - 1];
		else
			res[i] = res[i-1] + i * i;
	}
	cout << res[n] <<endl;
	return 0;
}
int main()
{
		int n,i=1;
		scanf("%d",&n);
		int sum=0;
while(i<=n)
{
	if(i<70&&(i-7)%10!=0&&i%7!=0)
	{
		sum=sum+i*i;
		i++;
	}
	else if(i>=80&&(i-7)%10!=0&&i%7!=0)
	{
		sum=sum+i*i;
		i++;
	}
	else
	{
		sum=sum+0;
		i++;
	}
}
	printf("%d",sum);
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 yu7wuguan(int);
int main()
{
	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 f(int n)
{
	int m1,m2,flag=0;
	m1=n;m2=n/10;
	while(m1!=0){
		if((m1-10*m2)==7) flag=1;
		m1=m1/10;m2=m2/10;
	}
	if(n%7==0) flag=1;
	return flag;
}
main()
{
	int i,n,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(f(i)==0){
			sum+=i*i;

		}
	}
	printf("%d\n",sum);
}
int main(){
	int n,sum=0;
	scanf("%d",&n);
	while(n>0){
		if(n%7!=0&&n%10!=7&&(n>79||n<70))
			sum+=pow(n,2);
		n--;
	}
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int n,i,s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{	switch(i){
	    case 17:
		case 27:	
		case 37:
		case 47:
		case 57:
		case 67:
		case 87:
		case 97:
		case 71:
		case 72:
		case 73:
		case 74:
		case 75:
		case 76:
		case 78:
		case 79:
			continue;
		default:
			if(i%7!=0)
				s=s+i*i;}
	}
	printf("%d",s);
	return 0;
}
void main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i<10&&i%7!=0)
		sum+=i*i;
		else if(i>=10&&i%7!=0&&i%10!=7&&(i-i%10)%7!=0)
			sum+=i*i;
	}
	printf("%d",sum);
}
int main()
{
	int n,i,sum1=0,sum2=0,sum3;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		sum2=sum2+i*i;
	}
	for(i=1;i<=n;i++)
	{
		if(i%7==0||i%10==7||i/10==7)
		{
			sum1=sum1+i*i;
		}
	}

	sum3=sum2-sum1;
	printf("%d\n",sum3);
	return 0;
}
int main()
{
	int n,i,temp=0,sum=0,ans=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		temp=i*i;
		sum+=temp;
	}
	for(i=1;i<=n;i++)
		if(i%7==0||i/10==7||i%10==7)
			ans+=i*i;
	sum=sum-ans;
	printf("%d",sum);
	return 0;
}
/*
 * qz05.cpp
 *
 *  Created on: 2010-11-16
 *      Author: ??
 */
int main()
{
	int n,sum=0,i;
	cin>>n;                                                                         //????
	for(i=1;i<=n;i++)
	{
		if((i%7==0)||((i%10!=0)&&((i%10)%7==0))||(((i-i%10)>0)&&((i-i%10)%7==0)))
		{
			continue;																//???7????
		}
		else
		{
			sum=sum+i*i;															//???7????????
		}
	}
	cout<<sum;																		//?????
	return 0;
}
void main()
{
 int i,n,sum=0;
 scanf("%d",&n);
  if(n<10)
  {
   for(i=1;i<=n;i++)
  {
   if(i!=7)
	   sum=sum+i*i;
  }
   }
   else
  {
   for(i=1;i<=9;i++)
  {
   if(i!=7)
	   sum=sum+i*i;
  }

  for(i=10;i<=n;i++)
  {
   if((i%10!=7)&&(i%7!=0)&&((i-i%10)%7!=0))
   sum=sum+i*i;
  }
  }
  printf("%d",sum);
 }
//********************************
//*????7???????   **
//*?????? 1300062706 **
//*???2013.10.10**
//********************************
int main()
{
	int n, i, s;
	s = 0;
	cin >> n;
	for (i=1;i<=n;i++)
	{
		if (i!=7&&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&&i%7!=0)
			s = s+i*i;
	}
	cout << s << endl;
	return 0;
}
int main()
{
    int i,n,a,x=1,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 != 71 && i != 72 && i != 73 && i != 74 && i != 75 && i != 76 && i != 78 && i != 79)){
	    sum+=i*i;
		}
	}
	printf("%d",sum);
    return 0;
}
int main(){
	int n;
	scanf("%d",&n);
	int sum=0,j=1;
	for(j=1;j<=n;j++){
		if(j%7==0){
			continue;
		}
		if(j%10==7 || (int)j/10==7){
			continue;
		}
		sum+=j*j;
	}
	printf("%d",sum);
	return 0;
}
int main()
{
    int ans[100], total, answer;
    int n, i, j;
    total = 0;
    for (i=1;i<100;i++)
    {
        total ++;
        ans[total] = i * i;
        j = i;
        if (j % 7 == 0) {total--;continue;}
        while (j)
        {
            if (j % 10 == 7)
            {
                total --;
                break;
            }
            j /= 10;
        }
    }
    scanf("%d", &n);
    answer = 0;
    for (i=1; i<=total; i++)
    {
        if (n * n < ans[i]) break;
        answer += ans[i];
    }
    printf("%d", answer);
    return 0;
}
int main()
{
int n,i;
unsigned long sum=0;
int judge(int i);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%7!=0&&judge(i)==0)
sum+=i*i;
}
printf("%ld\n",sum);
return 0;
}
int judge(int i)
{
int k;

if(i>=10)
do
{
k=i%10;
if(k==7)return 1;
i=i/10;
}
while(i>=10);
if(i==7)return 1;
else return 0;

}
int main()
{
  int n,i,s;
  s=0;
  i=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==7)
		 continue;
	 else
		 s=s+i*i;
}
  printf("%d\n",s);
  return 0;
}
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))
		{
			
			sum+=i*i;
		}
		
	}
	printf("%d",sum);
	return 0;
}
int main()
{
	int s1=0,s2=0,i,j;
	int a,b;
	int n;
	scanf("%d",&n);
	
	for(i=0;i<=n;i++)
	{
		s1=s1+i*i;
	}
	

	for(j=1;j<=n;j++)
	{
		a=j%10;
     	b=j/10;


		if(a==7||b==7||j%7==0)
		{
			s2=s2+j*j;
		}
	}


	printf("%d",s1-s2);
	return 0;
}
main()
{
	int n,b=1,i,sum=0,k;
	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&&i!=7&&i!=14&&i!=21)
			{	
				b=i*i;
		    
				sum=b+sum;
			}
                          
			
		}
		printf("%d\n",sum);
		return 0;
}
int main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		if(!(i%7))continue;
		if((i%10)==7)continue;
		if((i/10)==7)continue;
		sum+=i*i;
	}
	cout<<sum;
	return 0;
}
int main()
{
	int n,s;
	scanf("%d",&n);
	for(;n>=0;n--){
		switch(n){
		case 7:
		case 17:
		case 27:
		case 37:
		case 47:
		case 57:
		case 67:
		case 77:
		case 87:
		case 97: s=s;continue;}
		if(n%7==0||n>=70&&n<=79)
			continue;
		else
			s=s+n*n;}


	printf("%d\n",s);
	return 0;
}
int main()
{
	int a=0,b=0,n=0;
	int wei[10];
	int i=0;
	float c=0,d=0;

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

	for(i = 1;i <= n; i++)
	{
		if( i%7 != 0 && (i - 7) % 10 != 0 && ( i / 10) != 7 )
			sum += i * i;
	}

	cout << sum;



	return 0;

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

return 0;
}
int main(){
	int n;
	int result=0;
	scanf("%d",&n);
    int i=1;
	for(i=1;i<=n;i++){
		if((int)i%7==0||(int)i/10==7||(int)i%10==7){
			continue;}

		result+=i*i;}
	    printf("%d",result);
		return 0;
}
void main ()
{
	int n,a,b,t,i,s=0;
	scanf ("%d",&n);
	for (i=1;i<=n;i++)
	{
		a=i%10;
		t=i/10;
		b=t%10;
		if (a!=7&&b!=7&&i%7!=0)
			s+=pow(i,2);
	}
	printf("%d\n",s);
}
int main (){
	int n,sum1=0,sum2=0,sum,i;
	cin>>n;
	for(i=1;i<=n;i++)
		if(((i>=70)&&(i<80))||(i%7==0)||(i%10==7))
			sum1 = sum1 + i*i;
	for(i=1;i<=n;i++)
		sum2 = sum2 + i*i;
	sum = sum2 - sum1;
	cout<<sum;
}
int main()
	{int n,m=1,s=0,g=1,u=0,k=0;
	cin>>n;
	 
	for(m=1;m<=n;m=m+1)
	{g=m%10;
	 s=(m-g)/10;
	if(s==7||g==7||m%7==0)
	  {k=m*0;}
	 else {k=m*m;}
u=u+k;}
cout<<u;	
	return 0;
	}
int main()
{
	int n,A, S, i;
	scanf("%d", &n);
	S=0;
	for(i=1;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))
			A=i*i, S=S+A;
		else
			A=0, S=S+A;
	}
	printf("%d", S);
	return 0;
}
//********************************
//*?7???????    **
//*????? 1300012753 **
//*???2013.9.13  **
//********************************
int main()
{
	int n, y, t, sum = 0, a; // ??n??????, y???????????sum????t?????7??? 
	scanf("%d", &n);         // ??n              
	
	// ???????1???????????? 
	for (int i = 1; i <= n; i++)
	{
		t = i % 7;           // ????????7??? 
		
		// ??????0?????7?? 
		if (t != 0)      
		{
			y = i % 10;     // ??i?????y 
			a = i / 10;     // ?i?????a
            
            // ?????????7 
			if (y != 7 && a != 7)     
			{
				sum = sum + i * i;  // ?????????7????sum?? 
			}
		}
    }
	printf("%d", sum);      // ??sum 
	return 0;
}
int main()
{
	int n,k,sum=0,a,b,c,d;
	cin>>n;
	if(n<=70)
	{
	    for(k=1;k<=n;k++)
	    {
		    a=k-7;
		    if(k%7!=0&&a%10!=0) sum=sum+k*k;
	    }
	    cout<<sum;
	}
	if(n>70&&n<80)
	{
		for(k=1;k<=70;k++)
		{
			b=k-7;
			if(k%7!=0&&b%10!=0) sum=sum+k*k;
		}
		cout<<sum;
	}
	if(n>=80)
	{
		for(k=1;k<=70;k++)
		{
			c=k-7;
			if(k%7!=0&&c%10!=0) sum=sum+k*k;
		}
		for(k=80;k<=n;k++)
		{
			d=k-7;
			if(k%7!=0&&d%10!=0) sum=sum+k*k;
		}
		cout<<sum;
	}
	return 0;
}
int main()
{
	int a,m,n,p,q,i,s;
	m=0;
	n=0;
	s=0;
	p=0;
	q=0;
	cin>>a;
	if (a<7)
	{
		for (i=0;i<=a;i=i+1)
		{
				s=s+i*i;
		}
	}
	else
	{
		for (i=0;i<=a;i=i+1)
		{
				s=s+i*i;
		}
		for (m=1;7*m<=a;m=m+1)
		{
			p=p+49*m*m;
		}
		for (n=0;10*n+7<=a;n=n+1)
		{
			q=q+(10*n+7)*(10*n+7);
		}
		if (a<70)
			s=s-q-p+49;
		else if(a<80)
		{
			for (i=1;70+i<=a;i=i+1)
				{
					s=s-i*i;
			}
		if (a==77)
			s=s+2*77*77;
		}
		else 
			s=s-q-p+49+77*77-71*71-72*72-73*73-74*74-75*75-76*76-78*78-79*79;
	}
		cout<<s<<endl;
	return 0;
}
int main()
{
	int i, j, n, sum=0;
	scanf("%d", &n);
	for(i=1;i<=n;i++)
	{
		if(i % SHENMI == 0) {continue;}
		if((SHENMI*10 < i) && ((SHENMI+1)*10 > i)) {continue;}
		j = i/10;
		if(((i-j*10) % SHENMI ==0) && ((i-j*10) != 0)) continue;
		sum += i*i;
	}
	printf("%d\n",sum);
	return 0;
}
int main(){
   int n,c,i;
   c=0;
   scanf("%d",&n);
   for(i=1;i<=n;i++){
	   if(i<70&&i%10!=7&&i%7!=0){
		   c+=i*i;
	   }else if(i>79&&i%10!=7&&i%7!=0){
		   c+=i*i;
	   }
   }
   printf("%d",c);
   return 0;
}
int main ()
{
	int n, i, x, sum = 0;
	cin >> n;
	for ( i = 1; i <= n; i += 1)
	{ x = i / 10;
	  if ( i % 7 == 0 || i % 10 == 7 )
	     sum = sum;
	    else if ( x == 7 )
		   sum = sum;
		else sum += i * i ;
	}
	cout << sum << endl;
	return 0;
}
void main()
{
	int n,i,sum=0,sum1=0,t;
	scanf("%d",&n);
	if(n<7)
	{
		for(i=1;i<=n;i++)
		{
			sum=sum+i*i;
		}
	}
	if(n>=7)
	{
		for(i=7;i<=n;i++)
		{
			sum=sum+i*i;
		}
		for(i=7;i<=n;i++)
		{
			t=i/10;
			if(i%10==7||i%7==0||t==7) sum1=sum1+i*i;
		}
		sum=sum-sum1+91;
	}
	printf("%d",sum);
}
main() {
   int n;
   int a,b,c,i;
   int t=0;
   scanf("%d",&n);
   for(i=1;i<=n;i++) {
if(i%7==0) a=0;
else                    
{
a=i;
b=(int)(i/10);
if(b==7)a=0;
else 
  {
a=i;
c=i-b*10;
if(c==7)a=0;
else a=i;
  }
}
t=t+a*a;              }
printf("%d",t);
}
int main()
{float n,a,b,i,c=0,s=0;
cin>>n;
for(a=7;a<=n;a=a+7)
	s=s+a*a;
for(b=17;b<=n;b=b+10)
	s=s+b*b;
if(n>=80)
	{{for(i=70;i<=79;i++)
	s=s+i*i;}
	s=s-2*77*77-70*70;}
if(n>=70&&n<77)
{{for(i=70;i<=n;i++)
	s=s+i*i;
}
s=s-70*70-77*77;}
if(n>=77&&n<80)
	{{for(i=78;i<=n;i++)
		s=s+i*i;}
	s=s-70*70-77*77;}
if(n<70)
	s=s;
for(i=1;i<=n;i++)
	c=c+i*i;
s=c-s;
cout<<s<<endl;
return 0;
}
int main()
{
  int i,n;
  long sum;
  
  cin>>n;
  sum=0;//?????7????????
  for(i=1;i<=n;i++)
   if(i%7==0||i%10==7||i/10==7) sum+=i*i;
  sum=n*(n+1)*(2*n+1)/6-sum;
  cout<<sum;
  return 0;
}
int yu7wuguan (int n);
int main(){
	int result=0,n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		if(yu7wuguan(i)){
			result+=i*i;
		}
	}
	printf("%d",result);
	return 0;
}
int yu7wuguan(int n){
	if (n%7==0){
		return 0;
	}
	if(n==71||n==72||n==73||n==74||n==75||n==76||n==78||n==79){
		return 0;
	}
		if(n%10==7){
			return 0;
	}
	return 1;
}
void main()
{
	int n,i,x(int y),s=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		if(i%7!=0 && x(i)==0) s=s+i*i;
	printf("%d\n",s);
}
x(int y)
{
	int a,b;
	a=y%10;
	b=(y-a)/10;
	if(a==7 || b==7) return 1;
	else return 0;
}
int main()
{
	int i,s,m,x,k,n;
	float h;//h&Ecirc;&Ccedil;
	cin >>n;
	for(i=1,s=0;i<=n;i++)
	{
		for(m=i,x=0;m!=0;m=(m-k)/10)//x???n????????????7???
		{
			k=m%10;
			if(k==7){x++;break;}
		}
		if((i%7!=0)&&(x==0)) s+=i*i;
	}
	cout <<s <<endl;
	return 0;
}
int main()
{
  int b,i=1,sum=0,n;
  double a;
  scanf("%d",&n);
    for(i=1;i<=n;i++)
  {
    a=(double)(i-7)/10;
    b=(i-7)/10;
    if(i%7==0||i<80&&i>69||a==b) continue;
    else sum+=i*i;
  }
  printf("%d\n",sum);
  return 0;
}
// ?????? ???1000010500
// ?7???????
int main()
{
    int n,i,k,sum = 0;
    cin >> n;
    for (i = 1;i <= n;i ++)
    {
        k = i / 10;                      // k??i????? 
        if (i % 7 == 0 || i % 10 == 7 || k == 7 )
        continue;
        sum = sum + i * i;
    }
    cout << sum;
    return 0;
}
int main()
{
	int i,n;
	int sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;)
	{
		if(i%7==0||(i-7)%10==0)
		{
			i++;
			continue;
		}
		else if(i>70&&i<80)
		{
			i++;
			continue;
		}
		else
		{
		sum+=pow(i,2);
		i++;
		}
	}
	printf("%d\n",sum);
	return 0;
}
void main()
{
	int n,i,j,k,sum=0,p,pp;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		pp=i/10;
		p=i-10*pp;
		if(i%7!=0&&pp!=7&&p!=7)
			sum=i*i+sum;
	}
	printf("%d",sum);
}
int main()
{
int n,a=0;
scanf("%d",&n);
while(n<100&&n>0)
{
if(n%7!=0&&n%10!=7&&n/10!=7)
{
	a=a+n*n;
n=n-1;
}
else
{
n=n-1;
}
}
printf("%d\n",a);
return 0;
}
int main(){
	int a,i,sum,sun,x;
	i=1;
	sum=0;
	scanf("%d",&a);
	while(i<=a){
	sum+=i*i;
	i++;
	}

sun=0;
while(a>0){
	if((a%7==0)||(a/10==7)||(a%10==7)){
		sun+=a*a;
	a--;}
	else a--;}
x=sum-sun;
	printf("%d",x);
	return 0;

}
int main()
{
int n,s=0,a,b,c,i;
cin>>n;

for(i=1;i<=n;i++)
{	a=i%7; 
    b=i%10;
	c=i/10;
     if (a!=0)
		 if(b!=7)
			 if(c!=7)
	           s=s+i*i;

}
cout<<s<<endl;
return 0;
}
int main(){
	int n,sum=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		if(!(i%10==7)&&!(i%7==0)&&!(i/10==7)){
			sum=sum+i*i;}
           }
	cout<<sum<<endl;
	return 0;
}
void main()
{
 long n,i,j,f,s=0;
 scanf("%d",&n);
 for (i=1;i<=n;i++)
   if (i%7!=0)
     {
     f=1;
     for (j=i;j!=0;)
       {
       if (j%10==7)
	 {
	 f=0;break;
	 };
       j=j/10;
       };
     if (f==1)
       s=s+i*i;
     };
   printf("%ld\n",s);
 }
int is_relativeto_7(int n);

int main()
{
    int n, i, sum = 0;
    scanf("%d", &n);

    for (i=1; i<=n; i++)
        if (!is_relativeto_7(i)) 
            sum += i*i;

    printf("%d", sum);
    return 0;
}

int is_relativeto_7(int n)
{
    int sh = n;
    if ((n % 7) == 0) return 1;
    do {
        if ((sh % 10) == 7) return 1;
        sh = sh / 10;
    } while (sh > 0);

    return 0;
}
/*
 * pp15.cpp
 *
 *  Created on: 2010-11-17
 *      Author: d
 */

int main()
{
	int n,i,sum=0,sum1=0,sum2=0;
	cin>>n;
	int a[20]={0,7,17,27,37,47,57,67,70,71,72,73,74,75,76,77,78,79,87,97};
	for(i=1;i<20;i++)
		if(a[i]<=n)   sum1+=a[i]*a[i];
	for(i=1;i<=n;i++)
		if(i%7==0)  sum2+=i*i;
	for(i=1;i<=n;i++)
		sum+=i*i;
	if(n>=7&&n<77)
	cout<<sum-sum1-sum2+49;
	if(n<=7)
		cout<<sum;
	if(n>77)
		cout<<sum-sum1-sum2+7*7+70*70+77*77;

	return 0;
}
/**
 * ?? 1045?7??????
 * ?? ???
 * ?? 1000012844
 */

int main()
{
	int n, i, sum = 0;
	
	cin >> n;					//??n?

	while ( n < 1 )
	{
		cout << " Invalid n, input it again ";	//n < 1???
		cin >> n;
	}
	//??????sum??
	for ( i = 1; i <= n; i++ )
	{
		//???7?????1?7??????7?10??7
		if ( ( i % 7 == 0 ) || ( ( i - 7 ) % 10 == 0 ) 
		|| ( ( i < 80 ) && ( i >= 70 ) ) )
		continue;
		sum = sum + i * i;		// ??
	}

	cout << sum;				//??sum??
	return 0;
}
int main(){
	int n,a,i;
	scanf("%d",&n);
    int tag,sum=0;	
	for(i=1;i<=n;i++){
		tag=0;
		if(i%7==0){
			tag=1;
			continue;
		}
		if(tag==0){
			a=i;
            while(a>0){
				if(a%10==7){
					tag=1;
					break;
				}
			    else{
				    a=a/10;
				}
			}
		}
		if(tag==0){
			sum+=i*i;
		}
	}
	printf("%d",sum);
	return 0;
}
/*  ???:?7???????
    ???:1000012896 leo
	????:??7???????
	????:2010.10.17
	*/
int main ()
{
	int n,i = 0,sum = 0;//????
	cin >> n;
	while (i <= n-1)  

	{
		i++;
        if (i % 7 == 0) continue;//?7????????
        if ( i / 10 ==7) continue;//????????7?????
	    if ( (i - (i / 10) * 10) == 7) continue;//????????7?????
        sum  =  sum + i * i;
	}
	cout << sum << endl;
	return 0;
}