#include <stdio.h>

int main(void) {
  int i,N,sum = 0;
  
  pritnf("enter the number.¥n");
  scanf("%d",&N);

  for(i=1;i<=N;i++) {
    if((i%3) != 0 || (i%5) != 0)
      sum += i;
  }
  
  printf("%d",sum);
  
  return 0;
}
