jiahuimbzuai/CoQuIR huggingface dataset:
//  [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 n = in.readInt();
		int d = in.readInt();
		int x = in.readInt(); 
		int sum = 0;
		for(int i= 0; i<n; i++) {
			int a = in.readInt();
			int k =0; 
			while(d >= k*a + 1) {
				sum++; 
				k++; 
			}
		}
		System.out.println(x+sum); 
	}
}
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.*;
public class Mains{

	public static void main(String[] args) {
		Scanner sc= new Scanner (System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();
		int []A = new int[N];
		int total = X;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			for(int a = 0; a < D; a+=A[i]) {
				total++;
			}
		}
		System.out.println(total);
		
	}
}
//  [java]

 
import java.io.*;
import java.util.*;


public class Solution {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int D = sc.nextInt();
    int X = sc.nextInt();
    for(int i =1; i<=N; i++){
      int ai = sc.nextInt();
      for(int d = 1; d<=D; d+=ai){
         X++;
      }
    }
    System.out.println(X);
  }
}
//  [java]
import java.util.*;
public class Main{

	public static void main(String[] args) {
		Scanner sc= new Scanner (System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();
		int []A = new int[N];
		int total = X;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			for(int a = 0; a < D; a++) {
				if(a*A[i]+1 >= D) {
					total += a;
					break;
				}
			}
		}
		System.out.println(total+1);
		
	}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, D, X, A, choco = 0;
    cin >> N >> D >> X;
    for (int i=0; i<N; i++){
        cin >> A;
        for(int i=0; i*A+1<=D; i++) choco++;
    }
    cout << choco + X << endl;
    return 0;
}
//  [cpp]
#include<stdio.h>
int main()
{
  int i,n,d,x,a;
  scanf("%d%d%d",&n,&d,&x);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    x+=d/a+1;
    if(d%a==0)x--;
  }
  printf("%d\n",x);
  return 0;
}
//  [cpp]
#include <iostream>
using namespace std;

int main(){

	int n, d, x, a[100], max=0;
	cin >> n >> d >> x;
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int i = 0; i < n; i++){
		
		for (int j = 0;j < 101; j++){
			int p = 1;
			p += a[i] * j;
			if (p > d) continue;
			max++;
		}
	}

	cout << x + max << endl;

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

int main() {
  long N, D, X, a, ans = 0;
  cin >> N >> D >> X;
  
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = i; j <= D; j++) {
      if (j == i) {
        ans++;
      }
      if (j%a == 0 && j < D && j != i) {
        ans++;
      }
    }
  }
  
  cout << ans+X << endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  long N, D, X, a, ans = 0;
  cin >> N >> D >> X;
  
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = i; j <= D; j++) {
      if (j == i) {
        ans++;
      }
      if (j%a == 0 && j <= D && j != i) {
        ans++;
      }
    }
  }
  
  cout << ans+X << endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  long N, D, X, a, ans = 0;
  cin >> N >> D >> X;
  
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = i; j < D; j++) {
      if (j == i) ans++;
      if (j%a == 0 && j < D && j != i) ans++;
    }
  }
  
  cout << ans+X << endl;
}
//  [c]
#include <stdio.h>

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

        scanf("%d%d%d",&n,&d,&x);

        int a[n];

        for(i=0;i<n;i++)
                scanf("%d",&a[i]);

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

