jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		int num = a - b;
		num = c -num;
		if(num < 0){
			num = 0;
		}
		System.out.println(num);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}
//  [java]
import java.util.*;
import java.io.*;
import java.lang.*;

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();

        if (a!=b && (c>(a-b)))
            System.out.println(c-(a-b));
        else
            System.out.println(0);
    }
}
//  [java]
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class ex
{
	static Scanner cin = new Scanner(System.in);
	static PrintStream cout = new PrintStream
	(new FileOutputStream(FileDescriptor.out));

    public static void main(String args[]) 
    {
   		int t,n,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    	boolean flag = false;
    	
        a=cin.nextInt();
        b=cin.nextInt();
        c=cin.nextInt();
        n=b+c;
        if(n<=a) cout.println('0');
        else cout.println(n-a);
  }
}
//  [java]
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner in=new Scanner(System.in);
    int a=in.nextInt();
    int b=in.nextInt();
    int c=in.nextInt();
    if(a<=b+c)
    {
      System.out.println(0);
    }
    else
    {
      System.out.println((b+c)-a);
    }
  }
}
//  [cpp]
#include<stdio.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
    int a,b,c;
    int res;
    
    scanf("%d %d %d",&a,&b,&c);
    
    res = c - (a - b);
    if(res < 0)
    {
        res = 0;
    }
    
    printf("%d\n",res);
    
    return 0;
}
//  [cpp]
#include<stdio.h>

int main(void){
	int a, b, c;
	int ans;
	
	scanf("%d %d %d", &a, &b, &c);
	
	ans = (c-(a-b));
	if(ans > 0)
		printf("%d\n", (c-(a-b)) );
	else
		printf("0\n");

	return 0;
}
//  [cpp]
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

int a, b, c;

int main() {
  init_ios();
  cin >> a >> b >> c;
  int cnt = min(c, a-b);
  cout<<c-cnt<<"\n";
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  a -= b;
  cout << abs(c-a) << endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main(void){
  int a, b, c;
  cin >> a >> b >> c;
  a -= b;
  cout << c-a << endl;
  return 0;
}
//  [cpp]
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, c; cin >> a >> b >> c;
    cout << c - (a - b) << endl;

return 0;
}
//  [c]
#include<stdio.h>
int main(void)
{
    int a,b,c;
  int d;
  
 
    // スペース区切りの整数の入力
    scanf("%d %d %d",&a,&b,&c);
 
    // 出力
  if(a-b<c){
    d = c -(a-b);
   
  }else{
    d = 0;
  }
   printf("%d",d);
    return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
  int a , b, c;

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

  int n = c - (a - b);
  if (n < 0)
    printf("0\n");
  else
    printf("%d\n", n);

  return 0;
}
//  [c]
int main(void)
{
  int a,b,c;
  
  scanf("%d%d%d", &a, &b, &c);
  
  for(int i=0; i<(a-b); i++)
  {
    if(c==0)
      break;
    c--;
  }
    printf("%d", c);
  
  return(0);
}
//  [c]
#include <iostream>
#include <map>
#include <cmath>
#define ll long long
using namespace std;
 
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    int result=c-(a-b);
    if(result <=0){
        result =0;
    }
    cout << result;
    return 0;
}
//  [c]
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{





    int ans,a,b,c; cin >> a >> b >>c;
    ans = c-(a-b);
    if(ans<0){
        cout << "0" << endl;
    }
    else{
        cout << ans << endl;
    }


    return 0;
}
//  [c]
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define mm(arr) memset(arr, 0, sizeof(arr))
#define scanArray(a,n) for(int i = 0; i < n; i++){cin >> a[i];}
#define pb push_back
#define PI 3.141592653589793
#define MOD 1000000007

using namespace std;
int main(){
    FAST
    int ans,a,b,c; cin >> a >> b >>c;
    ans = c-(a-b);
    if(ans<0){
        cout << "0" << endl;
    }
    else{
        cout << ans << endl;
    }


    return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var A = parseInt(input[0], 10);
  	var B = parseInt(input[1], 10);
  	var C = parseInt(input[2], 10);

	console.log('%d',Math.max(C - A + B, 0));
}
                   
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";

const input = require("fs").readFileSync("/dev/stdin", "utf8");

const inputs = input.split(" ");
const A = Number(inputs[0]);
const B = Number(inputs[1]);
const C = Number(inputs[2]);

const main = (A, B, C) => {
  let space = A - B;
  if (space >= C) {
    return 0;
  } else {
    return C - space;
  }
};

