jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
const main: number = (input) => {
  const input = input.split("\n");
  const N = parseInt([0], 10);
  const K = parseInt([1], 10);
  const X = parseInt([2], 10);
  const Y = parseInt([3], 10);
  
  if (N>K) {
      console.log(K*X+(N-K)*Y);
  }else{
    console.log(N*X);
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main: number = (input) => {
  const input = input.split("\n");
  const N = parseInt([0], 10);
  const K = parseInt([1], 10);
  const X = parseInt([2], 10);
  const Y = parseInt([3], 10);
  
  if (N > K) {
      console.log(K * X + (N - K) * Y);
  }else{
    console.log(N * X);
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main: number = (input) => {
  const input = input.split('\n');
  const N = parseInt([0], 10);
  const K = parseInt([1], 10);
  const X = parseInt([2], 10);
  const Y = parseInt([3], 10);
  
  if (N > K) {
      console.log(K * X + (N - K) * Y);
  }else{
    console.log(N * X);
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
a, b, c = map(int, input().split())
k = int(input())

print(max([a, b, c]) * (2 ** k - 1) + sum([a ,b ,c]))
//  [python]
abc = list(map(int, input().split()))
k = int(input())
ans = sum(abc)
ans += max(abc) * 2 ** k - max(abc)
print(ans)
//  [python]
l = list(map(int, input().split()))
n = int(input())

print(max(l) * 2 ** n + sum(l) - max(l))
//  [python]
def answer(a: int, b: int, c: int, k: int) -> int:
    nums = sorted((a, b, c))
    nums[-1] = nums[-1] * 2 * k

    return sum(nums)


def main():
    a, b, c = map(int, input().split())
    k = int(input())
    print(answer(a, b, c, k))


if __name__ == '__main__':
    main()
//  [python]
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) + max(a) * (2 ** (k - 1)))
//  [python]
a = [int(x) for x in input().split()]
k = int(input())
print(sum(a) + max(a) * (2 ** (K - 1)))
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line[] = br.readLine().split(" ");
        int a = Integer.parseInt(line[0]);
        int b = Integer.parseInt(line[1]);
        int c = Integer.parseInt(line[2]);
        int k = Integer.parseInt(br.readLine());
        
        for (int i = 0; i < k; i++) {
            if (a >= b && a >= c) a = a * 2;
            else if (b >= a && b >= c) b = b * 2;
            else if (c >= a && c >= b) c = c * 2;
        }
        System.out.println(a + b + c);
    }
}
//  [java]
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
	    int a = in.readInt();
	    int b = in.readInt(); 
	    int c = in.readInt();
	    int x = in.readInt();
	    
	    System.out.println(a+b+c+Math.max(Math.max(a, b), c) * ((1<<x) -1));
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
//  [java]
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            list.add(sc.nextInt());
        }
        int k = sc.nextInt();
        int max = Collections.max(list);
        for (int i = 0; i < k; i++) {
            max *= 2;
        }
        max += list.get(0);
        max += list.get(1);
        System.out.println(max);
    }
}
//  [java]
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();

    int max = Math.max(Math.max(a, b), c);

    System.out.println(a + b + c + (max * (int) Math.pow(2, k - 1)));

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A[] = new int[3];
		A[0] = sc.nextInt();
		A[1] = sc.nextInt();
		A[2] = sc.nextInt();
		int K = sc.nextInt();
		Arrays.parallelSort(A);
		System.out.println(A[0]+A[1]+A[2]*Math.pow(2, K));
	}
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-18
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=tmp*10+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll tmp=1; for(;b;b>>=1){if(b&1)tmp=tmp*a%mod; a=a*a%mod;} return tmp;}
using namespace std;
int main()
{
	ll a=read(),b=read(),c=read(),k=read();
	if(a>b&&a>c)printf("%lld\n",(1<<k)*a+b+c);
	else if(b>c)printf("%lld\n",a+(1<<k)*b+c);
	else printf("%lld\n",a+b+(1<<k)*c);
	return 0;
}
//  [cpp]
#include<stdio.h>

