#include<stdio.h>

int main(){
 int N,i;
  scanf("%d",&N);
  
  unsigned int S;
  S = 0;
  for(i=1;i<=N;i++){
    if(i % 3==0 || i % 5==0){
      S = S;
    } else {
      S = S+i;
    }
  }
  printf("%u",S);
    
  
  return 0;
}