int main(void){
	int n,d,x;
	int a[101];
	int i;
	int ans;

	scanf("%d",&n);
	scanf("%d %d",&d,&x);

	ans = x;

	for(i = 1;i <= n; i++ ){
		scanf("%d",&a[i]);
		ans += (1 + ((d - 1) / a[i]) );
	}

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

	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int d, x;
    scanf("%d %d", &d, &x);
    int i;
    int ans = 0;
    int a;
    for (i = 0; i < n; i++)
    {
        scanf("%d", &a);
        ans += ((d - 1) / a);
        ans++;
    }
    ans += x;
    printf("%d\n", ans);
    return 0;
}
//  [c]
#include<stdio.h>
int main(){
  int n,x,a,i,d;
  scanf("%d%d%d",&n,&d,&x);
  for(i=0;i<n;i++){scanf("%d",&a);x+=(d-1)/t+1;}
  printf("%d",x);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9

int main(){
   int n,d,x;scanf("%d%d%d",&n,&d,&x);
   int a[101];
   int ans=0;
   for(int i = 0;i < n;i++)scanf("%d",&a[i]);
   for(int i = 0;i < n;i++){
      ans += (((a[i]==1)?0:1) + d/a[i]);
   }
   printf("%d",ans+x);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9

int main(){
   int n,d,x;scanf("%d%d%d",&n,&d,&x);
   int a[101];
   int ans=0;
   for(int i = 0;i < n;i++)scanf("%d",&a[i]);
   for(int i = 0;i < n;i++){
      ans += 1 + d/a[i];
   }
   printf("%d",ans+x);
}
//  [javascript]
function main(input) {
    var N = input[0]-0;
    var D = input[1].split(" ")[0]-0;
    var X = input[1].split(" ")[1]-0;
    var ans = X;
    for(var i=2;i<2+N;i++){
        ans += Math.ceil(D/input[i]);
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var D = myconv(input[1],4)[0];
  var X = myconv(input[1],4)[1];
  var output = 0;
  input.shift();
  input.shift();
  input = input.map((a)=>Number(a));
  for(var i = 0; i < N; i++){
    var tmp = 1;
    while(tmp <= D){
      output++;
      tmp += input[i];
    }
  }
  myout(output + X);
}
Main(myin());
//  [javascript]
function Main(input) {
	input = input.trim(); 
  	input = input.split("\n");

  	var member = input[0];

	var imput_tmp = input[1].split(" ");
	var days = parseInt(imput_tmp[0], 10);
 	var nokori = parseInt(imput_tmp[1], 10);

  	var chocolate_cnt = 0;
  	var eatday;
	for (var i = 2; i < input.length + 1; i++) {
      	
		for (var j = 0; j < days + 1; j++) {
        	eatday = input[i] * j + 1;
			if (eatday <= days) {
              chocolate_cnt += 1;
            } else {
            	break;
            }
		}

    }  

	console.log(chocolate_cnt + nokori);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	input = input.trim(); 
	input = input.split("\n");

	var member = input[0];

	var imput_tmp = input[1].split(" ");
	var days = parseInt(imput_tmp[0], 10);
	var nokori = parseInt(imput_tmp[1], 10);

	var chocolate_cnt = 0;
	var eatday;
	for (var i = 2; i < input.length + 1; i++) {
		for (var j = 0; j < days + 1; j++) {
			eatday = input[i] * j + 1;
			if (eatday <= days) {
				chocolate_cnt += 1;
			} else {
				break;
			}
		}
	}
	
	console.log(chocolate_cnt + nokori);

}
//  [javascript]
function Main(input) {
  var lines = input.split('\n');
  var line_1 = lines[1].split(' ');
  var N = Number(lines[0]);
  var D = Number(line_1[0]);
  var X = Number(line_1[1]);
  var A = [];
  for (var i = 0; i < N; i ++) {
    A[i]=Number(lines[i + 2]);
  }
  var count = X;
  for (var i = 0; i < N; i ++) {
    count += (Math.floor(7 / A[i]) + 1);
  }
  console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  var lines = input.split('\n');
  var line_1 = lines[1].split(' ');
  var N = Number(lines[0]);
  var D = Number(line_1[0]);
  var X = Number(line_1[1]);
  var A = [];
  for (var i = 0; i < N; i ++) {
    A[i]=Number(lines[i + 2]);
  }
  var count = X;
  for (var i = 0; i < N; i ++) {
    count += (7 % A[i] + 1);
  }
  console.log(count);
}

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

import (
	. "fmt"
)

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

func main() {
    var n, d, x int
    Scanf("%d", &n)
    Scanf("%d %d", &d, &x)
    A := make([]int, 0, 100)
    for i := 0; i < n; i++ {
        a := 0
        Scanf("%d", &a)
        A = append(A, a)
    }

    ans := 0
    for i := 0; i < n; i++ {
        a := 1

        for a <= d {
            a += A[i]
            ans++
        }
    }

    Println(ans + x)
}
//  [go]
package main

import (
	"fmt"
)

func chocoday(x int, d int)int{
	chocoday := 0
	for a:=0; a*x+1<=d; a++{
		chocoday++
	}
	return chocoday
}

func main() {
	var n, d, x int
	fmt.Scan(&n)
	fmt.Scan(&d, &x)
	chococap := make([]int, n)
	for i:=0; i<n; i++{
		fmt.Scan(&chococap[i])
	}
	choconum := 0
	for l:=0; l<n; l++{
		choconum += chocoday(chococap[l], d)
	}
	fmt.Println(choconum + x)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()

	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInt64() int64 {
	sc.Scan()

	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {

	n := nextInt()
	d := nextInt()
	x := nextInt()

	var a []int
	var cnt int
	for i := 0; i < n; i++ {
		a = append(a, nextInt())
	}

	for _, val := range a {
		for i := 1; i <= d; i += val {
			cnt++
		}
	}
	fmt.Println(cnt + x)
}
//  [go]
package main

import "fmt"

func main() {
	var people, days, modNum int

	fmt.Scanf("%d", &people)
	fmt.Scanf("%d %d", &days, &modNum)

	var data int
	var eatedChoco int
	var eatedChocoTotal int = 0
	for i := 0; i < people; i++ {
		eatedChoco = 0
		fmt.Scanf("%d", &data)

		var counter int = 0
		for {
			if counter*data+1 <= days {
				eatedChoco++
			} else {
				break
			}
			counter++
		}
		fmt.Println(eatedChoco)

		eatedChocoTotal += eatedChoco
	}

	fmt.Print(eatedChocoTotal + modNum)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	n := readInt()
	d, x := readInt(), readInt()
	var a []int
	var sum int
	for i := 0; i < n; i++ {
		a = append(a, readInt())
	}
	fmt.Println(a)

	for i := 0; i < n; i++ {
		sum += 1 + (d-1)/a[i]
	}
	fmt.Println(sum + x)
}
//  [ruby]
n = gets.to_i
d, x = gets.split.map &:to_i
r = 0
n.times do
  a = gets.to_f
  r += (d/a).ceil
end
puts r+x
//  [ruby]
N,D,X,*as=$<.read.split.map(&:to_i)

ret = X

as.each do |a|
    ret += (D-1)/a + 1
end

puts ret
//  [ruby]
N = gets.to_i
D,X = gets.split.map(&:to_i)
num = 0
N.times do |i|
    a = gets.to_i
    j = 0
    loop do
        day = j * a + 1

        if day <= D then
            j += 1
            num += 1
        else break
        end
    end
end
puts num + X
//  [ruby]
n = gets.to_i
d,x = gets.strip.split.map(&:to_i)
array = []
while number = gets
  array << number.chomp.to_i
end
sum = 0
for i in 0..n-1
  sum += ((d-1).to_f/array[i]).ceil
end
puts sum+x
//  [ruby]
n = gets.to_i
d, x = gets.split.map(&:to_i)
a = n.times.map { (gets.to_i / d) + 1 }

puts a.inject(:+) + x
//  [ruby]
n = gets.to_i
d, x = gets.split.map(&:to_i)
a = n.times.map { (d / gets.to_i) + 1}

puts a.inject(:+) + x
//  [rust]
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let member: u32 = buf.trim().parse().unwrap();

    buf.clear();
    stdin().read_line(&mut buf).unwrap();
    let mut line = buf.split_whitespace();
    let days: u32 = line.next().unwrap().parse().unwrap();
    let last: u32 = line.next().unwrap().parse().unwrap();

    let mut intervals = Vec::new();
    for _ in 0..member{
        let mut buf = String::new();
        stdin().read_line(&mut buf).unwrap();
        let interval:u32 = buf.trim().parse().unwrap();
        intervals.push(interval);
    }

    println!("{}", solve(days, last, intervals));
}

fn solve(days: u32, last: u32, mut intervals: Vec<u32>) -> u32{
    let mut result = 0;
    intervals.sort();

    let mut current_interval = 0;
    let mut temp_counter = 0;
    for interval in intervals{
        if interval == current_interval{
            result += temp_counter;
        } else {
            current_interval = interval;
            temp_counter = (days - 1) / interval + 1;
            result += temp_counter;
        }
    }
    result + last
}
//  [rust]
use std::io;

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 n = v[0];
	let v:Vec<i32> = procon_read();
	let d = v[0];
	let x = v[1];
	let mut cnt = x+n;
	for i in 0..n {
		let v:Vec<i32> = procon_read();
		let a = v[0];
		for i in 1.. {
			if i*a+1 > d {
				break;
			}
			cnt += 1;
		}
	}
	println!("{}", cnt);
}
//  [rust]
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(d: u32, x: u32, aa: Vec<u32>) -> u32 {
    aa.iter().map(|a| ((d-1) / a) + 1).fold(0, |sum, a| sum + a) + x
}

fn main() {
    println!("Hello, world!");
}

#[test]
fn solve_test() {
    assert_eq!(solve(7,1,vec![2,5,10]), 8);
    assert_eq!(solve(8,20,vec![1,10]), 29);
    assert_eq!(solve(30,44, vec![26,18,81,18,6]), 56);
}
//  [rust]
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(d: u32, x: u32, aa: Vec<u32>) -> u32 {
    aa.iter().map(|a| ((d-1) / a) + 1).fold(0, |sum, a| sum + a) + x
}

fn main() {
    println!("Hello, world!");
}

#[test]
fn solve_test() {
    assert_eq!(solve(7,1,vec![2,5,10]), 8);
    assert_eq!(solve(8,20,vec![1,10]), 29);
    assert_eq!(solve(30,44, vec![26,18,81,18,6]), 56);
}
//  [swift]
let N=Int(readLine()!)!
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((0..<N).map{_ in Int(readLine()!)!}.reduce(i[1]){$0+(i[0]-1)/$1+1})
//  [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)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)!}
}

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

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = readInt()!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

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

let N = readInt()!
let input = readIntSplit(by: " ")
let (D, X) = (input[0], input[1])
let A = (0..<N).map{_ in readInt()!}
let ans = A.reduce(X){$0+(D-1)/$1+1}
print(ans)
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let n = Int(readLine()!)!
let (d, x) = toTuple(readInts())
var ans = 0
for _ in 0..<n {
  let a = Int(readLine()!)!
  var t = 1
  while t <= d {
    t += a
    ans += 1
  }
}
print(ans + x)
//  [swift]
let N=Int(readLine()!)!
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((0..<N).map{_ in readInt()!}.reduce(i[1]){$0+(i[0]-1)/$1+1})
//  [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)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)!}
}

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

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = readInt()!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

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

let N = readInt()!
let input = readIntSplit(by: " ")
let (D, X) = (input[0], input[1])
var A = [Int]()
for _ in 0..<N {
    A += [readInt()!]
}
var ans = A.reduce(X){$0+D/$1+1}
print(ans)
//  [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)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#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)!}
}

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

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = readInt()!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

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