int main(void){
  int a, b, c;
  int i, n;
  int max, sum;

  scanf("%d%d%d%d", &a, &b, &c, &n);

  sum = a + b + c;

  if(a>=b){
    if(a>=c){
      max = a;
    }else{
      max = c;
    }
  }else{
    if(b>=c){
      max = b;
    }else{
      max = c;
    }
  }

  for(i=0; i<n; i++){
    sum += max;
    max *= 2;
  }

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

  return 0;
}
//  [cpp]
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,c,mx,sum,k,i,mx2;
	scanf("%d %d %d",&a,&b,&c);
	scanf("%d",&k);
	mx=a;
	mx=max(mx,b);
	mx=max(mx,c);
	sum=a+b+c;
	mx2=mx;
	for(i=0;i<k;i++)	{
	mx2=mx2*2;
	}
	sum=sum-mx+mx2;
	printf("%d\n",sum);
	return 0;
 }
//  [cpp]
#include <bits/stdc++.h>
 
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ii pair<int,int>
#define qu queue <int>
#define qmax priority_queue <int>
#define qmin priority_queue <int, vector<int>,greater<int>>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b, c, k, maxi, top=100000,result;
    cin>>a>>b>>c>>k;

    maxi = max({a,b,c});

    for(int i=0; i<k;i++){
        result = (maxi * (2*k)) + ((a+b+c) - maxi);

        if(top > result)
            top = result; 
    }

    cout<<top<<endl;

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
 
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ii pair<int,int>
#define qu queue <int>
#define qmax priority_queue <int>
#define qmin priority_queue <int, vector<int>,greater<int>>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b, c, k, maxi, top=-1,result;
    cin>>a>>b>>c>>k;

    maxi = max({a,b,c});

    for(int i=0; i<k;i++){
        result = (maxi * (2*k)) + ((a+b+c) - maxi);

        if(top < result)
            top = result; 
    }

    cout<<top<<endl;

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int n = max(A, max(B, C));
  if (n == A) A = 0;
  if (n == B) B = 0;
  if (n == C) C = 0;
  int ans = n;
  for (int i = 0; i < K; i++) {
    ans *= 2;
  }
  cout << ans + A + B + C << endl;
}
//  [c]
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;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 SREP(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int k;
	scanf("%d", &k);
	if (b < c)Swap(&b, &c);
	if (a < b)Swap(&a, &b);
	REP(i, k)a *= 2;
	PRINTD(a+b+c);
}
//  [c]
#include <stdio.h>

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

