jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
{
  type Print = void | string | number | string[] | number[];
  const outs: Print[] = [];
  const _io = (i = 0) => {
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const str = require("fs").readFileSync("/dev/stdin", "utf8");
    const lines = str.trim().split("\n");
    const s = () => lines[i++] || "";
    const n = () => Number(s());

    const mn = (v: string[]) => v.map(Number);
    const sp = (v: string) => v.split(" ");

    const ss = () => sp(s());
    const nn = () => mn(ss());
    const nls = () => mn(lines.slice(i));
    const nnls = () => lines.slice(i).map((v: string) => mn(sp(v)));

    return { lines, s, n, ss, nn, nls, nnls };
  };
  const main = (): Print => {
    const r = _io();
    const length = r.lines[0];
    const text = r.lines[1];
    // 以下入れ替え
    return checkDoubleString(length, text);
  };

  /**
   * check double of  a string
   *
   * @param length - the string length
   * @param text - the string
   * @returns "Yes" or "No"
   *
   */
  const checkDoubleString = (length: number, text: string): string => {
    // 奇数なら繰り返しできない
    if (length % 2 !== 0) {
      return "No";
    } else {
      const [frontText, backText] = [
        text.substr(0, length / 2),
        text.substr(length / 2, length / 2),
      ];
      if (frontText === backText) {
        return "Yes";
      }
      return "No";
    }
  };

  outs.push(main());

  console.log(
    outs
      .map((line) => (typeof line === "object" ? line.join(" ") : String(line)))
      .join("\n")
  );
}
//  [typescript]
{
  type Print = void | string | number | string[] | number[];
  const outs: Print[] = [];
  const _io = (i = 0) => {
    // eslint-disable-next-line @typescript-eslint/no-var-requires
    const str = require("fs").readFileSync("/dev/stdin", "utf8");
    const lines = str.trim().split("\n");
    const s = () => lines[i++] || "";
    const n = () => Number(s());

    const mn = (v: string[]) => v.map(Number);
    const sp = (v: string) => v.split(" ");

    const ss = () => sp(s());
    const nn = () => mn(ss());
    const nls = () => mn(lines.slice(i));
    const nnls = () => lines.slice(i).map((v: string) => mn(sp(v)));

    return { lines, s, n, ss, nn, nls, nnls };
  };
  const main = (): Print => {
    const r = _io();
    const length = r.lines[0];
    const text = r.lines[1];
    // 以下入れ替え
    return checkOnAirConditioner(length, text);
  };

  /**
   * check double of  a string
   *
   * @param length - the string length
   * @param text - the string
   * @returns "Yes" or "No"
   *
   */
  const checkOnAirConditioner = (length: number, text: string): string => {
    // 奇数なら繰り返しできない
    if (length % 2 !== 0) {
      return "No";
    } else {
      const [frontText, backText] = [
        text.substr(0, length / 2),
        text.substr(length / 2, length / 2),
      ];
      if (frontText === backText) {
        return "Yes";
      }
      return "No";
    }
  };

  outs.push(main());

  console.log(
    outs
      .map((line) => (typeof line === "object" ? line.join(" ") : String(line)))
      .join("\n")
  );
}
//  [typescript]
import * as fs from 'fs'

const reader = (data: string) => data.split('\n')

function Main(input) {
  const [n, S] = reader(input)
  const N = parseInt(n, 10)
  const num = N / 2

  if (N % 2 !== 0) {
    console.log('No')
    return
  }

  for (let i = 0; i < num; i++) {
    if (S[i] !== S[i + num]) {
      console.log('No')
      return
    }
  }

  console.log('Yes')
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))
//  [python]
import re
import doctest


class IO_for_Contest(object):
    @staticmethod
    def my_input():
        # return raw_input()
        return input()

    @staticmethod
    def read_from_input():
        n = IO_for_Contest.read_int()
        k = IO_for_Contest.read_int()
        x = IO_for_Contest.read_int()
        y = IO_for_Contest.read_int()
        return n, k, x, y

    @staticmethod
    def read_line():
        return IO_for_Contest.my_input().strip()

    @staticmethod
    def read_int():
        return int(IO_for_Contest.my_input().strip())

    @staticmethod
    def read_n_int(n):
        return list(map(
                    int,
                    re.split('\s+', IO_for_Contest.my_input().strip())))[: n]


def solve():
    buf = IO_for_Contest.read_from_input()
    n = buf[0]
    k = buf[1]
    x = buf[2]
    y = buf[3]
    if n <= k:
        print(x * n)
    else:
        rem = n - k
        print(x * k + y * rem)


