const main = (inputs) => {
  var num = inputs[0] - 0;
  var sum = 0;

  if (num < 15) {
    console.log(0);
    return false;
  }

  for (var i = 1; i < num; i++) {
    if (i % 3 == 0 || i % 5 == 0) {

    } else {
      sum = sum + i;
    }
  }

  console.log(sum);

}
main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));