import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long count = 0; count 0 for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        } {
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        } int a = i; a i if(i%3==0 || i%5==0){
                a = 0;
            } i%3==0 || i%5==0 i%3==0 i%3 i 3 0 i%5==0 i%5 i 5 0 {
                a = 0;
            } a = 0 a 0 count += a count a System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long count = 0;

        for(int i=1;i<=N;i++){
            int a = i;
            if(i%3==0 || i%5==0){
                a = 0;
            }
            count += a;
        }
        System.out.println(count);
    }
}