#include <stdio.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007

#include <stdio.h>

int main (void) {
    unsigned int n, i;
    long sum = 0;

    scanf("%u", &n);

    for (i = 0; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) {
            // nop
        } else {
            sum += i;
        }
    }

    printf("%ld", sum);

    return 0;
}