int main()
{
	int a,b,c,k,i,max,res;
	
	scanf("%d %d %d", &a,&b,&c);
	scanf("%d", &k);
	
	max = (a>b)? ((c>a)? c:a):((c>b)? c:b);
	res = a+b+c-max;
	
	for(i=0; i < k; i++) max *= 2;
	res += max;
	
	printf("%d\n", res);
	return 0;
}
//  [c]
#include<stdio.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] + x[index]*2*(x[3]);
    printf("%d\n", y);
    return 0;
}
//  [c]
#include<stdio.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]*(x[3]-1);
    printf("%d\n", y);
    return 0;
}
//  [javascript]
"use strict";
function main(input) {
  const args = input.split('\n');
  const vars = args[0].split(' ');
  let a = parseInt(vars[0], 10);
  let b = parseInt(vars[1], 10);
  let c = parseInt(vars[2], 10);
  const k = parseInt(args[1], 10);
  for (let i = 0; i < k; i++) {
    if (a > b && a > c) {
      a *= 2;
    } else if (b > a && b > c) {
      b *= 2;
    } else {
      c *= 2;
    }
  }
  console.log(a + b + c);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {

	input = input.split("\n");
	var k = Math.pow(2,Number(input[1]));
	
	input = input[0].split(" ");
	
	input.sort(function(a,b){
		if(Number(a)<Number(b))return -1;
		if(Number(a)>Number(b))return 1;
		return 0;
	});
	
	var a = Number(input[0]);
	var b = Number(input[1]);
	var c = Number(input[2]);
	
	var ret = a + b + c * k;
	console.log(ret);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'
 
function Main(input) {
	const ipts = input.split('\n');
	const A = Number(ipts[0].split(' ')[0]);
	const B = Number(ipts[0].split(' ')[1]);
	const C = Number(ipts[0].split(' ')[2]);
	const K = Number(ipts[1]);
	let answer = 0;
	
	answer = Math.max(A, B, C) *  Math.pow(2, K) + A + B + C - Math.max(A, B, C);
	
	console.log(answer);
 
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  input=input.trim();
  const a = parseInt(input.split(" ")[0], 10);
  const b = parseInt(input.split(" ")[1], 10);
  const c = parseInt(input.split(" ")[2], 10);
  const x = parseInt(input.split("\n")[1], 10);
  console.log(Math.max.apply(null,[a,b,c])*Math.pow(2,x));

  

}


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

import (
	. "fmt"
    . "math"
)

// func init() { Println("----------------------------------------") }

func main() {
    var a, b, c, k int
    Scanf("%d %d %d", &a, &b, &c)
    Scanf("%d", &k)

    max := int(Max(float64(a), Max(float64(b), float64(c))))
    ans := a + b + c - max

    for i := 0; i < k; i++ {
        max *= 2
    }
    Println(ans + max)
}
//  [go]
package main

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

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c, &k)

	x := []int{a, b, c}
	sort.Ints(x)
	fmt.Println(int(math.Pow(2, float64(k)))*x[2] + x[0] + x[1])
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, C int
	var K float64
	fmt.Scanf("%d %d %d", &A, &B, &C)
	fmt.Scan(&K)

	if A > B && A > C {
		A *= int(math.Pow(2, K))
		fmt.Println(A)
	} else if B > C {
		B *= int(math.Pow(2, K))
	} else {
		C *= int(math.Pow(2, K))
	}
}
//  [go]
package main

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

// maxInt はint型のスライスの最大値を返す関数
func maxInt(a []int) int {
	sort.Sort(sort.IntSlice(a))
	return a[len(a)-1]
}