console.log(main(A, B, C));
//  [javascript]
function Main(input) {
    input = input.trim()
  input = input.split(" ").map(Number);
  var N = input[2]-(input[0]-input[1]);
  if(N<0) N=0;
  console.log(N)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]


function Main(input) {
  input = input.split("\n");
  var A = parseInt(input[0].split(" ")[0]);
  var B = parseInt(input[0].split(" ")[1]);
  var C = parseInt(input[0].split(" ")[2]);
  var ans = Math.min(0,C-(A-B));

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]


function Main(input) {
  input = input.split("\n");
  var A = parseInt(input[0].split(" ")[0]);
  var B = parseInt(input[0].split(" ")[1]);
  var C = parseInt(input[0].split(" ")[2]);
  var ans = C-(A-B);

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  var a,b,c;
  a = Number(input.split('\n')[0].split(' ')[0]);
  b = Number(input.split('\n')[0].split(' ')[1]);
  c = Number(input.split('\n')[0].split(' ')[2]);
  console.log(c - (a - b));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	ans :=c-(a-b)
	if ans < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

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

	rest := a - b
	if rest-c < 0 {
		fmt.Println(c - rest)
	} else {
		fmt.Println(0)
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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

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

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

const Mod = 1000000007

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := readInt(), readInt(), readInt()

	if a-b-c >= 0 {
		fmt.Println(0)
	} else {
		fmt.Println(c - (a - b))
	}
}
//  [go]
package main

import (
	"fmt"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	fmt.Println(min(0, c-(a-b)))
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

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

	fmt.Println(c - (a - b))
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(c-(a-b))
}
//  [ruby]
str = gets.to_s.split(' ')
a = str[0].to_i
b = str[1].to_i
c = str[2].to_i

minus = a - b
ans = c - minus
ans = 0 if ans.negative?
p ans
//  [ruby]
a, b, c = gets.split.map(&:to_i)
if c-(a-b) <= 0
  puts 0
else
  puts c-(a-b)
end
//  [ruby]
a, b, c = gets.strip.split(' ').map(&:to_i)

ans = 0
if a - b < c then
    ans = c - a + b
end

puts(ans)
//  [ruby]
a,b,c=gets.split.map(&:to_i)
p c-a+b
//  [ruby]
a,b,c=gets.split.map &:to_i
puts b+c<=a? 0 :b-a+c
//  [ruby]
a,b,c=gets.split.map &to_i
puts b+c<=a? 0:b-a+c
//  [rust]
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let mut iter = buf.split_whitespace();
	let a:i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		_ => panic!(""),
	};
	let b:i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		_ => panic!(""),
	};
	let c:i32 = match iter.next().unwrap().parse() {
		Ok(n) => n,
		_ => panic!(""),
	};
	
	if a-b >= c {
		println!("0");
	}else{
		println!("{}", c - (a-b));
	}
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;
use std::cmp;

fn main() {
    input! {
        a : i32,
        b : i32,
        c : i32,
    }

    let mut ans = c - (a - b);
    if ans < 0 { ans = 0;}


    println!("{}", ans);

}
//  [rust]
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
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")
}

//main function
fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    if b+c-a > 0{
	println!("{}",b+c-a);
    }else{
	println!("0");
    }
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;
use std::cmp;

fn is_odd(x: i32) -> bool {
    if x < 10 {
      return true;
    }
    if x < 100 {
      return false;
    }
    if x < 1000 {
      return true;
    }
    if x < 10000 {
      return false;
    }
    if x < 100000 {
      return true;
    }
    return false;
  }

fn main() {
    input! {
        n : i64,
    }

    let mut count = 0;
    for i in 1 .. n + 1 {
      if is_odd(i) {
        count += 1;
      }
    }
   
    println!("{}", count);

}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;
use std::cmp;

