semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
int a[100]={0},j=0;
int n,i,s=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{ if(i%7!=0)
    if(i%10!=7&&i/10!=7) 
       s=s+i*i;
}
printf("%d",s);
}
int main()
{
    int s=0,n,i,a;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		if(i%u!=0)
		{
		  a=i;
		  while(a>0)
		  {
			if(a%g==u)
			  break;
			a=a/g;
		  }
		  if(a==0)
			s+=i*i;
		}
		printf("%d",s);
	return 0;
}
int main()
{
	int n;
	int a=0;
	int i=1;
	scanf("%d",&n);
	for (i=1; i<=n; i++)
	{
		if (i%7==0)
		{
			continue;
		}
	    if((i-7)%10==0)
		{
			continue;
		}
		if(i/10==7)
		{
			continue;
		}
			a=a+i*i;
	}
	printf("%d", a);
	return 0;
}
int main()
{
	int i,n,k=0;
	scanf("%d",&n);
	for(i=1;i<n+1;i++)
	{      
		if((i%7)!=0&&(i%10)!=7&&(i<70))
		{
			k=k+i*i;
		}
                if((i%7)!=0&&(i%10)!=7&&(i>79))
		{
			k=k+i*i;
		}
	}
	printf("%d",k);
	return 0;
}
int main()
{
	int number, sum;
	cin >> number;
	sum = 0; //????????????0 
	
	for(int i = 1; i <= number; i++) //???????????number?????????? 
	{
		sum += i * i;
	}
	
	for(int k = 1; k <= number; k++) //???7??????? 
	{
		if((k % 7) == 0 || (k % 10) == 7 || (k / 10) == 7) //?????7??????7?????????7???????7 
			sum = sum - k * k;
	}
	
	cout << sum << endl; //????? 
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	int sum=0;
	for (int i=1;i<=n;i++){
		if (i%7!=0){
			if ((i-7)%10!=0){
				if ((i-70)<0||(i-70)>9){
					sum+=(i*i);
				}
			}
		}
	}printf("%d",sum);
	return 0;
}
int main()
{
	int num,i,flag,t,ans;
	cin>>num;
	ans=0;
	for (i=1;i<=num;i++)
	{
		flag=0;
		if (i%7==0) flag=1;
		else
		{
			t=i;
			while (t>=1)
			{
				if (t%10==7) flag=1;
				t=t/10;
			}
		}
		if (flag==0) ans=ans+i*i;
	}
	cout<<ans;
	return 0;
}
int main()
{
int i,n,sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if (!(i>=70&&i<=79||i%7==0||i%10==7))
{
sum+=i*i;
}
}
printf("%d",sum);
return 0;
}
void main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if((i/100)!=7&&(i/10)%10!=7&&(i%7!=0)&&i!=7&&(i/10)!=7&&(i-i/10*10)!=7) sum+=i*i;
	}
	printf("%d",sum);
}
int main()
{
	int n,a[100],i;
	long c=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if((i%7==0) || (i%10==7) || (i/10==7))
			a[i]=0;
		else a[i]=i;
		c+=a[i]*a[i];
	}
	printf("%d",c);
	return 0;
}
int main()
{
	int n=0,i=0,a[100]={0},sum_a=0,sum_n=0,sum=0;
	cin>>n;
	if(n>0 && n<100)
	{
		for(i=1;i<=n;i++)
			{
				{
					if(i%7==0 || i%10==7 || i/10==7)
				a[i]=i;
			else
				a[i]=0;
				}
				sum_a=sum_a+a[i]*a[i];
		}
		for(i=1;i<=n;i++)
			sum_n=sum_n+i*i;
		sum=sum_n-sum_a;
		cout<<sum;
	}
	return 0;
}
int main()
{
	int n,i=1,sum=0;                                                                         
	cin >>n;                                                                                 //??n
	do                                                                                        //????
	{
		if(i%7==0||i==17||i==27||i==37||i==47||i==57||i==67||i==87||i==97)sum=sum;
		else if(i==71||i==72||i==73||i==74||i==75||i==76||i==78||i==79)sum=sum;
		else sum=sum+i*i;
		i++;
	}while (i<=n);
	cout <<sum <<endl;                                                                     //????
	return 0;
}
//???      1000062705    ?7???????
int main()
{
	int n, i, sum = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
		if (i % 7 == 0) continue;
		else if ( (i - 7) % 10 == 0||i / 10 == 7 ) continue;
		else sum = sum + i * i;
		cout << sum << endl;
    return 0;
}
int main()
{
	int n,i,k=0,p,s,d;
	scanf("%d",&n);
	for(i=0;i<=n;i++){
		if(i%7!=0){
			d=0;
			for(p=i;p>0;p=p/10)
			{
				if((p-7)%10!=0)
					continue;
				if((p-7)%10 == 0){
				d=1;
				break;
				}
			}
		if(d!=1){
			s=i*i;	
			k+=s;
			}
		}
	}
	printf("%d",k);
	return 0;
}
int main()
{
	int n,sum=0;
	cin>>n;
	if(n>=100)
	{
		cout<<"?????"<<endl;
	}
	for(int i=1;i<=n;i++)
	{
		if(i%7==0||i/10==7||i-(i/10)*10==7)
		{
			continue;
		}
		else
		{
		sum+=i*i;
		}
	}
	cout<<sum<<endl;
	return 0;
}
//?7???????


