import java.util.Arrays;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    } main {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc long[] arr = new long[(int) n]; arr new long[(int) n] (int) n for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = i+1;
        } {
            arr[i] = i+1;
        } arr[i] = i+1 arr[i] arr i i+1 i 1 for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        } int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        } {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        } if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0; arr[i]%5==0 arr[i]%5 arr[i] arr i 5 0 arr[i] = 0 arr[i] arr i 0 if (arr[i]%3==0)
                arr[i] = 0; arr[i]%3==0 arr[i]%3 arr[i] arr i 3 0 arr[i] = 0 arr[i] arr i 0 long sum = Arrays.stream(arr).sum(); sum Arrays.stream(arr).sum() Arrays.stream(arr).sum Arrays.stream(arr) Arrays.stream Arrays arr System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    }
} Main
import java.util.Arrays;
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        long[] arr = new long[(int) n];

        for (int i = 0; i < n; i++) {
            arr[i] = i+1;
        }

        for (int i=0; i<arr.length; i++)
        {

             if (arr[i]%5==0)
                arr[i] = 0;

            else if (arr[i]%3==0)
                arr[i] = 0;

        }

        long sum = Arrays.stream(arr).sum();

        System.out.println(sum);


    }
}