if __name__ == '__main__':
    # doctest.testmod()
    solve()
//  [python]

n = int(raw_input())
k = int(raw_input())
p = int(raw_input())
q = int(raw_input())
print p * min(k,n) + max(n - k,0) *q
//  [python]
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap

#d = {1:2, 3:5, 6:10, 1000043:3814}
#zip(d.keys(), d.values())<<ap>>(list |c| sorted |c| reversed |c| list |c| print)



n = input()<<ap>>(int)
k = input()<<ap>>(int)
x = input()<<ap>>(int)
y = input()<<ap>>(int)

if n <= k:
    print(n*x);
else:
    print(k*x+(n-k)*y);
//  [java]
import java.util.Scanner;
public class Main {
		public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int k = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			System.out.println(Math.min(k,n) * x + Math.max(n - k, 0) * y);
			
		}

		

}
//  [java]
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			int n = sc.nextInt();
			int k = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			long sum = (long)(Math.min(k, n) * x) + (long)(y * (Math.max(n - k, 0)));
			System.out.println(sum);
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}
//  [java]
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);

        int n=scan.nextInt();
        int k=scan.nextInt();
        int x=scan.nextInt();
        int y=scan.nextInt();
        int sum=0;
        for(int i=0;i<n;i++){
            if(i<k)
                sum+=x;
            else
                sum+=y;
        }
        System.out.println(sum);

    }
}
//  [cpp]
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD (1e+9)+7
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(void){

    int N,K,X,Y;

    cin >> N >> K >> X >> Y;

    int ans;

    if(N - K >= 0){
        
        ans = K * X + (N-K) * Y;
        
    }else{

        ans = N * X;

    }

    cout << ans << endl;
    
}
//  [cpp]
#include <iostream>
using namespace std;

int main() {
  int n, k, x, y;
  int r = 0;
  cin >> n >> k >> x >> y;
  if (n>k) {
    r = k*x + (n-k)*y;
  } else {
    r = n*x;
  }
  cout << r << endl;
  return 0;
}
//  [cpp]
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <unordered_map> 
#include <iomanip>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
//#define int long long


//booooooooooooost
//#include <boost/multiprecision/cpp_int.hpp>
//#include <boost/multiprecision/cpp_dec_float.hpp>
//namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)



int inv_mod(int a, int m)
{
	int b, x, u, q, tmp;

	b = m; x = 1; u = 0;
	while (b > 0) {
		q = a / b;
		tmp = u; u = x - q * u; x = tmp;
		tmp = b; b = a - q * b; a = tmp;
	}

	return (x < 0) ? m + x : x;
}



signed main() {

	int N, K, X, Y;
	cin >> N >> K >> X >> Y;

	if(N - K >= 0) cout << K * X + (N - K) * Y << endl;
	else cout << N * X << endl;

	/*string w;
	cin >> w;
	vector<int> f;
	f.assign(26, 0);*/



	
	return 0;
}
//  [c]
#include<stdio.h>

int main(void) {
	unsigned int N, K, X, Y;
	unsigned int cost;

	scanf("%d", &N);		//全宿泊日数
	scanf("%d", &K);		//宿泊料金が安くなる前日までの日数
	scanf("%d", &X);		//通常の宿泊料金
	scanf("%d", &Y);		//安くなった後の宿泊料金

	
	if (N > K) {			//宿泊料金が安くなる日数よりも長く宿泊した場合
		cost = K * X + (N - K) * Y;			//通常の料金＋安くなった後の料金の合計を求める
	}
	//宿泊料金が安くなる日数より短く宿泊した場合
	else if (N <= K) {
		cost = N * X;						//通常の料金＊全宿泊日数で料金の合計を求める
	}
		
	printf("\n%d\n",cost);					

	return 0;
}
//  [c]

