function Main(input) {
    let index = input;
    let sum = 0
    while (index > 0) {
        if (index % 3 === 0 || index % 5 === 0) sum += index;
        index --
    }
    console.log(sum)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