func main() {
	var n1, n2, n3 int
	var num int

	fmt.Scanf("%d %d %d", &n1, &n2, &n3)
	fmt.Scanf("%d", &num)

	fmt.Println(n1 + n2 + n3*int(math.Pow(float64(2), float64(num))))
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

// maxInt はint型のスライスの最大値を返す関数
func maxInt(a []int) int {
	sort.Sort(sort.IntSlice(a))
	return a[len(a)-1]
}

func main() {
	var n1, n2, n3 int
	var num int

	fmt.Scanf("%d %d %d", &n1, &n2, &n3)
	fmt.Scanf("%d", &num)

	fmt.Println(n1 + n2 + n3 + num*maxInt([]int{n1, n2, n3}))
}
//  [ruby]
# frozen_string_literal: true

a, b, c = gets.split.map(&:to_i).sort
k = gets.to_i

puts a + b + 2**k * c
//  [ruby]
abc = gets.chomp.split(' ').map(&:to_i)
k = gets.chomp.to_i
puts abc.max * (2 ** k) + abc.min(2).inject(:+)
//  [ruby]
# https://atcoder.jp/contests/abc096/tasks/abc096_b



A, B, C = gets.split.map(&:to_i).sort
K = gets.to_i

puts A + B + C * (2 ** K)
//  [ruby]
ary = gets.split.map(&:to_i).sort
k = gets.to_i
k.times do
  a[2] *= 2
end
puts a.inject(:+)
//  [ruby]
ary = gets.split.map(&:to_i)
k = gets.to_i
max = ary.max
k.times do
  max*=2
end
ary.delete(ary.max)
ary.each do |i| max+=i end
puts max
//  [ruby]
ary = gets.split.map(&:to_i)
k = gets.to_i
max = ((ary.max)*k*2)
ary.delete(ary.max)
ary.each do |i| max+=i end
puts max
//  [rust]
use text_io::*;
use std::cmp::*;

fn main() {
    let a: i32 = read!();
    let b: i32 = read!();
    let c: i32 = read!();
    let d: u32 = read!();
    let e: i32 = max(a,max(b,c));
    println!("{}",a+b+c-e+e*2_i32.pow(d))
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<t: FromStr>() -> t {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let k: usize = read();
    let maxv = max(a, max(b, c));

    let mut ans = a + b + c;
    let mut kmaxv = maxv;
    let mut cnt = 0;

    while cnt < k {
        cnt += 1;
        kmaxv *= 2;
    }
    ans += kmaxv;
    println!("{}", ans - maxv);
}
//  [rust]
use std::io;
use std::cmp::max;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let mut a = v[0];
	let mut b = v[1];
	let mut c = v[2];
	let mut ret = 0;
	let v:Vec<i32> = procon_read();
	let k = v[0];
	for i in 0..k {
		ret = max(max(2*a+b+c, a+2*b+c), a+b+2*c);
		if ret == 2*a+b+c {
			a = 2*a;
		}else if ret == a+2*b+c {
			b = 2*b;
		}else{
			c = 2*c;
		}
	}
	println!("{}", ret);
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{
        a: usize, b: usize, c: usize, k: usize,
    }

    let v = vec![a, b, c];
    let max = v.iter().max().unwrap();
    let others_sum = v
                            .iter()
                            .filter(|x| *x != max)
                            .sum::<usize>();
    println!("{}", max * 2usize.pow(k as u32) + others_sum);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        abc: [u32;3],
        k: u32,
    }
    let mx = abc.iter().max().unwrap();
    println!("{}",
        abc.iter().sum::<u32>() - mx + mx * 2 * k);
}
//  [rust]
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"5 3 11
1"# => r#"30"#,

r#"3 3 4
2"# => r#"22"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        mut abc: [u64; 3],
        k: u64,
    }
    abc.sort();
    (abc[0] + abc[1] + abc[2] * (2 * k)).to_string()
}
//  [swift]
import Foundation
 
let abc = readLine()!.componentsSeparatedByString(" ")
let k = Int(readLine()!)!
let a = Int(abc[0])!
let b = Int(abc[1])!
let c = Int(abc[2])!
 
var m = max(a, b, c)
var m2: Int = m
for i in 0..<k {
    m2 *= 2
}
 
var m3: Int = 0
if m == a {
    m3 = m2 + b + c
} else if m == b {
    m3 = m2 + a + c
} else if m == c {
    m3 = m2 + a + b
}
 
print("\(m3)")
//  [swift]
import Foundation

let line = readLine()!
let numbers = line.componentsSeparatedByString(" ")

var first = Int(numbers[0])!
var second = Int(numbers[1])!
var third = Int(numbers[2])!

let count = Int(readLine()!)!

for _ in 0..<count {
    if first >= second && first >= third {
        first = first * 2
    } else if second >= first && second >= third {
        second = second * 2
    } else if third >= first && third >= second {
        third = third * 2
    }
}

print("\(first + second + third)")
//  [swift]
import Foundation

main()

func main() {
    let abc = readLine()!.split(separator: " ").map { Int($0)! }
    let k = Double(readLine()!)!
    let sorted = abc.sorted()
    let ans = sorted.reduce(sorted.last! * (Int(pow(2.0, k)) - 1), +)
    print(ans)
}
//  [swift]
import Foundation

let allLines = readLine()!
let count = Int(allLines.components(separatedBy: "\n")[1])!
let numbers = allLines.components(separatedBy: "\n")[0].components(separatedBy: " ")

