#!/bin/bash

read n
s=0
for i in $(seq 0 $(($n / 15 - 1))); do
    s=$(($s + ($i * 120) + 60))
done
for i in $(seq $((($n / 15) * 15)) $n); do
    if [ $((i % 3)) != 0 ]; then
        if [ $((i % 5)) != 0 ]; then
            s=$(($s + $i))
        fi
    fi
done
echo $s