import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
}
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
}
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
} Main public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
} main {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
} String[] lines = getStdin(); lines getStdin() getStdin String a = lines[0]; a lines[0] lines 0 int num = Integer.parseInt(a); num Integer.parseInt(a) Integer.parseInt Integer a long total = 0; total 0 for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    } int i = 1; int i = 1; i 1 i <= num i num i++ i++ i {
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    } {
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    } if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        } i % 3 == 0 && i % 5 == 0 i % 3 == 0 i % 3 i 3 0 i % 5 == 0 i % 5 i 5 0 {
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } String s = Integer.toString(i); s Integer.toString(i) Integer.toString Integer i s = "FizzBuzz" s "FizzBuzz" if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        } i % 3 == 0 i % 3 i 3 0 {
            String s = Integer.toString(i);
            s = "Fizz";
        } String s = Integer.toString(i); s Integer.toString(i) Integer.toString Integer i s = "Fizz" s "Fizz" if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        } i % 5 == 0 i % 5 i 5 0 {
            String s = Integer.toString(i);
            s = "Buzz";
        } String s = Integer.toString(i); s Integer.toString(i) Integer.toString Integer i s = "Buzz" s "Buzz" {
            total = total + i;
        } total = total + i total total + i total i System.out.println(total) System.out.println System.out System System.out total String[] args args private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  } getStdin {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) ArrayList<String> lines = new ArrayList<>(); lines new ArrayList<>() while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    } scanner.hasNext() scanner.hasNext scanner {
      lines.add(scanner.nextLine());
    } lines.add(scanner.nextLine()) lines.add lines scanner.nextLine() scanner.nextLine scanner return lines.toArray(new String[lines.size()]); lines.toArray(new String[lines.size()]) lines.toArray lines new String[lines.size()] lines.size() lines.size lines public class Main {
    public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
}
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
} public class Main {
    public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
}
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    String[] lines = getStdin();
    String a = lines[0];
    int num = Integer.parseInt(a);
    
    long total = 0;
    for (int i = 1; i <= num; i++){
        if (i % 3 == 0 && i % 5 == 0){
            String s = Integer.toString(i);
            s = "FizzBuzz";
        } else if (i % 3 == 0){
            String s = Integer.toString(i);
            s = "Fizz";
        } else if (i % 5 == 0){
            String s = Integer.toString(i);
            s = "Buzz";
        } else {
            total = total + i;
        }
    }
    System.out.println(total);
   
}
  
  private static String[] getStdin() {
    Scanner scanner = new Scanner(System.in);
    ArrayList<String> lines = new ArrayList<>();
    while (scanner.hasNext()) {
      lines.add(scanner.nextLine());
    }
    return lines.toArray(new String[lines.size()]);
  }
  
}