import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashMap; HashMap java.util public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
} Main public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    } main {
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    } try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        } catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        } Exception e {
            System.out.println("KKKK "+e.getMessage());
        } System.out.println("KKKK "+e.getMessage()) System.out.println System.out System System.out "KKKK "+e.getMessage() "KKKK " e.getMessage() e.getMessage e {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) long  t=Long.parseLong(br.readLine()); t Long.parseLong(br.readLine()) Long.parseLong Long br.readLine() br.readLine br long p=t; p t while(p%5!=0){
                p--;
            } p%5!=0 p%5 p 5 0 {
                p--;
            } p-- p long k=p; k p p-=5 p 5 p=p/5 p p/5 p 5 p+=1 p 1 long sum1=((p)*(5+k))/2; sum1 ((p)*(5+k))/2 ((p)*(5+k)) (p) (5+k) 5 k 2 p=t p t while(p%3!=0){
                p--;
            } p%3!=0 p%3 p 3 0 {
                p--;
            } p-- p k=p k p p-=3 p 3 p=p/3 p p/3 p 3 p+=1 p 1 long sum2=((p)*(k+3))/2; sum2 ((p)*(k+3))/2 ((p)*(k+3)) (p) (k+3) k 3 2 p=t p t while(p%15!=0){
                p--;
            } p%15!=0 p%15 p 15 0 {
                p--;
            } p-- p k=p k p p-=15 p 15 p=p/15 p p/15 p 15 p+=1 p 1 long sum=((p)*(k+15))/2; sum ((p)*(k+15))/2 ((p)*(k+15)) (p) (k+15) k 15 2 long ans=((t)*(t+1))/2; ans ((t)*(t+1))/2 ((t)*(t+1)) (t) (t+1) t 1 2 ans-=(sum1+sum2-sum) ans (sum1+sum2-sum) sum1+sum2 sum1 sum2 sum System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
} public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
    public static void main(String[] args){
        try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            long  t=Long.parseLong(br.readLine());
            long p=t;
            while(p%5!=0){
                p--;
            }
            long k=p;
            p-=5;
            p=p/5;
            p+=1;
            long sum1=((p)*(5+k))/2;
            p=t;
            while(p%3!=0){
                p--;
            }
            k=p;
            p-=3;
            p=p/3;
            p+=1;
            long sum2=((p)*(k+3))/2;
            p=t;
            while(p%15!=0){
                p--;
            }
            k=p;
            p-=15;
            p=p/15;
            p+=1;
            long sum=((p)*(k+15))/2;
            long ans=((t)*(t+1))/2;
            ans-=(sum1+sum2-sum);
            System.out.println(ans);

        }catch(Exception e){
            System.out.println("KKKK "+e.getMessage());
        }
    }
}