int main()
{
	int n,i,sum=0;
	int a[100];                          //???????7???
	cin>>n;
	for (i=1;i<=n;i++)                   //?????????????????
	{
		a[i]=i;                          //??i??????i??
		if (i%7==0||i%10==7||i/10==7)    //?i??7??????7????7???7??
			a[i]=0;                      //??a[i]?0
		sum=sum+a[i]*a[i];               //?????
	}
	cout<<sum;
	return 0;
}
int main()
{
	int n=0,sum1=0,sum2=0,i=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i<=10)
		{
			if(i!=7)
				sum1=sum1+i*i;
            else 
				sum1=sum1;
		}
		if(i>10)
		{
			if(i%7!=0&&i/10!=7&&(i-10*(i/10))!=7)
			sum2=sum2+i*i;
		    else
		    sum2=sum2;
		}
	}
	cout<<sum1+sum2<<endl;
	return 0;
}
int has7(int a);
int has7(int a)
{
	int len,b,p,k;
	k=0;
	len=0;
	b=a;
	do{
		b=b/10;
		len++;
	}while (b>0);
	for (int i=len-1;i>=0;i--)
	{
		p = (int)(a/pow(10,i));
		if (p==7)
		{
			k=1;
			break;
		}
		a = a - p*(int)pow(10,i);
	}
	return k;
}

int main()
{
	int n,m;
	int s=0;
	scanf("%d",&n);
	for(m=1;m<=n;m++)
	{	
		if(m%7!=0 && has7(m)==0)
		{
			s = s + m*m;
		}
	}
	printf("%d",s);
	return 0;
}
int seven(int x){
	if(x%7==0){
		return 1;		
	}
	if(x%10==7){
		return 1;		
	}
	if(x-x%10==70){
		return 1;		
	}
	return 0;
}
int main(){
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		if(seven(i)==0)
			sum+=i*i;
	}
	printf("%d",sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int i=1;
    int s=0;
    int n;
    scanf("%d",&n);
    while (i<=n) {
         if (((i%7))&&(!(i%10==7))&&(!(i/10==7))) {
		//if ((i%7)||(i%10-7)||(i/10-7)) {
                                         s=s+i*i;
										// printf("%d\n",i);
                                         }
                                         i++;
                                         }

    printf("%d",s);
	return 0;
}
int main()
{
    int n, i, hash[100], sum=0;
    cin>>n;
    for(i=1; i<=n; i++)
      {
        hash[i]=1;
        if(i>=70 && i<=79)
          hash[i]=0;
        else if(i%10==7)
          hash[i]=0;
        else if(i%7==0)
          hash[i]=0;     
      }
    for(i=1; i<=n; i++)
      {
        if(hash[i]==1)
        sum=sum+i*i;     
      }
    cout<<sum;
    int a;cin>>a;
    return 0;
    
    }
