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