function main(input) {
  const N = parseInt(input);

  let res = 0;

  for (let i = 1; i <= N; ++i) {
    const num = i % 3 === 0 || i % 5 === 0 ? 0 : i;

    res += num;
  }

  console.log(res);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