int main()
{
	int n , sum ;
	cin >> n ;
	sum = 0;
	for (int i = 1 ; i <= n ; i++)
	{
		if (i%7!=0 && i%10!=7 && (i%70>=10 || i <= 10))
			sum = sum + i * i;
	}
	cout << sum << endl;
	return 0;
}
/*???1000012904_3.cpp
  ?????100???7???????
  ?????
  ???2010?10?15?
*/
int main()
{
	int n;//????????????
	cin >> n;//?????
	if(n < 100)//????????100??
	{   
		//??????????????????
		int a , b , i , sum = 0;
		for(i = 1 ; i <= n ; i++)//??
		{
			for(a = 0 ; a <= 9 ; a++)//?????
			{
				for(b = 0 ; b <= 9 ; b++)//?????
				{  
					//?????????????
	                                     if(i == a * 10 + b)
				   { 
                                            //???????7????
                                            if(i % 7 != 0 && a != 7 && b !=7)
	                                   sum = sum + i * i;//???????
				   }
				}
			}
		}
         cout << sum << endl;
	}
    return 0;
}
int main()
{
	int n,a=0,m;
	scanf ("%d",&n);
	while (n>0)
	{
		if (n%7==0)
		{n--;continue;}
		if (n%10==7)
		{n--;continue;}
		else
		{m=n/10;}
		if (m%10==7)
		{n--;continue;}
		else 
		{a=n*n+a;n--;}
	}
	printf("%d\n",a);
	return 0;
}
int main(int argc, char* argv[])
{   int n,i,s=0;
    scanf ("%d",&n);
	for (i=1;i<=n;i++)
	{
		if(i%7==0)
		{ s=s+0;
		}
		else if (i/10==7)
		{ s=s+0;
		}
		else if( i%10==7)
		{ s=s+0;
		}
		else
		{ s=s+i*i;
		}
	}
	printf("%d",s);
	
	return 0;
}
int main()
   {
     int n,fh,a,b,sum;
     cin >>n;
     sum=0;
     for (int i=1;i<=n;i++)
       {  
         a=i;
         fh=1;
         if (a%7==0)  fh=0;
          do
            { 
               b=a % 10;
               a=a / 10;
               if (b==7) fh=0;
             }
          while (a>0);
         sum=sum+i*i*fh;
       }
      cout <<sum;
    return 0;
  }
int main()
{  
    int a[100][4] , i , j , n ,sum=0;
    scanf("%d",&n);
    for(i = 1 ; i <= n ; i ++ )
    { 
          a[i][2] = i % 10;  
     a[i][1] = (i -a[i][2]) / 10; 
       if( i < 7)
    {sum += i * i;}
      else if( (i % 7 == 0)|| (a[i][1] == 7)|| (a[i][2] == 7))
              { sum = sum;}
               else 
               {sum += i * i ;}
    } 
    printf("%d",sum);
    return 0;
  
}
int main()
{
	int n;
	int result;
	result = 0;
	scanf("%d",&n);
	while((n < 100) && (n > 0)){
		if((n % 7 == 0) || (n == 7) || (n == 17) || (n == 27) || (n == 37) || (n == 47) || (n == 57) || (n == 67) || (n == 77) || (n == 87) || (n == 97) || (n == 70)||(n == 71)||(n == 72)||(n == 73)||(n == 74)||(n == 75)||(n == 76)||(n == 77)||(n == 78)||(n == 79)){
			n = n - 1;
		}
		else{
			result = result + n * n;
				n = n - 1;
		}
	}
			printf("%d",result);
			return 0;
}
int yu7wuguan(int num);
int main(){
	int i,num;
	int 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 num){
		if(num%7==0||num/10==7||num%10==7){
			return 0;
		}
		return 1;

	}
