import java.util.*;

public class Main {
    public static void main(String[] args)
    {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args)
    {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    }
} Main public static void main(String[] args)
    {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    } main {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    } Scanner scan1 = new Scanner(System.in); scan1 new Scanner(System.in) int length = scan1.nextInt(); length scan1.nextInt() scan1.nextInt scan1 int[] arr = new int[length]; arr new int[length] length long sum = 0; sum 0 for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            } int i = 1; int i = 1; i 1 i <= length i length i++ i++ i {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            } {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            } if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i; i%3 == 0 && i%5 == 0 i%3 == 0 i%3 i 3 0 i%5 == 0 i%5 i 5 0 arr[i-1] = 0 arr[i-1] arr i-1 i 1 0 if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i; i%3 == 0 || i % 5 == 0 i%3 == 0 i%3 i 3 0 i % 5 == 0 i % 5 i 5 0 arr[i-1] = 0 arr[i-1] arr i-1 i 1 0 arr[i-1] = i arr[i-1] arr i-1 i 1 i for (int j : arr )
            {
                sum += j;
            } int j arr {
                sum += j;
            } {
                sum += j;
            } sum += j sum j 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 scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String[] args)
    {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args)
    {
        Scanner scan1 = new Scanner(System.in);
        int length = scan1.nextInt();
        int[] arr = new int[length];
        long sum = 0;



            for (int i = 1; i <= length; i++)
            {
                if (i%3 == 0 && i%5 == 0)
                    arr[i-1] = 0;
                else if (i%3 == 0 || i % 5 == 0)
                    arr[i-1] = 0;
                else
                    arr[i-1] = i;
            }
            for (int j : arr )
            {
                sum += j;
            }
        System.out.println(sum);
    }
}
