#include <stdio.h>
int main(void){
  int i,n,sum=0,a,b,c,diff1=0,diff2=0,plus=0;
  scanf("%d",&n);
  for(i=1; i<=n; i++)
    sum+=i;
  a = n/3;
  b = n/5;
  c = n/15;
  for(i=1; i<=a; i++)
    diff1 += i*3;
  sum -= diff1;
  
  for(i=1; i<=b; i++)
    diff2 += i*5;
  sum -= diff2;
  
  for(i=1; i<=c; i++)
    plus += i*15;
  sum += plus;
  
  printf("%d",sum);
  return 0;
}