int main()
{
	int n,g,s=0,i,S=0;
	scanf("%d",&n);
         if(n<100){
	for(i=1;i<=n;i++)
	{
		g=i%10;
		s=i/10;
		if(g!=7 && s!=7 && i%7!=0)
		{
			S+=pow(i,2);
		}
	}
        }
	printf("%d\n",S);
      return 0;
}
int main()
{
	int n,i,x,sum;
	int panduan(int);
	int jisuan(int);
	scanf("%d",&n);
	sum=0;
	for(i=1;i<=n;i++)
	{
		x=panduan(i);
		if(x==1)
		{
			sum=sum+jisuan(i);
		}
	}
	printf("%d\n",sum);
    return 0;
}
int panduan(int y)
{
	int z;
	if(y%7==0)
	{
		return 0;
	}
	else 
	{
		for(; ;)
		{
			z=y-10*(int)(y/10);
			if(z==7)
			{
				return 0;
			}
			y=(int)(y/10);
			if(y==0)
			{
				return 1;
			}
		}
	}
}
int jisuan(int y)
{
	int z;
	z=y*y;
	return(z);
}
void main()
{
	int i,n;
	long sum=0;
    scanf("%d",&n);
	for (i=1; i<=n; i++)
	{
		if ((7*floor(i/7)!=i) && (i%10 != 7) && (i/10 !=7) )
		
			sum=sum + i*i ;
	
		
	}
	printf("%d\n",sum);
}
int f(int a)
{
	if(a%7==0)
		return 0;
	else if(a>10 && a%10!=0 && (a%10)%7==0)
		return 0;
	else if(a>=70 && a<=79)
		return 0;
	else
		return 1;
}

int main()
{
	int n,i;
	long sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(f(i))
			sum=sum+i*i;
	}
	printf("%d\n",sum);
	return 0;
}
int main(int argc)
{   int i,n,s,a[100];
    cin>>n;        //????n
	i=1;
	while (i<=n)
	{ if (i>=70&&i<80||i%7==0||i%10==7)
	{a[i]=0;}
	else {a[i]=i;}      //??7??????
	i++;}
	i=1;
	s=0;
	while(i<=n)
	{  s=s+a[i]*a[i];
	i++;}        //????
	cout << s;

    
	return 0;
}
int main(int argc, char *argv[])
{
  int n,i,j,t,sum=0,flag=0;
  
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    {
      t=i;   
     for(j=1;j<=2;j++)
        {
         if(i%10==7)
           {
             flag=1;       
             break;
            } 
          else
           i=i/10;
       }
       i=t;    
      if(i%7!=0 && flag!=1)
        {
          sum=sum+i*i;
        }  
      flag=0;  
    }      
  printf("%d",sum);

  return 0;
}
void main()
{
	int a=0,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 )
		{
			continue;
		}
		a=i*i;
		c=c+a;
	}
	printf("%d\n",c);
}
int seven(int n)
{
    int s=1,b;
    int a[3];
    b=n-n/7*7;
    if(b==0) s=0;
    for(int i=0;i<=2;i++)
    {
            a[i]=n-n/10*10;
            n=n/10;
            if(a[i]==7) s=0;
            }
    return s;
}
int main()
{
    int x,sum=0;
    cin>>x;
    for(int i=1;i<=x;i++)
    {
               sum=sum+i*i*seven(i);
               }
    cout<<sum;
    return 0;
}
int main(){
int sum=0; 
int n,i;
    scanf("%d",&n);
for(i=1;i<=n;i++){
    if(i<7){
		sum+=i*i;
	}else if(i>=7){
	  if(i%7==0||(i-7)%10==0||i/10==7){
		continue;
	  }else{
		sum+=i*i;
	  }
	}
}
  printf("%d",sum);
  return 0;
}
/**
 * ? ? ???7???????.cpp    
 * ?    ?????             
 * ?????2010?10?15?      
 * ???????????????7???????
*/
int main()			      //???
{											    //?????
	int i = 0, sum = 0 , n;           //?????????
		cin>>n;                 //?????
	while( i < n )                      //????
	{
		i = i + 1;               //???i??
if ( i % 7 == 0 || ((0 <= (i-70)) && ((i-70) <= 9))||((i - floor(i/10)*10) == 7))                              //???????7??
		{continue;}         //??????????                
	    sum = sum + i*i;								//???7???????
	}
	cout<<sum<<endl;             //???7???????
	return 0;
}                                           //?????
//***********************************
//*????7????????1045? **
//*?????? 1200012945         **
//*???2012.10.8                 **
//***********************************

