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