#include<stdio.h>
int main()
{
      int n,k,x,y,sum=0,i;
      scanf("%d%d%d%d",&n,&k,&x,&y);

      if(n<=k)
      {
           for(i=1;i<=n;i++)
      {
          sum+=x;
      }
      printf("%d\n",sum);
      }

      else
        {
           for(i=1;i<=k;i++)
      {
          sum+=x;
      }
            for(i=1;i<=n-k;i++)
        {
            sum+=y;
        }
        printf("%d\n",sum);
        }
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main()
{
    long N,K,X,Y,z,pro;
    scanf("%ld %ld %ld %ld",&N,&K,&X,&Y);
    if(K<=N)
    {
        z=K*X;
        pro=(N-K)*Y;
        printf("%ld\n",z+pro);
    }
   else{z=N*X;
        printf("%ld\n",z);
        }
    return 0;
}
//  [javascript]
function Main(input) {
	var line = input.split('\n');
	var N = parseInt(line[0], 10);
	var K = parseInt(line[1], 10);
	var X = parseInt(line[2], 10);
	var Y = parseInt(line[3], 10);
	var anser = 0;
	for(var i=0; i<N; i++){
		if(i < K){
			anser += X;
		}else{
			anser += Y;
		}
	}
	console.log(anser);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';

function main(input) {
  const inputs = input.split('\n').map((x) => x | 0);

  const N = inputs[0];
  const K = inputs[1];
  const X = inputs[2];
  const Y = inputs[3];

  let total = 0;
  for (let i = 1; i <= N; i++) {
    if (i <= K) {
      total += X;
    } else {
      total += Y;
    }
  }
  console.log(total);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input){
  var input=input.split('\n');
  var N=parseInt(input[0],10);
  var K=parseInt(input[1],10);
  var X=parseInt(input[2],10);
  var Y=parseInt(input[3],10);
  var payment=0;
  var daysForX=Math.min(K,N);
  var daysForY=Math.max(0,N-K);
  payment = X*daysForX+Y*daysForY;
  console.log(payment);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
//  [go]
package main

import "fmt"

func main() {
	var n, k, x, y int
	fmt.Scan(&n, &k, &x, &y)

	if n > k {
		fmt.Println(x*k + (n-k)*y)
	} else {
		fmt.Println(x * n)
	}
}
//  [go]
package main

import "fmt"

func main() {
	var n, k, x, y int
	fmt.Scan(&n, &k, &x, &y)
	if n <= k {
		fmt.Println(n * x)
	} else {
		fmt.Println((k * x) + ((n - k) * y))
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	value := make([]int, 4)

	for i := 0; i < len(value); i++ {
		fmt.Scan(&value[i])
	}
	//fmt.Printf("%d", value)

	ans := calc(value[0], value[1], value[2], value[3])

	fmt.Printf("%d", ans)
}

func calc(a, b, c, d int) int {
	if a < b {
		ans := a * c
		return ans
	}
	price1 := b * c
	price2 := (a - b) * d

	ans := price1 + price2
	return ans
}
//  [ruby]
input = readlines()

n = input.shift.chomp.to_i
k = input.shift.chomp.to_i
x = input.shift.chomp.to_i
y = input.shift.chomp.to_i

dx = n <= k ? n : k
dy = n > k ? n - k : 0

puts dx * x + dy * y
//  [ruby]
n,k,x,y = 4.times.map{gets.to_i}
ans=0
if n<=k
    ans=n*x
else
    ans=k*x+(n-k)*y
end
puts ans
//  [ruby]
n = gets.to_i
k = gets.to_i
x = gets.to_i
y = gets.to_i

ans = [n, k].min*x
ans += [n-k, 0].max*y

puts ans
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
        x: usize,
        y: usize
    };

    let mut ans = 0;

    for d in 0..n {
        if d < k {
            ans += x;
        } else {
            ans += y;
        }
    }
    println!("{}", ans);
}
//  [rust]
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        N: i32,
        K: i32,
        X: i32,
        Y: i32,
    }

    if N <= K {
        let ans = X * N;
        println!("{}", ans);
        return;
    }

    let ans = X * K + Y * (N - K);
    println!("{}", ans);
}
//  [rust]
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let n: usize = parse_line().unwrap();
    let k: usize = parse_line().unwrap();
    let x: usize = parse_line().unwrap();
    let y: usize = parse_line().unwrap();

    let mut price = n * x;
    if n > k {
        price -= (n - k) * (x - y);
    }
    println!("{}", price);
}
//  [swift]
extension String: CollectionType {} // splitを使うためのおまじない

let N: Int = Int(readLine()!)!
let K: Int = Int(readLine()!)!
let X: Int = Int(readLine()!)!
let Y: Int = Int(readLine()!)!
//let a: [Int] = readLine()!.split(" ").map { Int($0)! }
//print(a)
var ans: Int = X*min(N,K)
if N>K {
    ans+=(N-K)*Y
}
print(ans)
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);
  const K = Number(input[1][0]);
  const X = Number(input[2][0]);
  const Y = Number(input[3][0]);

  return Math.min(N, K) * X + Math.max(0, N - K) * Y;
};