int main()                          
{                                         
	
	int i, sum, n;
	cin >> n;
	sum = 0;
	for (i = 1; i <= n; i++)
	{if (i % 7 !=0)
	if ((i - 7) % 10 != 0)
	if (i - 70 < 0 || i - 70 >= 10)
	sum = sum + i * i;}
	cout << sum << endl;
	return 0;                        

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

    
    
    
    
    }
int seven(int a)
{
    int mod;
    if (a%7==0)return 1;
    while(a>0)
    {mod=a%10;
    if(mod==7)return 1;
    a/=10;}
    return 0;
}
int main()
{
    int n,i;
    int sum=0;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    if(seven(i)!=1)sum=sum+i*i;
    PD(sum);
    return 0;
}
int main()
{   int n;
    cin>>n;
    int i;
    int sum=0,sum2=0;
    for(i=0;i<n+1;i++)
    {

        sum2=sum2+i*i;
        if((i%7==0)||(i>=70&&i<=79)||(i>10&&i%10==7))
        sum=sum+i*i;
    }
       cout<<sum2-sum;
    return 0;
}
int main()
{
    int i,s=0,k=0,n,b,c,a;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {k++;
     a=k%7 ;
     if(a!=0)
      {b=k/10;
       c=k-10*b;
       if(b!=7&&c!=7)
       s+=i*i;
      }
    }
    printf("%d",s);
    return 0;
}
int main()
{
	int if_k_is(int);
	int n;
	cin>>n;
	int sum=0;
	for(int k=1;k<=n;k++)
	{
		if(if_k_is(k))
			sum+=k*k;
	}
	cout<<sum<<endl;
	return 0;
}

int if_k_is(int k)
{
	if(k%7==0)
		return 0;
	while(k!=0)
	{
		if(k%10==7)
			return 0;
		k=k/10;
	}
	return 1;
}
int main()
{
    int n,i,sum=0;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
        if(i%7!=0&&(i-7)%10!=0&&((i-70)>9||(i-70)<0==1)==1)
        sum+=i*i;
        }
        printf("%d",sum);
        return 0;
        }
void main()
{
    int i,n,a[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		a[i-1]=i;
	for(i=0;i<n;i++)
	{
		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]==71||a[i]==72||a[i]==73||a[i]==74||a[i]==75||a[i]==76||a[i]==78||a[i]==79||a[i]==87||a[i]==97)
			a[i]=0;
	}
	int sum=0;
    for(i=0;i<n;i++)
	{
		sum=sum+a[i]*a[i];
	}
	printf("%d\n",sum);


}
int main()
{
	int n;
	scanf("%d", &n);
	int t=0, s=0, m=0;
	for(int i=1;i<=n;i++)
	{
		m=s=i;
		if(m%7==0)
		{
			t=t;
		}
		else
		{
			m/=10;
			if(m==7)
			{
				t=t;
			}
			else if((s-m*10)==7)
			{
				t=t;
			}
			else
			{
				t+=s*s;
			}
		}
	}
		printf("%d\n", t);
	    return 0;
}
int main()
{
	int n, i,a[100],sum=0;
	scanf("%d",&n);
    for(i=0; i<n; i++)
		a[i]=i+1;
	for(i=0; i<n; i++)
	{
		if(a[i]%7==0 || a[i]%10==7 || (int)a[i]/10==7)
			continue;
        sum += a[i] *a[i];
	}
	printf("%d",sum);
	return 0;
}
int yu7wuguan(int number);
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 yu7wuguan(int number){
if(number%7==0){
return 0;
}
if(number%10==7||number/10==7){return 0;}
return 1;
}
int N, Sum = 0;

