#include <stdio.h>

typedef struct node
{
     int prime;
     node* next;
}Node;

 

void main()
{
     Node *head=new Node;
     Node *tail=head;
     head->prime=2;
     head->next=NULL;

     int n;

     __int64 sum=2;

     scanf("%d",&n);

     for(int i=2;i<n;i++)

     {
          Node *temp=head;
          while(temp!=NULL)
          {
               if(i%temp->prime==0)
              {
                    break;
              }
              temp=temp->next;
          }
          if(temp==NULL)
          {
             Node *add=new Node;
             add->prime=i;
             sum+=i;
             add->next=NULL;
             tail->next=add;
             tail=add;
            }
  
      }
     printf("%d",sum);
}

 

졸라느리네 ㅉㅉ