console.log(main(read()));
//  [typescript]
import * as fs from 'fs';

const inputs = fs.readFileSync('/dev/stdin', 'utf8').split(/\n/);

const calcPrice = (n: number, k: number, x: number, y: number) => {
  const price = Math.min(k, n) * x + Math.max(0, n - k) * y;
  return price;
};

console.log(calcPrice(+inputs[0], +inputs[1], +inputs[2], +inputs[3]));
//  [typescript]
import * as fs from "fs";
 
let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
var n = parseInt(input[0]);
var k = parseInt(input[1]);
var x = parseInt(input[2]);
var y = parseInt(input[3]);
var result = 0;
if (n <= k) {
    result = x * n;
} else { 
    result = x * k + y * (n - k)
};

console.log(result);
//  [python]
def abc096_b():
    import numpy as np
    abc = list(map(int, input().split()))
    k = int(input())
    num = np.max(abc)
    argnum = np.argmax(abc)
    abc.remove(abc[argnum])

    return np.sum(abc) + num * (2 ** k)


print(abc096_b())
//  [python]
import numpy as np

a = list(map(int, input().split()))
k = int(input())

a[np.argmax(a)] = max(a) * (2 ** k)

print(sum(a))
//  [python]
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

a,b,c = map(int, input().split())
k = int(input())
sum_3 = a+b+c
n=a
if  n < b:
    n = b
if n < c:
    n = c
answer = n
for i in range(k):
    answer = answer * 2
answer = answer + sum_3 - n
print(answer)
//  [java]
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    //Split by '' and Convert String Array to Int Array
    int[] TARGET_NUMBERS = Stream.of(line.split(" ")).mapToInt(Integer::parseInt).toArray();
    int total = 0;

    line = sc.nextLine();
    //Split by '' and Convert String Array to Int Array
    int[] inputArray = Stream.of(line.split(" ")).mapToInt(Integer::parseInt).toArray();
    int numberOfTimes = inputArray[0];

    int max = 0;

    for (int i = 0; i< TARGET_NUMBERS.length;i++){
      max = Math.max(max, TARGET_NUMBERS[i]);
    }

    int power = max;
    for (int i = 0; i< numberOfTimes;i++){
      power = power*2;
    }

    total = TARGET_NUMBERS[0] + TARGET_NUMBERS[1] + TARGET_NUMBERS[2] + power - max;

    System.out.print(total);

  }
}
//  [java]
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	void solve(){
		long[]a= {gInt(),gInt(),gInt()};
		Arrays.sort(a);
		for(int i:rep(gInt()))
			a[2]*=2;
		System.out.println(a[0]+a[1]+a[2]);
	}
	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}
class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}

	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

}
//  [java]
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt(),B=sc.nextInt(),C=sc.nextInt();
		final int K=sc.nextInt();
		int k=1;
		for(int i=0;i<K;i++){
			k=k*2;
		}
		if(A>B){
			if(A>C){
				A=A*k;
			}else{
				C=C*k;
			}
		}else{
			if(B>C){
				B=B*k;
			}else{
				C=C*k;
			}
		}
		int ans=A+B+C;
		System.out.println(ans);
	}
}
//  [cpp]
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
  ll a,b,c,d,e=0,f=1,g;cin>>a>>b>>c>>d;
  e=max({a,b,c});
  g=e;
  f=a+b+c;
  rep(i,d)e*=2;
  cout<<f+e-g;
}
//  [cpp]
#include <iostream>
#include <vector>


int max(std::vector<int> num, int key, int n, int k){
    int sum_max = 0;
    num[key] *= 2;
    if(n==k){
        sum_max = num[0] + num[1] + num[2];
    }else{
        for(int i = 0; i<3; i++){
            int buff = max(num,i,n+1,k);
            if(buff>sum_max) sum_max = buff;
        }
    }
    return sum_max;
}

int max(std::vector<int> num, int k){
    int sum_max = 0;
    for(int i = 0; i<3; i++){
        int buff = max(num,i,1,k);
        if(buff>sum_max) sum_max = buff;
    }
    return sum_max;
}

