#include <stdio.h>
int main(void){
    int N, i, ans;
    
    ans = 0;
    scanf("%d", &N);
    
    for(i = 1; i <= N; i++){
        if(i%3 == 0 && i%5 == 0){
            //printf("FizzBuzz\n");
        }else if(i%3 == 0){
            //printf("Fizz\n");
        }else if(i%5 == 0){
            //printf("Buzz\n");
        }else{
            //printf("%d\n", i);
            ans = ans +i;
        }
        
        
    }
    
    printf("%d\n", ans);
    
}