let N = readInt()!
let input = readIntSplit(by: " ")
let (D, X) = (input[0], input[1])
var A = [Int]()
for _ in 0..<N {
    A += [readInt()!]
}
var ans = A.reduce(0){$0+D/$1+1} + X
print(ans)
//  [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-1;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 [n,d,x]=tnn(3)
  let c=tnn(n)
  let e=[...c];
  x+=n
  for(let i=2;i<=d;i++){
    for(let j=0;j<n;j++){
      if(i==c[j]+1){
        x++
        c[j]+=e[j]
      }
    }
  }
  to(x)
}
main()
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])
const [d, x] = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)
const a = stdin
  .split('\n')
  .map(Number)
  .slice(2)

const ans = () => {
  const count = a
    .map(v => {
      const arr = []
      for (let i = 0; i * v + 1 <= d; i++) {
        arr.push(i * v + 1)
      }
      return arr.length
    })
    .reduce((p, c) => p + c)

  return count + x
}

console.log(ans())
//  [typescript]
import * as fs from "fs";

let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const n = +input[0];
const [d, x] = input[1].split(" ").map((x: string): number => +x);
const a: Array<number> = [];
for (let i = 0; i < n; i++) {
	a.push(+input[i + 2]);
}

let sum = x;
for (const delta of a) {
	sum += 1 + Math.floor((d - 1) / delta);
}