int main(){
    std::vector<int> num(3);
    int k;
    std::cin >> num[0] >> num[1] >> num[2];
    std::cin >> k;

    std::cout << max(num,k) << std::endl;

    return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int a, b, c, k, i;
    
    scanf("%d%d%d",&a,&b,&c);
    scanf("%d",&k);
    
    if((a>=b)&&(a>=c)){
        for(i=0;i<k;i++) a=a*2;
    }
    else if((b>a)&&(b>=c)){
        for(i=0;i<k;i++) b=b*2;
    }
    else if((c>a)&&(c>b)){
        for(i=0;i<k;i++) c=c*2;
    }
    printf("%d\n",a+b+c);
    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>

int main(void){
    int x[4], i, index, max;
    int y=0;

    for(i=0; i<4; i++){
        scanf("%d", &x[i]);
    }
    index = 0; max = x[0];
    for(i=0; i<3; i++){
        if(max < x[i]){
            index = i;  max = x[i];
        }
        y = y + x[i];
    }
    y = y - x[index];
    y = y + x[index]*pow(2,x[3]);
    printf("%d\n", y);
    return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
  int a,b,c,k;
  scanf("%d%d%d%d",&a,&b,&c,&k);

  int max;
  if((a>b)&&(a>c))
    max = a;
  if((b>a)&&(b>c))
    max = b;
  if((c>a)&&(c>b))
    max = c;

  int i;
  for(i=0;i<k;i++){
    if((a>b)&&(a>c))
      a *= 2;
    if((b>a)&&(b>c))
      b *= 2;
    else
      c *= 2;
  }

  printf("%d\n",a+b+c);
  return 0;
}
//  [javascript]
function Main(input){
	input=input.split(/\n|\s/);
	input.forEach(function(e,i,a){a[i]=Number(a[i]);});
	function ArraySortNumeric(prev,next){return (prev - next);}
	var arr=[input[0],input[1],input[2]];
	arr.sort(ArraySortNumeric);
	
	arr[2]<<=input[3];
	
	console.log(arr[0]+arr[1]+arr[2]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(s) {
  s = s.split("\n");
  s[0] = s[0].split(" ").map(a => +a);
  s[1] = +s[1];
  var m = Math.max(...s[0]);
  console.log(s[0][0] + s[0][1] + s[0][2] + (m << s[1]) - m);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';

function main(input) {
  const arr = input.split('\n');
  const nums = arr[0];
  const k = parseInt(arr[1]);
  let vals = nums.split(' ').map(num => parseInt(num));

  for (let i = 0; i < k; i++) {
    vals = doubleMax(vals);
  }

  console.log(vals.reduce((prev, current) => prev + current));
}

function doubleMax(vals) {
  const result = [...vals];
  const max = Math.max(...vals);
  const index = result.indexOf(max);
  result[index] = max * 2;
  return result;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	// Code for B - Maximum Sum
	A := make([]int, 3)
	var K int
	fmt.Scanf("%d %d %d", &A[0], &A[1], &A[2])
	fmt.Scanf("%d", &K)

	sort.Sort(sort.IntSlice(A))
	fmt.Println(A[0] + A[1] + int(math.Pow(2, float64(K)))*A[2])
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x := iSScan(3)
	k := iScan()
	ans := max(x)
	for i := 0; i < k; i++ {
		ans *= 2
	}
	fmt.Println(ans + sum(x) - max(x))
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	c := nextInt()
	k := nextInt()

	m := max(a, max(b, c))

	fmt.Println(a + b + c - m + m<<k)

}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [ruby]
*a,n=`dd`.split.map(&:to_i)
m=a.max
p a.sum-m+m*2**n
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B, C = get_ints
K = get_int

test = [A, B, C].sort
max_value = test.last

puts max_value * (2 ** K) + test[0..1].sum
//  [ruby]
a,b,c = gets.strip.split.map(&:to_i)
k = gets.to_i
s = [a,b,c].sum-[a,b,c].max
puts s+[a,b,c].max*(2**k)
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize,
        k: usize,
    }

    println!("{}", (max(max(a,b),c) as i64) * (2_i64.pow(k as u32)-1) + ((a+b+c) as i64));

}
//  [rust]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		mut abc: [usize; 3],
		k: u32,
	}

	abc.sort();
	println!("{}", abc[0]+ abc[1] + abc[2] * 2usize.pow(k));
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

var nums = readIntSplit(by: " ")
let K = readInt()!
for _ in 0..<K {
    nums.sort()
    nums[2] *= 2
}
print(nums.reduce(0){$0+$1})
//  [swift]
//
//  main.swift
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func prime_factor(n: Int) -> [Int] {
    var ret: [Int] = []
    var k = n
    for i in 2..<Int(sqrt(Double(n)))+1 {
        while k % i == 0 {
            ret.append(i)
            k = Int(floor(Double(k / i)))
        }
    }
    
    if k != 1 {
        ret.append(k)
    }
    
    return ret
}

var A = readInts()
let K = readInt()
for _ in 0..<K {
    A = A.sorted()
    A[A.count-1] *= 2
}
print(A.reduce(0, +))
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T, T) { (args[0], args[1], args[2]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (a, b, c) = toTuple(readInts())
let k = Int(readLine()!)!
let m = max(max(a, b), c)
print(m * Int(pow(2.0, Double(k))) + a + b + c - m)
//  [typescript]
import { getMaxListeners } from 'cluster';

namespace sample {
  class Scanner {
    private buffer = '';
    private stdinQueue: any = [];

    constructor() {
      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdin.on(
        'data',
        (chunk): void => {
          this.buffer += chunk;
          while (this.stdinQueue.length > 0) {
            const i = this.buffer.indexOf('\n');
            if (i < 0) {
              break;
            }
            let line = this.buffer.substr(0, i);
            if (line.endsWith('\r')) {
              line = line.slice(0, -1);
            }
            this.buffer = this.buffer.substr(i + 1);
            this.stdinQueue.shift()(line);
          }
        },
      );
    }
    public getLine(): Promise<string> {
      return new Promise((resolve, reject) => {
        const i = this.buffer.indexOf('\n');
        if (i >= 0 && this.stdinQueue.length == 0) {
          let line = this.buffer.substr(0, i);
          if (line.endsWith('\r')) {
            line = line.slice(0, -1);
          }
          this.buffer = this.buffer.substr(i + 1);
          resolve(line);
        } else {
          this.stdinQueue.push(resolve);
        }
      });
    }

    public close(): void {
      process.stdin.pause();
    }
  }

  async function slove() {
    const sc = new Scanner();
    const [A, B, C] = (await sc.getLine()).split(' ').map((x) => +x);
    const K = +(await sc.getLine());
    let maxNum = Math.max(A, B, C);
    let ans = A + B + C - maxNum;
    for (let i = 0; i < K; i++) {
      maxNum *= 2;
    }
    ans += maxNum;
    console.log(ans);
    sc.close();
  }

  slove();
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B, C] = input[0].map(Number);
  const K = Number(input[1][0]);

  const max = Math.max(A, B, C);

  return max * 2 ** K + A + B + C - max;
};

console.log(main(read()));
//  [typescript]
import * as fs from 'fs';

namespace AtCoder.abc096 {
    export class Program {
        constructor(private readonly args: string[][]) {
        }

        main(this: Program) {
            const abc: number[] = this.args[0].map(Number);
            const abcSorted: number[] = abc.sort((a, b) => b - a);
            const [k]: number[] = this.args[1].map(Number);
            for (let i: number = 1; i <= k; i++) {
                abcSorted[0] = abcSorted[0] * 2;
            }

            const ans: number = abcSorted.reduce((acc: number, cur: number) => acc + cur, 0);
            console.log(ans);
        }
    }
}

const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(x => x.split(' '));
const prg: AtCoder.abc096.Program = new AtCoder.abc096.Program(args);
prg.main();
//  [python]
import numpy as np
import math

# primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163 ,167, 173, 179, 181, 191, 193, 197, 199]

N = int(input())

def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
        if num > 8:
            return 100
    return num

total = 0
for n in range(1, N+1):
    if n % 2 == 0:
        continue
    if num_divisors_trial_division(n) == 8:
        total +=1

print(total)
//  [python]
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# いっこ入力
n =int(input())

answer =0

for i in range(1,n+1):
    yakusuu = 0
    if i % 2 ==0:
        continue
    for j in range(1,n+1):
        if i % j == 0:
            yakusuu += 1
    if yakusuu == 8:
        answer += 1

print(answer)
//  [python]
import numpy as np

N = int(input())

if N < 105:
    print(0)
elif N == 105:
    print(1)
else:
    num = np.array([i for i in range(105, N+1, 2)])
    count = np.zeros(len(num))

    for i in range(1, N+1):
        mask = num % i == 0
        count += mask

    print(list(count).count(8))
//  [java]
import java.util.Scanner;
import java.util.stream.IntStream;


public class Main {
    public static void main(String[] args) {
        new Main().run();

    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        System.out.println(IntStream.rangeClosed(1,n).filter(i -> i%2 != 0).filter(i ->
            IntStream.rangeClosed(1,i).filter(i1 -> i % i1 == 0).count() == 8
        ).count());
    }

}
//  [java]
import java.util.*;
import java.util.stream.*;

class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		System.out.println(
				IntStream.range(1,s.nextInt()+1)
				.filter(i->i%2==1)
				.filter(i->IntStream.range(1,i+1)
						.filter(j->i%j==0)
						.count()==8)
				.count()
				);
	}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;