int main()
{
	int i, f, x;
	scanf ("%d", &N);
	for (i = 1; i <= N; i ++)
	{
		if (i % 7 == 0) continue;
		x = i; f = 1;
		while (x > 0 && f)
		{
			if (x % 10 == 7) f = 0;
			x /= 10;
		}
		if (!f) continue;
		Sum += i * i;
	}
	printf ("%d\n", Sum);

	return 0;
}
main()
{
int n,i,s=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
if(i%7!=0&&i%10!=7&&i/10!=7)
s+=i*i;
printf("%d",s);
}
int main(){
int n,sum=0;
scanf("%d",&n);
for(int i=1;i<=n;i++){
if(i%7!=0&&(i-7)%10!=0&&i<70){
sum+=i*i;
}
else if(i%7!=0&&(i-7)%10!=0&&i>79){
sum+=i*i;
}
}
printf ("%d",sum);
return 0;
}
int main()
{
	int i,n,k1,k2,sum1=0,sum2=0,sum3=0,sum4=0,sum=0;
	scanf("%d",&n);
	if(n>=100) printf("error\n");
	else
	{
		for(i=1;i<=n;i++)
		{
			sum4=(int)(sum4+pow(i,2));
			if(i%7==0) sum1=(int)(sum1+pow(i,2));
			else
			{
				k1=i%10;
				if(k1==7) sum2=(int)(sum2+pow(i,2));
				else
				{
					k2=(i%100)/10;
					if(k2==7) sum3=(int)(sum3+pow(i,2));
				}
			}
		}
	}
	sum=sum4-(sum1+sum2+sum3);
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int i,c,n,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7!=0)
		{
			c=(i%100)/10;
			if(i%10!=7)
			{
				if(c!=7)
				{
					sum=sum+i*i;
				}
			}
		}
	}
	printf("%d",sum);
	return 0;
}
int yu7wuguan(int e);


int main(){
	int n;
	scanf("%d",&n);
	int i,result;
	result=0;
	for(i=1;i<=n;i++){
		if(yu7wuguan(i)){
				result+=i*i;
		}
	}

	printf("%d",result);

	return 0;
}

