#include<stdio.h>
#include<stdlib.h>
int main(){
  //  int a;
    long long unsigned int a=0,x,total,total3,total5,total15;
   
    char s[10];
    // 整数の入力
  fgets(s,10,stdin);
  sscanf(s,"%llu\n",&a);
  total = ((1+a)*a/2);
  
  x = a/3;
//  printf("%llu ",total);
  total3 = ((3+3*x)*x/2);
  x=a/5;
 // printf("%llu ",total3);
  total5 = ((5+5*x)*x/2);
  x=a/15;
 // printf("%llu ",total5);
  total15 = ((15+15*x)*x/2);
  total = total - total3 - total5 + total15;
  printf("%llu",total);
  
}