const ll MAX_PDEC=1000000;
vector<ll> D(MAX_PDEC);
void make_prime_list(){
    for(ll i=1;i<=1000000;i++)D[i]=i;
    for(ll i=2;i<=1000000;i++){
        for(ll j=i;j<=1000000;j+=i){
            D[j]=min(D[j],i);
        }
    }
}

void prime_decomposition(ll N,vector<int> &ans){
    ans.clear();
    ll v=N;
    while(v>1){
        ans.push_back(D[v]);
        v/=D[v];
    }
}

void ans2vecpair(vector<int> ans,vector<pii> &p){
    p.clear();
    for(int i=0;i<ans.size();i++){
        if(p.size()==0){
            p.push_back(make_pair(ans[i],1));
        }else if(p[p.size()-1].first==ans[i]){
            p[p.size()-1].second++;
        }else{
            p.push_back(make_pair(ans[i],1));
        }
    }
}

int main(){
    vi ans(0);
    vector<pii> p(0);
    make_prime_list();

    int N;cin>>N;
    int out=0;
    for(int i=1;i<=N;i+=2){
        prime_decomposition(i,ans);
        ans2vecpair(ans,p);
        int dcount=1;
        for(int j=0;j<p.size();j++){
            dcount*=p[j].second+1;
        }
        if(dcount==8)out++;
    }
    cout<<out<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int n;
  cin>>n;
  if(n<105){
    cout<<0<<endl;
    return 0;
  }
  int ans=1;
  for(int i=107;i<=n;i+=2){
    int cnt=1;
    for(int j=1;j<i;j++){
      if(i%j==0)cnt++;
    }
    if(cnt==8)ans++;
    // cout<<cnt<<endl;
  }
  cout<<ans<<endl;
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//numberが素数ならば1，そうでなければ0を返す関数
int primality(int number);

int main(void){
  int N;
  int i, j, k;
  int count = 0;

  scanf("%d", &N);

  for(i = 3; i <= N; i++){
    if(primality(i) == 1){
      if(((double) i) <= pow((double) N, 1.0/7.0)){
        count++;
      }
    }
  }

  for(i = 3; i <= N; i++){
    for(j = i+1; j <= N; j++){
      if(primality(i) == 1 && primality(j) == 1){
        if((i*j*j*j) <= N){
          count++;
        }
        if((i*i*i*j) <= N){
          count++;
        }
      }
    }
  }

  for(i = 3; i <= N; i++){
    for(j = i+1; j <= N; j++){
      for(k = j+1; k <= N; k++){
        if(primality(i) == 1 && primality(j) == 1 && primality(k) == 1){
          if((i*j*k) <= N){
            count++;
          }
        }
      }
    }
  }

  printf("%d\n", count);
  return 0;
}

int primality(int number){
  int i;

  if(number <= 1){
    return 0;
  }
  else{
    for(i = 2; i < number; i++){
      if(number%i == 0){
        return 0;
      }
    }
    return 1;
  }
}
//  [c]
 #include<stdio.h>
 int main(void)
 {
     int N;
     int i,j,k=0,l=0;

     scanf("%d",&N);

     for(i=1;i<=N;i++){
       for(j=1;j<=N;j++){
         if(i<j) break;
         else if((i%j==0)&&(i%2!=0)) k++;
       }
       if(k==8) { l++; k=0; }
       else k=0;
     }

     printf("%d\n",l);

     return 0;
 }
//  [javascript]
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var n = toInt(input[0]);
	var y = 0;
	var ans = 0;
	for(var i = 1; i <= n; i+=2){
		y = 0;
		for(var j = 1; j <= i; j++){
			if(i%j===0)y++;
			if(y>8) break;
		}
		if(y===8){
			ans++;
		}
	}

	console.log(ans);

}
//  [javascript]
// parameter "input" gets all data