int yu7wuguan(int e){
	if(e%7==0){
		return 0;
	}
	while(e/10>=0&&e>0){
		int i;
		i=e%10;
		if(i==7){
			return 0;
		}
		e/=10;
	}
	return 1;
}
int main()
{
   int n,i,sum=0;
   cin>>n;
   for(i=1;i<n+1;i++)
   {
        if(i%7!=0)
        {
            if(i%10!=7)
             {
                 if((i/10)%10!=7)
                  {
                     sum=sum+i*i;
                   }
               }
         }
    }
    cout<<sum;
    return 0;
}
int main(int argc, char* argv[])
{
	int n,i,sum,c;n>1&&n<100;
	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;
}
int main()
{
  int n,sum=0,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
	  if((i%7!=0) && (((i+3)%10)!=0) && (i!=70)&&i!=71&&i!=72&&i!=73&&i!=74&&i!=75&&i!=76&&i!=77&&i!=78&&i!=79)
		  sum=sum+i*i;
  printf("%d",sum);
  return 0;
}
int main()
{
    int n,i,sum=0,shi,ge;
    cin>>n;
    shi=n/10;ge=n-10*shi;
    for(i=1;i<=n;i++)
    {
     shi=i/10;ge=i-10*shi;
     if(i%7!=0&&shi!=7&&ge!=7)
     sum=sum+i*i;               
    }    
    cout<<sum;
    return 0;
}
int main()
{
	int n=0,i=0,sum=0,b=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i<10)
		{
			if(i!=7)
			sum=sum+i*i;
		}
		else
		{
			b=i/10;
			if(i%10!=7&&i%7!=0&&b!=7)
				sum=sum+i*i;
		}
	}
	cout<<sum;
	return 0;
}
//?????,?????7??,????????????????????7,
//?????7????.????????n(n<100)??7??????????. 
int main()
{
	int n,i,a[100],sum=0;
	cin>>n;
	for (i=0;i<=n-1;i++)
	{
		a[i]=i+1;                                          //?????
		if (a[i]%7==0||a[i]/10==7||(a[i]-a[i]/10*10==7))   //?????7??
			a[i]=0;                                        //?????0
		sum+=a[i]*a[i];                                    //?????
	}
	cout<<sum<<endl;                                       //????
	return 0;
}
int t;
int fun(int n)
{
int x;
if (n % 7 == 0) return 0;
while (n >= 10){
x= n - n/10*10;
if (x == 7) return 0;
n=n/10;
}
if (n % 7 == 0) return 0;
return 1;
}

int main()
{
 int n;
 int i,s = 0;
 scanf("%d",&n);
 for (i = 1;i <= n;++i)
 {
// printf("i=%d %d\n",i,fun(i));
s = s + i*i*fun(i);    
 }
 printf("%d",s);
 return 0;
}
int main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
{
	if(i%7!=0)
	if(i%10!=7&&i/10%10!=7)
			sum+=i*i;
		}
		printf("%d",sum);
		getchar();
		getchar();
		return 0;
	}
int main ()
{
   int n,i,k=0;
   double a[100];
   cin>>n;
   for(i=1;i<=n;i++)
   {
    a[i]=i;
	if(i%7==0)
	{
	 a[i]=0;
	 continue;
	}
	else if(i%10==7)
	{
	 a[i]=0;
	 continue;
	}
	else if(i<=79&&i>=70)
	{
	 a[i]=0;
	 continue;
	}
   }
   for(i=1;i<=n;i++)
   
    k=k+pow(a[i],2);
   (int)k;
   cout<<k<<endl;
   return 0;
}
int main()
{
    int i, n, sum, sum1;

	sum = sum1 = 0;

	cin >> n;

	for ( i = 1; i <= n; i++)
	{
		if ( i % 7 == 0 || i % 10 == 7 || i / 10 == 7)
			
			sum = sum + i * i;
		
		else 
			
			sum = sum;

		sum1 = sum1 + i * i;
	}

		sum = sum1 - sum;

		cout << sum << endl;

		return 0;
}
/*
 * ?7???????.cpp
 * ?????
 * ????: 2010-11-16
 * ????7???????
 */

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

	for(i=1;i<=n;i++)
	{int a,b;//??a?b??????????????????????????
	 if(n>=7)
	  {if(i>10)
	   {b=i%10;
	    a=(i-b)/10;}
	   else
	   {a=0;b=i;}

	  if(i<7) sum=sum+i*i;
	  else
		{if(i%7!=0&&a!=7&&b!=7)
			sum=sum+i*i;}
	  }
	 else
		 sum=sum+i*i;
	 }
    cout<<sum;
	return 0;
}
int main()
{
	int n,i,a,sum=0;
	scanf("%d",&n);
	for (i=0;i<=n;i++){
		a=i%7;
		if (a==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==77||i==78||i==79)
		sum=sum;
		else
         sum=sum+i*i;
	}
	printf("%d",sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i=1,b=0;
	
	scanf("%d",&n);
	while(i<=n)
	{
		if(i!=17)
		if(i!=27)
		if(i!=37)
		if(i!=47)
		if(i!=57)
		if(i!=67)
		if(i!=87)
		if(i!=97)
		if(i!=71)
		if(i!=72)
		if(i!=73)
		if(i!=74)
		if(i!=75)
		if(i!=76)
		if(i!=78)
		if(i!=79)
		if(i%7!=0)
		b=b+i*i;
		i++;

	}
	
	
       printf("%d",b);
	   return 0;
}
int main()
{
	int a,j,n,k,b,sum;
	cin>>n;
	sum=0;
	for(j=1;j<=n;j++)
	{
		b=0;
		k=j;
		while(j>0)
		{
			a=j%10;
			j=j/10;
			if(a==7)
				b=1;
		}
		if(k%7==0)
			b=1;
		if(b==0)
			sum+=k*k;
		j=k;
	}
	cout << sum <<endl;
	return 0;
}
int main()
{
     int n,i,N;
	 N=0;
	 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)
	 continue;
	 N+=i*i;}
	 printf("%d",N);
	 return 0;
}
//****************************************
//*????7??????                        
//*?????? 1100012789      
//*???2011.10.01                       
//****************************************