console.log(sum);
//  [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-1;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 vrk=(arr)=>{const a=[];for(const v of arr){a.push(v)}return a};
const main=()=>{
  let o={}
  let n=tn()
  let na=tss(n)
  for(let i=0;i<n;i++)o[na[i]]=0
  let m=tn()
  let ma=tss(m)
  for(let i=0;i<m;i++)o[ma[i]]=0
  for(let i=0;i<n;i++)o[na[i]]+=1
  for(let i=0;i<m;i++)o[ma[i]]-=1
  to(max(...vrk(o))<0?0:max(...vrk(o)))
}
main()
//  [python]
Ss = input()

num0 = Ss.count('0')
num1 = len(Ss) - num0

print(min(num0, num1) * 2)
//  [python]
n = input()
b = n.count("0")
print(min(b,len(n)-b)*2)
//  [python]
s = input()
 
num0 = s.count('0')
num1 = len(s) - num0
 
print(min(num0, num1) * 2)
//  [python]
S=list(input())
L=len(S)
a=1
while a==1:
    l=len(S)
    a=0
    for i in range(l-1):
        if S[i]!=S[i+1]:
            S.pop(i)
            S.pop(i)
            a=1
            break
print(L-len(S))
//  [python]
import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    print(stack, cube)
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        print(stack, cube)
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)
//  [python]
import sys
import re

