#include <stdio.h>
int main(void){
    unsigned long i,j;
    unsigned long ret = 0;
    scanf("%lu",&i);
    for ( j = 1 ; j <= i ; j++){
        if ((j % 3 == 0 ) && (j % 5 == 0)) {
            ret = ret;//NA
        }else if (j % 3 == 0 ){
            ret = ret;//NA
        }else if(j % 5 == 0){
            ret = ret;//NA
        }else{
            ret = ret + j;
        }
    }
    printf("%lu\n",ret);
    return 0;
}
