#include <stdio.h>
#include <stdlib.h>

int main(void){
  double output=0;
  int N;

  if(scanf("%d",&N) != 1){
    printf("*****SCANF ERROR*******\n");
    exit(1);
  }
  for(int i=1;i<=N;i++){
    if((i%3!=0) & (i%5!=0)) output+=(double)i;
  }
  printf("%f",output);
  
  return 0;
}