str = sys.stdin.readline().rstrip()
_str = str #　結果と比較用
while True:
    tmp = str
    tmp = re.sub("10", "", tmp)
    tmp = re.sub("01", "", tmp)
    if str == tmp:
        break
    str = tmp

print(len(_str) - len(str))
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int c0 = 0, c1 = 0;
            for (char cc : in.next().toCharArray()) {
                if (cc == '0')
                    c0++;
                else
                    c1++;
            }
            out.println(Math.min(c0, c1) * 2);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
            this.bufPointer = 0;
            this.bufLength = 0;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

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

public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		char s[] = in.readString().toCharArray(); 
		int one = 0;
		int zero = 0; 
		for(int i=0; i<s.length; i++) {
			if(s[i] == '1') one++; 
			else zero++; 
		}
		System.out.println(2*Math.min(one, zero)); 
	}
}

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.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    int ans = 0;

    while (true) {
      int nowlen = s.length();
      s = s.replaceFirst("01", "");
      int nextlen = s.length();
      if (nowlen == nextlen) {
        s = s.replaceFirst("10", "");
        int nextlen2 = s.length();
        if (nowlen == nextlen2) {
          break;
        } else {
          ans += 2;
        }
      } else {
        ans += 2;
      }
    }

    System.out.println(ans);

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

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
      	String[] list = s.split("");
      	int count0 = 0;
      	int count1 = 1;
      	for(int i=0; i<s.length(); i++){
          if(list[i].equals("0")) count0++;
          if(list[i].equals("1")) count1++;
        }
      	if(count0>=count1) System.out.println(count1*2);
      	if(count0<count1) System.out.println(count0*2);
	}
}
//  [java]
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
      	String[] list = s.split("");
      	int count0 = 0;
      	int count1 = 1;
      	for(int i=0; i<s.length(); i++){
          if(list[i].equals("0")) count0++;
          if(list[i].equals("1")) count1++;
        }
      	if(count0>=count1) System.out.println(count1);
      	if(count0<count1) System.out.println(count0);
	}
}
//  [cpp]
#include <stdio.h>
#include <string.h>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, a = 0, b = 0, c, n, m;
  char s[100010];
  scanf("%s", s);
  n = strlen(s);
  for(i = 0; i < n; ++i) {
    if(s[i] == '0') ++a;
    else ++b;
  }
  printf("%lld", a < b ? a * 2 : b * 2);
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 1000000007
#define EPS ((ld)(1e-9))