var first = Int(numbers[0])!
var second = Int(numbers[1])!
var third = Int(numbers[2])!

for _ in 0..<count {
    if first >= second && first >= third {
        first = first * 2
    } else if second >= first && second >= third {
        second = second * 2
    } else if third >= first && third >= second {
        third = third * 2
    }
}

print("\(first + second + third)")
//  [swift]
import Foundation
 
let abc = readLine()!.componentsSeparatedByString(" ")
let k = Int(readLine()!)!
let a = Int(abc[0])!
let b = Int(abc[1])!
let c = Int(abc[2])!
 
var m = max(a, b, c)
var m2: Int = 0
for i in 0..<k {
    m2 = m * 2
}
 
var m3: Int = 0
if m == a {
    m3 = m2 + b + c
} else if m == b {
    m3 = m2 + a + c
} else if m == c {
    m3 = m2 + a + b
}
 
print("\(m3)")
//  [swift]
import Foundation

let abc = readLine()!. componentsSeparatedByString(" ")
let k = Int(readLine()!)!
let a = Int(abc[0])!
let b = Int(abc[1])!
let c = Int(abc[2])!

var m = max(a, b, c)
var m2: Int = 0
for i in 0..<k {
    m2 = m * 2
}

var m3: Int = 0
if m == a {
    m3 = m2 + b + c
} else if m == b {
    m3 = m2 + a + c
} else if m == c {
    m3 = m2 + a + b
}

print("\(m3)")
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};
const main=()=>{
  let a=tnn(3)
  let k=tn()
  let m=a.indexOf(Math.max(null,...a))
  for(let i=0;i<k;i++){
    a[m]*=2
  }
  to(a.reduce((a,x) => a+=x,0))
}
main()
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [a, b, c] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const k = Number(stdin.split('\n')[1])

const ans = _ => {
  const nums = [a, b, c]

  nums.sort((a, b) => b - a)

  nums[0] *= 2 ** k

  return nums.reduce((p, c) => p + c)
}

console.log(ans())
//  [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 [k]: number[] = this.args[1].map(Number);
            const max: number = Math.max(...abc);
            const shifted: number = (max << k) - max;
            const ans: number = abc.reduce((acc: number, cur: number) => acc + cur) + shifted;

            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();
//  [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 [k]: number[] = this.args[1].map(Number);
            const max: number = Math.max(...abc);
            const shifted: number = max << k - 1;
            const ans: number = abc.reduce((acc: number, cur: number) => acc + cur) + shifted;

            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();
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [a, b, c] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const k = Number(stdin.split('\n')[1])

const ans = _ => {
  const nums = [a, b, c]

  nums.sort((a, b) => b - a)

  nums[0] *= 2 * k

  return nums.reduce((p, c) => p + c)
}

console.log(ans())
//  [python]
n=int(input())

table = [105,135,165,189,195]

print(sum([1 for x  in table if x <= n]))
//  [python]
n = int(input())
if n < 105:
    print(0)
elif n < 135:
    print(1)
elif n < 165:
    print(2)
elif n < 189:
    print(3)
elif n < 195:
    print(4)
else:
    print(5)
