#include<stdio.h>
void main(void)
{
  int n,i,a,b;
  long int total;
  total=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
  a=i%3;
  b=i%5;  
  if(a!=0&&b!=0)
  {
  total=total+i;
  }
  }
  printf("%ld",total);
}