import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    } main {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc long cnt = 0; cnt 0 for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	} int i = 0; int i = 0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	} {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	} int n = Character.getNumericValue(S.charAt(i)); n Character.getNumericValue(S.charAt(i)) Character.getNumericValue Character S.charAt(i) S.charAt S i int x = 5000; x 5000 long k = 1; k 1 for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    } int j = 0; int j = 0; j 0 j< 4 j 4 j++ j++ j {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    } {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    } k = (long)Math.pow(n,x)*k k (long)Math.pow(n,x)*k (long)Math.pow(n,x) Math.pow Math n x k if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		} k>=Long.MAX_VALUE k Long.MAX_VALUE Long Long.MAX_VALUE {
		    System.out.println(n);
		    return;
		} System.out.println(n) System.out.println System.out System System.out n return; x = 1000 x 1000 cnt = cnt + k cnt cnt + k cnt k if(cnt >= K) {
		System.out.println(n);
		return;
	    } cnt >= K cnt K {
		System.out.println(n);
		return;
	    } System.out.println(n) System.out.println System.out System System.out n return; String[] args args
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
	long K = sc.nextLong();
	long cnt = 0;
	for(int i = 0; i<S.length(); i++) {
	    int n = Character.getNumericValue(S.charAt(i));
	    int x = 5000;
	    long k = 1;
	    for(int j = 0; j< 4; j++) {
		k = (long)Math.pow(n,x)*k;
		if(k>=Long.MAX_VALUE) {
		    System.out.println(n);
		    return;
		}
		x = 1000;
	    }
	    cnt = cnt + k;
	    //System.out.println(k);
	    if(cnt >= K) {
		System.out.println(n);
		return;
	    }
	}
    }
}