#include<stdio.h>
#include<string.h>

int main(){
  int n,sum = 0;
  scanf("%d",&n);
  char a[n];
  for(int i =0;i <n;i++){
   if(i%5 == 0&&i%3==0){
      strcpy(&a[i],"FizzBuzz");
   }else if(i%5 == 0){
      strcpy(&a[i],"Fizz");
   }else if(i%3==0){
      strcpy(&a[i],"Buzz");
   }else{
    sum += i;
   }
  }
    printf("%d",sum);
}
    
