"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    
    let fizzbuzz = [];
    
    for(let i=1; i<1000000; i++) {
        if(i % 3 === 0 && i % 5 === 0) {
            fizzbuzz.push(0);
        } else if(i % 3 === 0) {
            fizzbuzz.push(0);
        } else if(i % 5 === 0) {
            fizzbuzz.push(0);
        } else {
            fizzbuzz.push(i);
        }
    }
    
    //console.log(fizzbuzz);
    console.log(fizzbuzz.slice(0, N).reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));