import java.util.Scanner;
import java.math.BigInteger;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

} import java.util.Scanner; Scanner java.util import java.math.BigInteger; BigInteger java.math public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    } main {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in BigInteger sum = new BigInteger("0"); sum new BigInteger("0") for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        } {
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        } if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            } (i%3!=0)&&(i%5!=0) (i%3!=0) i%3 i 3 0 (i%5!=0) i%5 i 5 0 {
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            } BigInteger t = new BigInteger(String.valueOf(i)); t new BigInteger(String.valueOf(i)) sum = sum.add(t) sum sum.add(t) sum.add sum t System.out.print(sum) System.out.print System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

} Main
import java.util.Scanner;
import java.math.BigInteger;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        BigInteger sum = new BigInteger("0");
        for(int i = 1; i <= N; i++){
            if((i%3!=0)&&(i%5!=0)){
                BigInteger t = new BigInteger(String.valueOf(i));
                sum = sum.add(t);
            }
        }
        System.out.print(sum);
    }

}
