import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] arr = new int[N]; arr new int[N] N long sum=0; sum 0 for(int j=0; j<N; j++){
            arr[j]=j+1;
        } int j=0; int j=0; j 0 j<N j N j++ j++ j {
            arr[j]=j+1;
        } {
            arr[j]=j+1;
        } arr[j]=j+1 arr[j] arr j j+1 j 1 for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        } int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        } {
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        } if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            } (arr[i] % 3 ==0) || (arr[i] % 5 ==0) (arr[i] % 3 ==0) arr[i] % 3 arr[i] arr i 3 0 (arr[i] % 5 ==0) arr[i] % 5 arr[i] arr i 5 0 {
                arr[i]=0;
            } arr[i]=0 arr[i] arr i 0 {
                sum= sum + arr[i];
            } sum= sum + arr[i] sum sum + arr[i] sum arr[i] arr i 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);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    }
} public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int[] arr = new int[N];

        long sum=0;

        for(int j=0; j<N; j++){
            arr[j]=j+1;
        }

        for(int i = 0; i<N; i++){
            if ( (arr[i] % 3 ==0) || (arr[i] % 5 ==0)){
                arr[i]=0;
            }else{
                sum= sum + arr[i];
            }
        }
        System.out.println(sum);
    }
}