import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        sc.close();
        long M;
        long a = N/3;
        long b = N/5;
        long c = N/15;
        M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15);
        M = M/2;

        System.out.print(M);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        sc.close();
        long M;
        long a = N/3;
        long b = N/5;
        long c = N/15;
        M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15);
        M = M/2;

        System.out.print(M);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        sc.close();
        long M;
        long a = N/3;
        long b = N/5;
        long c = N/15;
        M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15);
        M = M/2;

        System.out.print(M);
    } main {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        sc.close();
        long M;
        long a = N/3;
        long b = N/5;
        long c = N/15;
        M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15);
        M = M/2;

        System.out.print(M);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long N = sc.nextInt(); N sc.nextInt() sc.nextInt sc sc.close() sc.close sc long M; M long a = N/3; a N/3 N 3 long b = N/5; b N/5 N 5 long c = N/15; c N/15 N 15 M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15) M (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15) (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5) (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5) (1+N)*N (1+N) 1 N N a*(a*3+3) a (a*3+3) a*3 a 3 3 b*(b*5+5) b (b*5+5) b*5 b 5 5 c*(c*15+15) c (c*15+15) c*15 c 15 15 M = M/2 M M/2 M 2 System.out.print(M) System.out.print System.out System System.out M String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        sc.close();
        long M;
        long a = N/3;
        long b = N/5;
        long c = N/15;
        M = (1+N)*N
        -a*(a*3+3)
        -b*(b*5+5)
        +c*(c*15+15);
        M = M/2;

        System.out.print(M);
    }
}