function nbrDividor(n){
	var nbr=0;
	for (var i = 1; i <=n; i++) {
		if(n%i==0)
			nbr++;
	}
	return nbr;

}
function Main(input) {

	var a = parseInt(input, 10);
	var ans = 0;
	for (var i = 1; i <=a; i++) {
		if(nbrDividor(i)==8 && i%2==1){
			ans++;
		}
	}
	//output
	console.log('%d',ans);
}
// Don't edit this line!


Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0],10);
  let ans = 0;
  for (var n = 0; n <= N; n++) {
    if (n % 2 === 0) continue;
    let count = 0;
    for (var i = 1; i <= n; i++) {
      if (n % i === 0) {
        count++;
      }
    }
    if (count === 8) {
      ans++;
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"math"
)

var (
	a int
)


func main() {
	fmt.Scanf("%d\n",&a)

	count := 0
	for i:=3;i<=a;i+=2{
		if prime(i)==3 {
			count++
		}
	}
	fmt.Println(count)
}

func prime(a int) int {
	count:=0
	n := int(math.Sqrt(float64(a)))
	for i:=3;i<=n;i++{
		if a%i==0{
			count++
		}
	}
	return count
}

/* base -2 number
var (
	a rune
)


func main() {
	fmt.Scanf("%d\n",&a)
	n := 1
	var s string
	if a%2!=0 {
		s = "1"
		a = a-1
	} else {
		s = "0"
	}
	if a==0 {
		s ="0"
	} else {
		for a!=0 {
			if (a/rune(math.Pow(2,float64(n))))%2!=0 {
				s = fmt.Sprintf("1%s",s)
				a = a-rune(math.Pow(-2,float64(n)))

			} else {
				s = fmt.Sprintf("0%s",s)
			}
			n++
		}
	}
	fmt.Println(s)
}
*/
//  [go]
package main

import "fmt"

func main() {
	// Code for B - 105
	var N int
	fmt.Scanf("%d", &N)
	flag := make(map[int]int, N+1)

	for i := 1; i <= N; i++ {
		for j := 1; j <= N; j++ {
			if j%i == 0 {
				flag[j]++
			}
		}
	}

	var count int
	for i := 1; i <= N; i++ {
		if flag[i] == 8 && i%2 != 0 {
			count++
		}
	}

	fmt.Println(count)
}
//  [ruby]
require 'prime'

N = gets.to_i
h = {}
(1..N).each{|i|
	next if i % 2 == 0
  s = 1
  i.prime_division.map{|j| s *= j[1] + 1}
  h.key?(s) ? h[s] += 1 : h[s] = 1
}
if h[8].nil?
	puts 0
else
	puts h[8]
end
//  [ruby]
require 'prime'

a = gets.to_i
result = 0
(1..a).each do |b|
  next if b % 2 == 0
  next if Prime.instance.prime?(b)
  i = 0
  (1..b).each do |c|
    next if b % 2 == 0
    next if Prime.instance.prime?(b)
    i+=1 if b % c == 0
  end
  result+=1 if i == 8
end
puts result
//  [ruby]
require 'prime'
n = gets.chomp.split(' ').map(&:to_i)[0]
c = 0
for i in 1..n do
  if i.odd?
    s = 1
    qs = []
    Prime.prime_division(i).map { |l| qs << l[1] }
    qs.map { |q| s *= (q + 1) }
    c += 1 if s == 8
  end
end
puts c
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
  input!{
    N: i32
  }
  let mut ans:i32 = 0;
  for i in 1..(N+1) {
    let mut num:i32 = 0;
    for j in 1..(N+1) {
      if i%j == 0 {
          num += 1;
      }
    }
    if num == 8 && i%2 == 1 {
        ans += 1;
    }
  }
  println!("{}",ans);
}
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
    }

    let mut cnt = 0;
    let mut ans = 0;
    for j in 1..n+1 {
        if j%2==0 {
            continue;
        } else {
            for i in 1..n+1 {
                if j%i==0 {
                    cnt += 1;
                }
            }
            if cnt==8 {
                ans += 1;
            }
            cnt = 0;
        }
    }

    println!("{}", ans);

}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize
    }

    let mut ans = 0;
    for i in 1..=n {
        if i % 2 == 0 {
            continue;
        }

        let mut div_num = 0;
        for k in 1..=(i as f64).sqrt() as usize {
            if i % k == 0 {
                div_num += 1;
                if k != i / k {
                    div_num += 1;
                }
            }
        }
        if div_num == 8 {
            ans += 1;
        }
    }
    println!("{}", ans);
}
//  [swift]
let n = Int(readLine()!)!
if n < 105 { print(0) }
else if n == 105 { print(1) }
else {
  var ans = 1
  for i in 106...n {
    if i % 2 == 0 { continue }
    var count = 0
    for j in 1...i {
      if i % j == 0 { count += 1}
    }
    if count == 8 { ans += 1}
  }
  print(ans)
}