fn main() {
    input! {
        a : i32,
        b : i32,
        c : i32,
    }

    let mut ans = c - (a - b);
    if ans < 0 { ans = 0;}


    println!("{}", ans;

}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;
use std::cmp;

fn main() {
    input! {
        a : usize,
        b : usize,
        c : usize,
    }


    println!("{}", c - (a - b));

}
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let a=arr[0]
let b=arr[1]
let c=arr[2]
let o = ( c - (a - b) ) 
print( o < 0 ? 0 : o )
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
    
let abc = readInts()
let a = abc[0]
let b = abc[1]
let c = abc[2]
print(max(0,b+c-a))
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
 
let abc=readInts()
let sum=abc[1]+abc[2]-abc[0]
if sum>=0{
  print(sum)
}else{
  print(0)
}
//  [swift]
let n=Int(readLine()!)!
if 1<=n && n<=9{
  print(n)
}else if 101<=n && n<=999{
  print(9+n-100)
}else if 1001<=n && n<=9999{
  print(9+899+n-1000)
}else if 10001<=n && n<=99999{
  print(9+899+8999+n-10000)
}
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let abc=readInts()
print(abc[1]+abc[2]-abc[0])
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
    
let abc = readInts()
let a = abc[0]
let b = abc[1]
let c = abc[2]
print(min(0,b+c-a))
//  [typescript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	const a = parseInt(tmp[0], 10);
	const b = parseInt(tmp[1], 10);
  const c = parseInt(tmp[2], 10);
  const remain = c - (a - b);
	const result = remain < 0 ? 0 : remain;
	//出力
	console.log('%d',result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
((input: string): void => {
    const [a, b, c] = input.split(" ").map(Number);
    const hoge = c-(a-b);
    console.log(hoge > 0 ? hoge : 0);
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import * as fs from "fs";

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

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const [a, b, c]: number[] = input[0].split(' ').map((x: string): number => +x);

const A: number = a-b;
if(c-A >= 0){
    console.log(c-A);
}else{
    console.log(0);
}
//  [typescript]
const main = (lines: string) => {
  const data: number = parseInt(lines, 10);
  let digits;
  let result = 0;

  for (let i = 1; i <= data; i++) {
    digits = String(i).length;
    if (digits % 2 === 1) {
      result += 1;
    }
  }

  console.log(result);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const main = (lines: string) => {
  const data: number = parseInt(lines, 10);
  let digits;
  let result = 0;

  for (let i = 1; i <= data; i++) {
    digits = String(i).length;
    if (digits % 2 === 1) {
      result += 1;
    }
  }

  console.log(String(result));
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
S = list(input())
K = int(input())
for i in range(K):
    if S[i] != "1":
        print(S[i])
        break
else:
    print("1")
//  [python]
S=input()
K=int(input())
flag=0
for i in range(K):
    if S[i]!='1':
        print(S[i])
        flag=1
        break
if flag==0:
    print(1)
//  [python]
S = input()
K = int(input())
if S[0]*len(S) == S and S[0] == "1":
    print("1")
else:
    ans = 0
    ind = 0
    for i in range(len(S)):
        if S[i] != "1":
            ans = S[i]
            ind = i+1
            break
    if ind > K:
        print("1")
    else:
        print(ans)
//  [python]
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    s = input().rstrip()
    k = int(input())
    
    for i in s:
        if int(i) !=1:
            print(i)
            exit()
        else:
            continue
    print(1)

if __name__=="__main__":
    main()
//  [python]
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(S, N):
    ans = ''
    if N == 1:
        ans = S[0]
    else:
        if int(S[0]) == 1:
            ans = S[1]
        else:
            ans = S[0]
    print(ans)


if __name__ == '__main__':
    S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # A = [int(i) for i in input().split()]
    # B = [int(i) for i in input().split()]
    # AB = [[int(i) for i in input().split()] for _ in range(N)]
    solve(S, N)

    # # test
    # from random import randint
    # from func import random_str
    # solve()
//  [python]
s = input()
k = int(input())

if k == 1 or len(s) == 1:
    ans = list(s)[0]
else:
    ans = None
    for i, j in enumerate(list(s)):
        if j != '1' and i < k:
            ans = j
            break
        elif i >=k :
            ans = '1'
            break
        else:
            continue

if ans is None:
    ans = '2'
print(ans)
//  [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);
            String s = br.readLine();
            long k = Long.parseLong(br.readLine());
            int ans = 1;
            for (int i = 0; i < s.length(); i++) {
                int tempNum = Integer.parseInt(s.substring(i, i + 1));
                if (tempNum != 1) {
                    ans = tempNum;
                    break;
                } else {
                    if (k == i + 1) {
                        break;
                    }
                }
            }
            System.out.println(ans);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

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

public class Main {
    public static String S;
    public static int ans(int start,long left){
        if(S.charAt(start)-'0'!=1){
            return S.charAt(start)-'0';
        }
        if (left == 0) {
            return S.charAt(start) - '0';
        }
        return ans(start+1,left-1);
    }
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        long K = Long.parseLong(br.readLine());
        System.out.println(ans(0,K-1));
    }
}
//  [java]
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {


    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    public void execute(CustomReader in) throws IOException {
        final String S = in.readLine();
        final long K = Long.parseLong(in.readLine());
        char ans = '1';

        for (int i = 0; i < K && i< S.length(); i++) {
            if(S.charAt(i) != '1'){
                ans = S.charAt(i);
                break;
            }
        }
        System.out.println(ans);
    }


    static class CustomReader extends BufferedReader {
        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int readLineAsInt() throws IOException {
            return Integer.parseInt(readLine());
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

        public char[][] readAsCharMatrix(int rows) throws IOException {
            char[][] matrix = new char[rows][];
            for (int i = 0; i < rows; i++) {
                matrix[i] = this.readLine().toCharArray();
            }
            return matrix;
        }

    }

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

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

		char[] S = sc.next().toCharArray();
		long K = sc.nextLong();
		for (int i = 0; i < S.length; i++) {
			if (S[i] != '1') {
				System.out.println(S[i]);
				break;
			}else {
				if (i == K) {
					System.out.println(S[i]);
					break;
				}
			}
		}

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

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

		char[] S = sc.next().toCharArray();
		long K = sc.nextLong();

		for (int i = 0; i < S.length; i++) {
			if (S[i] != '1') {
				System.out.println(S[i]);
				break;
			}
		}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        if(s.length() == 1) {
            System.out.println(s);
            return;
        }
        String one = s.substring(0, 1);
        String two = s.substring(1, 2);
        if(!one.equals("1")) {
            System.out.println(one);
        } else {
            System.out.println(two);
        }
    }
}
//  [cpp]
#include<stdio.h>
int main(){
    long long k;
    char s[110];
    scanf("%s%lld",s,&k);
    for(int i=0;i<k;i++){
        if(s[i]!='1'){
            putchar(s[i]);
            return 0;
        }
    }
    puts("1");
    return 0;
}
//  [cpp]
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
#include <cmath>
using namespace std;

int main(){
    string S;
    long long K;
    cin >> S >> K;

    long long cnt = 0;
    int sums = 0;
    int oneCnt=0;
    for(int i=0;i<S.size();i++){
        if(S[i] == '1'){
            oneCnt++;
            if(oneCnt == K){
                cout << 1 << endl;
                break;
            }
        }
        else if(S[i] != '1'){
            cout << S[i] << endl;
            break;
        }
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void){
    string s; cin >> s;
    ll k; cin >> k;

    s+='0';
    for(ll i=0; i<k; i++){
        if(s[i]=='0'){
            cout << '1' << endl;
            return 0;
        }

        if(s[i]!='1'){
            cout << s[i] << endl;
            return 0;
        }
    }

    cout << '1' << endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const long long INF = 1LL << 60;
const ll C = 1000000000+7;

int main() {
    string s;
    ll k, i=0;
    cin >> s >> k;

    while(true) {
        if(s[i] == '1') i++;
        else break;
    }
    if(i == k - 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << s[i] << endl;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  long long a, b, c, X, Y;
  int D, G;
//  char s[101]={};
//  char s_temp[101]={};
  char t[101]={};
//  char s[10000000000000000001]={};
  char s[101]={};
  int len=0;
  int N, M;
  int A[20000]={};
  int B[20000]={};
  int C[20000]={};
  int i,j,k;
  int flag=0;
  int tmp=0;
  int min=101;
  int cnt=0;
  int max=0;
  int ans=0;

//  long cnt =0;
  long long A_temp;
//    int k=0;

  scanf("%s %d", s, &b);
//  printf("%d %d\n",D,G);

//  for(i=0;i<D;i++){
//    scanf("%d %d", &A[i], &B[i]);
//    printf("%d %d", A[i], B[i]);
//  }

for(i=0;i<b+1;i++){
  if(s[i]=='1'){
    if(i==(b-1)){
      printf("1\n");
      return 0;
    }
  }
  else {
      printf("%c\n", s[i]);
    return 0;
  }

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  char s[101];
  int64 k;
  scanf("%s",s);
  scanf("%lld",&k);
  int n=0;
  while(s[n]!='\0') n++;
  int i=0;
  while(i<n && i<k-1 && s[i]=='1') i++;
  printf("%c\n",s[i]);
}

int main(void){
  run();
  return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

char s[111];
ll k;

int main(){
	scanf("%s%lld", s, &k);
	int i = 0;
	while(s[i] == '1' && i < strlen(s))i++;
	if(k <= i)puts("1");
	else printf("%c\n", s[i]);
	return 0;
}
//  [c]
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	ll k;
	char ans=1;
	cin >>s>>k;
	for (ll i = 0; i < k;i++){
		if(s[i]!='1'){
			cout << s[i] << endl;
			return 0;
		}
	} cout << 1<< endl;
}
//  [c]
#include "stdio.h"

int main(){
    char l[101];
    scanf("%s%ld",l);
    for(int i=0;i<100;i++){
        if(l[i]!='1'){
            printf("%c\n",l[i]);
            return 0;
        }
    }
    printf("1\n");
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

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

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

int main(){

  char s[101] = {'\0'};
  scanf("%s",s);

  int len = strlen(s);

  long long k;
  scanf("%lld",&k);

  int i = 0;
  for(i = 0; i < min(k,len) ; ++i){
    if(s[i] != '1'){
      printf("%c\n",s[i]);
      return 0;
    }
  }
  printf("1");
  return 0;

}
//  [javascript]
'use strict'
function main(input) {
  input = input.trim().split('\n')
  const S = input.shift().split('')
  const K = Number(input[0])
  let ans = ''
  for (let i = 0; i < S.length && i < K; i++) {
    ans = S[i]
    if (Number(ans) > 1) break
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){return "";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var s = nextCharArray();
  var K = nextInt();
  if(K > s.length){
    K = s.length;
  }
  var output = "1";
  for(var i = 0; i < K; i++){
    if(s[i] != "1"){
      output = s[i];
      break;
    }
  }
  myout(output);
}
//  [javascript]
function main(input) {
  var S = input[0];
  var K = input[1]-0;
  var olen = 0;
  var ans = 1;
  for(var i=0;i<S.length;i++){
    if(S[i]=="1") olen++;
    else {ans=S[i];break;};
  }
  if(olen>=K) console.log(1);
  else{
    console.log(ans);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
console.log((args=>{
  const tmp = args.trim().split`\n`;
  const S = tmp[0].split``.map(v=>v|0);
  const K = tmp[1]|0;
  for ( let i = 0;; i++ ) {
    if ( i === K || S[i] !== 1 ) return `${S[i]}`
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
'use strict'
function main(input) {
  input = input.trim().split('\n')
  const num = input.shift().split('')
  if (num[0] === '1') {
    if (input[0] === '1') {
      return console.log('1')
    }
    while (num.length) {
      num.shift()
      if (num[0] !== '1') break
    }
  }

  console.log(num.length ? num[0] : '1')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() 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 main() {
	s := next()
	k := nextInt()

	index := 0
	for i := 0; i < len(s) && i < k; i++ {
		if s[i] != '1' {
			index = i
			break
		}
	}

	fmt.Println(string(s[index]))
}
//  [go]
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)

	var s string
	if scanner.Scan() {
		s = scanner.Text()
	}

	var k int64
	if scanner.Scan() {
		tmp := scanner.Text()
		k, _ = strconv.ParseInt(tmp, 10, 64)
	}

	for i, c := range s {
		switch c {
		case '1':
			if int64(i) == k-1 {
				fmt.Println(1)
				return
			} else {
				continue
			}
		default:
			fmt.Println(string(c))
			return
		}
	}
}
//  [go]
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s, K := getString(), getInt()
	for i, v := range s {
		if v != '1' {
			out(string(v))
			return
		}
		// out(i)
		if i+1 == K {
			out(string(v))
			return
		}
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	s := nextStr()
	k := nextInt64()

	for i := 0; i < len(s); i++ {
		if s[i] != '1' {
			fmt.Println(string(s[i]))
			return
		} else if int64(i) == k {
			break
		}
	}
	fmt.Println(1)
	return

}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
func nextInt64() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()
	//lastday := 5000 * 1000 * 1000 * 1000 //5*10^12
	s := nextStr()
	k := nextInt64()

	// 1なら終了
	if k < int64(len(s)) {
		only1 := true
		for i := 0; int64(i) < k; i++ {
			if s[i] != '1' {
				only1 = false
			}
		}
		if only1 == true {
			fmt.Println(1)
			return
		}
	}

	for i := 0; i < len(s); i++ {
		if s[i] != '1' {
			fmt.Println(string(s[i]))
			return
		}
	}

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
func nextInt64() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}
//  [go]
package main

import "fmt"

func main() {
	var (
		S string
		K int
	)
	fmt.Scan(&S, &K)

	for i, s := range S {
		if rune(s) != '1' {
			fmt.Println(string(s))
			return
		}
		if i == K {
			fmt.Println(string(s))
			return
		}
	}
}
//  [ruby]
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=5000_0000_0000_0000
s=get_nsp.map(&:to_i)
k=gets.to_i
i=0
while true
  if s[i]==1
    break unless k>1
    i+=1
    k-=1
  else
    break
  end
end
puts s[i]
//  [ruby]
s = gets.chomp.to_s.split(//)
n = gets.chomp.to_i
i = 0
 
s.each do |j|
  if j == "1"
    i += 1
  else
    break
  end
end
 
puts i >= n ? 1: s[i]