#include<stdio.h>
int main(){
  int num,i ,sum =0;
  scanf("%d",&num);
  for(i=1;i<=num;i++){
    if(i%3==0 && i%5==0){
      sum = sum;
    }else if(i % 3 == 0){
      sum = sum;
    }else if(i % 5 ==0){
    sum = sum;
    }else{
    sum = sum + i;
    }
  }
  printf("%d",sum);
  return 0;
}