int main()
{
	int n, sum = 0, i;       //sum?????i????
	cin >> n;
	for (i = 1; i <= n; i ++)
		if ( i % 7 != 0 && i / 10 != 7 && i % 10 != 7)     //????????????????????????
			sum = sum + i * i;                             //????
		cout << sum << endl;
		return 0;
}
int main()
{
	int n;
	int i=0;
	int cont=0;
	scanf("%d", &n);
	while(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) continue;
			cont=cont+i*i;
	}
	printf("%d", cont);
    return 0;
}
int main(){
int i,n;
int s=0;
scanf("%d", &n);
for(i=1;i<=n;i++){
	
	if(!(i%7==0||(i-7)%10==0||i/7==10||i==78||i==79||i==77)){
		s=s+i*i;
	}

}
printf("%d",s);
return 0;
}
/*
 * 111.cpp
 *
 *  Created on: 2010-11-13
 *      Author: dell
 *      ????7???????
 */


int main(){
	int i;
	int a[10000],b[10000],n,m=0;
	cin>>n;
	for(i=1;i<n+1;i++){
		a[i]=i;
		b[i]=i*i;
	}
	for(i=1;i<n+1;i++){
		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]-70<=9&&a[i]-70>=0))continue;
		else
			m=m+b[i];
	}
	cout<<m<<endl;
	    return 0;
}
int judge(int num)
{
	if(num%7==0) return 0;
	while(num>0)
	{
		if((num-7)%10==0) return 0;
		num/=10;
	}
	return 1;
}
void main()
{
    int i,num,sum=0;
	scanf("%d",&num);
	for(i=1;i<=num;i++)
		if(judge(i)==1) sum+=i*i;
	printf("%d\n",sum);
}
int main()
{ int leap(int n);
int n,sum=0,i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{ if(i%7!=0&&leap(i)) sum=sum+i*i;}
printf("%d\n",sum);
return 0;
}
int leap(int n)
{ int a,b,w;
a=n/10;
b=n%10;
if(a!=7&&b!=7) w=1;
if(a==7||b==7) w=0;
return w;
}
int main()
{    
	int a, n ,sum=0;
	 scanf("%d",&a);
	 for(n=1;n<=a;n++)
	 {
		 if(n%7==0)
			 sum=sum;

		 else if(n%10==7)
			 sum=sum;



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



}
int main ()
{
	int n, i = 0;
	int sum = 0;
    scanf("%d", &n);
	while(i <= n)
	{
		if(i % 7 == 0||(i + 3) % 10 == 0||i==70||i==71||i==72||i==73||i==74||i==75||i==76||i==77||i==78||i==79)
		{
			i++;
			continue;
		}
		sum = sum + i * i;
		i++;
	}
	printf("%d", sum);
	return 0;
}