const Main = (input) => {
  const N = parseInt(input.trim())

  const NumArray = [...Array(N).keys()].map(n => n += 1)

  let result = 0

  NumArray.forEach((elem, i) => {
    if ((elem % 3 === 0 || elem % 5 === 0) === false) {
      result += parseInt(elem)
    }
  })

  console.log(result)
  return result
}


Main(require('fs').readFileSync('/dev/stdin', 'utf8'))