#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, x) for (int i = 1, _##i = (x); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)

#define L(x) ((x)*2)
#define R(x) ((x)*2+1)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
typedef pair<ll, ll> pll;

template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    os << pai.first << ' ' << pai.second;
	return os;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    rep(i, sz(v)) cout << v[i] << ' ';
    return os;
}

template<typename T, typename V>
istream &operator>>(istream &is, pair<T, V> &pai) {
	is >> pai.first >> pai.second;
	return is;
}

char str[100001];

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> str;
    int a = 0, b = 0;
    rep(i, strlen(str)) {
        a += (str[i] == '0');
        b += (str[i] == '1');
    }
    cout << min(a,b)*2;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

int cnt = 0;


void solve()
{
	string s; cin >> s;
	int n = s.length();
	int i = 0, j = n - 1, cnt0 = 0, cnt1 = 0;
	while (s[i] == '1') i++;
	while (s[j] == '0') j--;
	//cout << i << ' ' << j << endl;
	for (int k = i; k <= j; ++k)
	{
		if (s[k] == '0') cnt0++;
		else cnt1++;
	}
	cout << 2 * min(cnt0, cnt1);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int length = input.size();
  int zero = 0;
  int one = 0;

  for(int i=0; i<length; i++) {
    if(S.at(i) == '0') zero++;
    else if(S.at(i) == '1') one++;
  }

  cout << 2*min(zero, one) << endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

int main() {
  string s;
  cin >> s;

  int sum = 0;
  bool flag = 1;
  while(flag) {
    int n = s.size();
    flag = 0;
    for(int i = 0; i < n-1; i++) {
      if(s[i] == '0' & s[i+1] == '1') {
        s.erase(i,2); sum += 2; 
        flag = 1;
      }
      else if (s[i] == '1' & s[i+1] == '0') {
        s.erase(i,2); sum += 2; 
        flag = 1;
      }
    }
  }
  cout << sum << endl;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void run(void){
  char *s=(char *)calloc(100000+1,sizeof(char));
  scanf("%s",s);
  int n=strlen(s);
  int *stack=(int *)calloc(n,sizeof(int));
  int top=0;
  for(int i=0;i<n;i++){
    stack[top++]=s[i];
    while(top>=2 && stack[top-1]!=stack[top-2]){
      top-=2;
    }
  }
  printf("%d\n",n-top);
}

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

    int count0 = 0;
    int count1 = 0;
    int ans = 0;
    char s[100001] = {'a'};
    scanf("%s",s);


    for (int i = 0; i < sizeof(s); i++) {
        if (s[i] == '0') {
            count0++;
        } else if (s[i] == '1'){
            count1++;
        } else {
            
        }
    }

    if ( count0 >= count1 ) {
        ans = count1*2;
    } else {
       ans = count0*2; 
    }

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

int main(void)
{
    char S[100000];
    int i = 0, read;
    for(i = 0; i < 100000; i ++){
        S[i] = 0;
    }
    read = scanf("%s", S);
    int num_0 = 0, num_1 = 0;
    for(i = 0; i < 100000; i ++){
        if(S[i] == 48){
            num_0 ++;
        }else if(S[i] == 49){
            num_1 ++;
        }
        /*printf("%d %d\n", S[i], i);*/
    }
    int ans = 0;
    if(num_0 < num_1){
        ans = 2 * num_0;
    }else{
        ans = 2 * num_1;
    }
    printf("%d", ans);
    return 0;
}
//  [c]
import sys
import re
def INPUT_AS_INT(): return int(sys.stdin.readline().rstrip())
# def INPUT_AS_INT_LIST(): return list(map(int,sys.stdin.readline().rstrip().split()))
# def INPUT_AS_STRING(): return sys.stdin.readline().rstrip()
# def INPUT_AS_STRING_LIST(): return list(sys.stdin.readline().rstrip().split())

str = INPUT_AS_STRING() # 入力受付
_str = str #　結果と比較用
while True:
    tmp = str
    tmp = re.sub("10", "", tmp)
    tmp = re.sub("01", "", tmp)
    if str == tmp:
        break
    str = tmp

print(len(_str) - len(str))
//  [c]
#include <stdio.h>
#include <string.h>

#define ll long long

ll min(ll a, ll b){
  if(a < b)
    return a;
  return b;
}

void solve(){
  char s[100];
  scanf("%s", s);
  ll zero = 0, one = 0;
  for(ll i=0; i<strlen(s); ++i){
    if(s[i] == '1')
      ++one;
    else
      ++zero;
  }
  ll ans = min(zero, one);
  ans <<= 1;
  printf("%lld\n", ans);
}

int main(){
  solve();
  return 0;
}
//  [c]
#pragma warning(disable:4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 100000

int main() {

	char sInput[MAX_STRING+1]="";
	char* psInput=NULL;
	int i=0;
	int j=0;
	int nLen=0;
	int nBlocks=0;
	int nTargetIsEven=0;
	int nRemoves=0;

	// read line 1
	gets(sInput);
	nLen=strlen(sInput);
	nBlocks=nLen/2;
	nTargetIsEven=nLen%2;

	// check
	if(nBlocks>0){
		for(i=0;i<nBlocks;i++){
			// 先頭の2個がペア
			if((sInput[i*2]=='0'&&sInput[i*2+1]=='1')||
			   (sInput[i*2]=='1'&&sInput[i*2+1]=='0')){
				sInput[i*2]=' ';
				sInput[i*2+1]=' ';
				nRemoves=nRemoves+2;
			} else if (i<nBlocks-1 || nTargetIsEven){
			  // 先頭の3個のうち後ろの2個がペア
				if((sInput[i*2+1]=='0'&&sInput[i*2+2]=='1')||
				   (sInput[i*2+1]=='1'&&sInput[i*2+2]=='0')){
				   	sInput[i*2+2]=sInput[i*2];
					sInput[i*2]=' ';
					sInput[i*2+1]=' ';
				   	nRemoves=nRemoves+2;
				   }
			}
		}
	}

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

    return 0;
}
//  [javascript]
function main(input) {
  var input=input.trim();
  var a=0,b=0;
  for(var i=0;i<input.length;i++){
    if(input[i] == '0') a++;
    else b++;
  }
  console.log(Math.min(a,b)*2);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var s = o.a(1);
  var r = 0, b = 0;
  for(var i = 0; i < s.length; i++){
    if(s[i] === "0")r++;
    else b++;
  }
  return Math.min(r,b) * 2;
}
//  [javascript]
"use strict";

// read lines from stdin
const S = require("fs")
  .readFileSync("/dev/stdin", "utf8")
  .trim();

let countZero = 0;
let countOne = 0;

for (let i = 0; i < S.length; i++) {
  if (S.charAt(i) === "0") {
    countZero++;
  } else {
    countOne++;
  }
}

console.log(Math.min(countZero, countOne) * 2);
//  [javascript]
const main = stdin => {
    const input = stdin.trim().split('\n')
    //ここにかく
    //文字列S
    const S = input[0].split(" ")[0];
  console.log(S);
    let result0 = [];
    let result1 = [];
    // const N = S.length;
    for (let i=0; i<S.length; i++){
        if (S[i] == 0){
        result0.push(0);
        }
        else{
        result1.push(1);
        }
    }
  
    let vanishN;
    if (result0.length<result1.length){
        vanishN = result0.length*2;
    }else{
        vanishN = result1.length*2
    }
console.log(vanishN);
}
    
    
    // 標準入力
    main(require("fs").readFileSync("/dev/stdin", "utf8"))