//  [python]
#! usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    n = int(input())

    ans = 0
    for i in range(1, n+1):
        if i % 2 == 0:
            continue
        div = []
        j = 1
        while j * j <= i:
            if i % j == 0:
                if i // j != j:
                    div.append(j)
                    div.append(i//j)
                else:
                    div.append(j)
            j += 1

        if len(div) == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
//  [python]
n = int(input())
if n < 105:
  print(0)
elif n < 165:
  print(1)
elif n < 195:
  print(2)
else:
  print(3)
//  [python]
import sys
import sympy

ans = 0
for i in range(1, int(input())+1):
    ans += 1 if i%2==1 and len(sympy.divisors(i)) == 8 else 0
print(ans)
//  [python]
N = int(input())

def make_divisor(n):
    divisors = []
    for i in range(1, int(n**.5) + 1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

for i in range(1, N+1):
    if len(make_divisor(i)) == 8 and  i%2 == 1:
        print(i)
        exit()
print(0)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            int n = Integer.parseInt(br.readLine());
            int ans = 0;
            for (int i = 1; i <= n; i = i + 2) {
                int count = 0;
                for (int j = 1; j <= i; j++) {
                    if (i % j == 0) {
                        count++;
                    }
                }
                if (count == 8) {
                    ans++;
                }
            }
            System.out.println(ans);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
//  [java]
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n =  Integer.parseInt(br.readLine());
        int count = 0;
        int ans = 0;
        
        for (int i = 1; i <= n; i++) {
            if (i%2==0) continue;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0) count++;
            }
            
            if (count == 8) ans++;
            count = 0;
        }
        System.out.println(ans);
    }
    
    
}
//  [java]


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main{

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n=sc.nextInt();
		boolean[] aa = new boolean[201];
		for(int i=0;i<201;i++){
			aa[i]=printDivisors(i);
//			System.out.println(aa[i]+" "+i);
			}
		int cnt=0;
		for(int i=1;i<=n;i+=2)if(aa[i])cnt++;
		System.out.println(cnt);
	}
	static boolean printDivisors(int n)
    {
		int cnt=0;
        for (int i=1;i<=n;i++)
            if (n%i==0)
                cnt++;
        return cnt==8;
    }

}
//  [java]


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        int res = 0;
        for (int i = 1; i <= n; i++) {
            if (divisors(i) == 8) {
                res++;
            }
        }
        System.out.println(res);
    }

    private static int divisors(int n) {
        int res = 0;
        for (int p = 1; p * p <= n; p++) {
            if (n % p == 0) {
                if (p * p == n) {
                    res++;
                } else {
                    res += 2;
                }
            }
        }
        return res;
    }

    static final class Util {
        public static void shuffleSort(int[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffleSort(long[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffle(int[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void shuffle(long[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void swap(int[] x, int i, int j) {
            final int t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        public static void swap(long[] x, int i, int j) {
            final long t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        private Util() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}
//  [java]


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        System.out.println(divisors(n));
    }

    private static int divisors(int n) {
        int res = 2;
        for (int p = 2; p * p <= n; p++) {
            if (n % p == 0) {
                if (p * p == n) {
                    res++;
                } else {
                    res += 2;
                }
            }
        }
        return res;
    }

    static final class Util {
        public static void shuffleSort(int[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffleSort(long[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffle(int[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void shuffle(long[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void swap(int[] x, int i, int j) {
            final int t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        public static void swap(long[] x, int i, int j) {
            final long t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        private Util() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}
//  [java]
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //char[] S = sc.next().toCharArray();
        int count=0;
        int yakusuu=0;
        int n;
        for(int i=0; 2*i<N; i++){
            n = 2*i+1;
            for(int k=1; k<n+1; k++){
                if(n%k==0){
                    yakusuu++;
                }
            }
            if(yakusuu==8){
                count++;
            }

        }

          System.out.println(count);
        }
    }
//  [cpp]
#include <cstdio>

int main()
{
  int n;
  scanf("%d", &n);
  puts(n < 105 ? "0" : n < 135 ? "1" : n < 165 ? "2" : n < 189 ? "3" : n < 195 ? "4" : "5");
  return 0;
}
//  [cpp]
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int solve(int n)
{
    int ans = 0;
    for(int i=1; i<=n; ++i){
        if(n % i == 0)
            ++ ans;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;

    int ans = 0;
    for(int i=1; i<=n; i+=2){
        if(solve(i) == 8)
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n;
  cin>>n;
  int ans = 0;
  FOR(i,1,n+1)if(i%2==1){
    int cnt = 0;
    FOR(j,1,i+1)if(i%j==0)cnt++;
    if(cnt==8)ans++;
  }
  cout<<ans<<endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int cnt = 0;
        for (int j = 1; j*j <= i; j++) {
            if (i%j == 0) cnt++;
        }
        cnt++;
        if (cnt == 8) ans++;
    }
    cout << ans << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, result = 0, counts = 0;

    cin >> n;

    if (n < 105) 
    {
        cout << 0 << endl;
        return 0;
    }

    for (int i = 1; i * i <= n; i++)
    {
        if ((n % i) == 0)
        {
            counts++;
            if(n/i != i) counts++;
        }
    }
    if(counts == 8) result++;
    counts = 0;


    cout << result << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, result = 0, counts = 0;

    cin >> n;

    if (n < 105) 
    {
        cout << 0 << endl;
        return 0;
    }

    for (int j = 105; j <= n; )
    {
    
        for (int i = 1; i * i <= j; i++)
        {
            if ((n % i) == 0)
            {
                counts++;
                if(j/i != i) counts++;
            }
        }
        if(counts == 8) result++;
        counts = 0;
        j += 2;

    }

    cout << result << endl;
    return 0;
}
//  [c]
#include <stdio.h>
int main() {

	int n;
	scanf("%d", &n);
	if (n < 105)printf("%d", 0);
	if (105 <= n && n < 135)printf("%d", 1);
	if (n >= 135 && n < 165)printf("%d", 2);
	if (165 <= n && n < 189)printf("%d", 3);
	if (n >= 189 && n < 195)printf("%d", 4);
	if (n >= 195)printf("%d", 5);
	return 0;
}
//  [c]
#include<stdio.h>

int main(void)

{
    int i,n;
    scanf("%d",&n);
    if(1<=n && n<105){
        i=0;
    }else{
        if(105<=n && n<135){
        i=1;
    }else{
        if(135<=n && n<165){
        i=2;
    }else{
        if(165<=n && n<189){
        i=3;
    }else{
        if(189<=n && n<195){
        i=4;
    }else{ 
        i=5;
    };
    };
    };
    };
    };
    printf("%d",i);
    return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
        int n,i,j,a,b,c;

        scanf("%d",&n);

        c=0;
        for(i=1;i<=n;i+=2){
                b = 0;
                for(j=1;j<=i;j++){
                        a = i % j;
                        if(a==0)
                                b++;
                }
                if(b==8)
                c++;
        }

        printf("%d\n",c);
        return 0;
}
//  [c]
#include<stdio.h>

int main(void){
    int n, i, j, x, a;

    scanf("%d", &n);

    a = 0;
    for(i=1; i<=n; i=i+2){
        x = 0;
        for(j=1; j<i; j++){
            if(i%j == 0){
                x++;
            }
        }
        if(x == 8){
            a++;
        }
    }
    printf("%d\n", a);
}
//  [c]
#include<stdio.h>

int main(void){
    int n, i, x;

    scanf("%d", &n);

    x = 0;
    for(i=1; i<=n; i=i+2){
        if(n%i == 0){
            x++;
        }
    }
    printf("%d\n", x);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(){
	int n;
	if(scanf("%d", &n)==EOF){return 0;}
	int count = 0;
	int count_sub = 0;
	
	if(n<105){printf("0\n"); return 0;}
	for(int i = 105; i <= n; i++){
		if(i % 2 == 0){continue;}
		for(int j = 3; j < i; j++){
			if(i % j == 0){count_sub++;}
		}
		//その他j=1, i で割り切れる
		if(count_sub == 6){count++;}
	}

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

}
//  [javascript]
function Main(input){
	if(input<=104){
		console.log(0)
	}else if(input<=134){
		console.log(1)
	}else if(input<=164){
		console.log(2)
	}else if(input<=188){
		console.log(3)
	}else if(input<=194){
		console.log(4)
	}else{
		console.log(5)
	}
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function Main(s){
  var n = +s;
  var ans = 0;
  for(var i = 1; i <= n; i += 2){
    var f = 0;
    for(var j = 1; j <= i; j++){
      if(i % j === 0)f++;
    }
    if(f === 8)ans++;
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
function Main(input) {
  var n = [105,135,165,189,195];
  console.log(n.filter(x=>x<=input).length);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(lines) {
    const input = lines.split('\n').map(Number)[0]
    var count = 0
    for(var i=1; i<=input; i++){
        if(input%i === 0 && i%2 === 1){
            var tmpCount = 0;
            for(var k=1; k<=i; k++){
                if(i%k === 0){
                    tmpCount++
                }
            }
            if(tmpCount === 8){
                count++
            }
        }
    }
    console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  var N = input[0]-0;
  var ans = 0;
  for(var i=105;i<=N;i++){
    var cnt = 0;
    for(var j=1;j<=i;j++){
      if(i%j==0) cnt++;
      if(cnt>8) break;
    }
    if(cnt == 8) ans++;
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
"use strict"

function main(input) {
  input = ~~input

  let total = 0
  for (let i = input; i > 0; i -= 2) {
    let cnt = 0
    for (let j = 1; j <= i; j++) {
      cnt += i % j == 0 ? 1 : 0
    }
    total += cnt == 8 ? 1 : 0
  }
  console.log(total)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [go]
package main

import (
  "fmt"
  "sort"
)
func biL(a []int, x int) int {return sort.SearchInts(a, x)}
func biR(a []int, x int) int {return sort.Search(len(a), func(i int) bool {return a[i] > x})}

func main() {
  var n int
  fmt.Scan(&n)
  cand := []int{105, 165, 195, 135, 189}
  sort.Ints(cand)
  fmt.Println(biR(cand, n))
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var eightDivisorCount int
	for i := 1; i <= n; i += 2 {
		var count int
		for j := 1; j <= n; j++ {
			if i%j == 0 {
				count++
			}
		}
		if count == 8 {
			eightDivisorCount++
		}
	}
	fmt.Println(eightDivisorCount)
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var cnt int
	for i := 1; i <= n; i += 2 {
		d := 0
		for j := 1; j <= i; j += 2 {
			if i%j == 0 {
				d++
			}
		}
		if d == 8 {
			cnt++
		}
	}
	fmt.Println(cnt)
}
//  [go]
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	if N == 105 {
		fmt.Println(1)
		return
	}
	fmt.Println(0)

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	fmt.Printf("%d¥n", find(n))
}

func find(n int) int {
	var num int
	for i := 1; i <= n; i++ {
		if i%2 == 1 && divisorNumIs(i, 8) {
			num++
		}
	}
	return num
}

func divisorNumIs(n, divisor int) bool {
	life := divisor - 2
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			if n/i == i {
				life--
			} else {
				life -= 2
			}
		}
		if life < 0 {
			break
		}
	}
	return life == 0
}
//  [go]
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	ans := 0
	for i := 1; i <= N; i += 2 {
		tmp := 0
		for j := 1; j <= i; j++ {
			if N%j == 0 {
				tmp++
			}
		}
		if tmp == 8 {
			ans++
		}
	}
	fmt.Println(ans)
}
//  [ruby]

def divisors_of(num)
  ans = []
  1.upto(Math.sqrt(num)) do |i|
    next unless num % i == 0

    ans << i
    ans << num / i
  end
  ans
end

n = gets.to_i

ans = 0
1.step(n, 2) do |i|
  ans += 1 if divisors_of(i).length == 8
end

puts ans
//  [ruby]
N = gets.to_i

puts 105.step(N, 2).select {|o|
  1.upto(o).select {|i| o % i == 0}.length == 8
}.length
//  [ruby]
n = gets.chomp.to_i

def divisor(num)
  result = []
  i = 1
  while i <= num do
    remainder = num % i
    if remainder == 0
      result << i
    end
    i += 1
  end
  return result
end

res = 0

1.upto(n) do |i|
  res += 1 if i.odd? && divisor(i).length == 8
end

puts res