

import java.util.Scanner;

public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    }
} Main public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    } main {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    } Solution sol = new Solution(); sol new Solution() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long res = 0; res 0 for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        } {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        } if(i%3 != 0 && i%5 != 0) {
                res += i;
            } i%3 != 0 && i%5 != 0 i%3 != 0 i%3 i 3 0 i%5 != 0 i%5 i 5 0 {
                res += i;
            } res += i res i System.out.println(res) System.out.println System.out System System.out res sol.find() sol.find sol String[] args args static class Solution {
        public void find() {

        }

    } Solution public void find() {

        } find {

        } public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    }
} public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    }
} Main


import java.util.Scanner;

public class Main {
    static class Solution {
        public void find() {

        }

    }

    public static void main(String[] args) {
       Solution sol = new Solution();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long res = 0;
        for(int i=1; i<=n; i++) {
            if(i%3 != 0 && i%5 != 0) {
                res += i;
            }
        }
        System.out.println(res);
        sol.find();
    }
}
