import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    long b[];
    boolean stat;
    boolean x[];
	public void solve(int testNumber, InputReader in, PrintWriter out) {
        int i,j;
        long s=in.nextInt();
        int k=in.nextInt();
        long sum=0;
        long a[]=new long[50];
        a[0]=a[1]=1;
        int n=2;
        while (sum<s)
        {
            sum=0;
            for(i=Math.max(0,n-k);i<n;i++)
                sum+=a[i];
            a[n++]=sum;
        }
        b=new long[n-1];
        x=new boolean[n-1];
        for(i=1;i<n;i++)
            b[i-1]=a[i];
        for(i=0;i<n-1;i++)
            if(b[i]==s)
            {
                out.println(2);
                out.println("0 "+s);
                return;
            }
        stat=false;
        subsetSum(0,s,new boolean[n-1]);
        int m=0;
        for(i=0;i<n-1;i++)
            if(x[i])
                m++;
        out.println(m);
            for(i=0;i<n-1;i++)
            if(x[i])
                out.print(b[i]+" ");
	}
    public void subsetSum(int i,long s,boolean a[])
    {
        if(s==0)
        {
            stat=true;
            System.arraycopy(a,0,x,0,a.length);
        }
        else if(i<x.length&&s>0&&!stat)
        {
            a[i]=true;
            subsetSum(i+1,s-b[i],a);
            a[i]=false;
            subsetSum(i+1,s,a);
        }
    }
}

class InputReader
{
    BufferedReader in;
    StringTokenizer tokenizer=null;

    public InputReader(InputStream inputStream)
    {
        in=new BufferedReader(new InputStreamReader(inputStream));
    }
    public String next()
    {
        try{
            while (tokenizer==null||!tokenizer.hasMoreTokens())
            {
                tokenizer=new StringTokenizer(in.readLine());
            }
            return tokenizer.nextToken();
        }
        catch (IOException e)
        {
            return null;
        }
    }
    public int nextInt()
    {
        return Integer.parseInt(next());
    }

}


import com.sun.deploy.util.ArrayUtil;

import java.io.*;
import java.math.*;
import java.util.*;
import java.time.*;
import java.util.regex.*;

public class Main {
    static long arr[];
    static int s;

    public static void main(String[] args) throws IOException {

        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);

        s = in.nextInt();
        int k = in.nextInt();
        Set<Long> st = new TreeSet();
        arr = new long[100];

        arr[0] = 1;

        st.add(1L);
        for (int i = k+1; arr[i-k-1]<s ; i++) {

            for (int j = 1; j <= k; j++) {
                if(i-j-k>=0) {
                    arr[i - k] += arr[i - j - k];
                }
                else
                    break;
            }
            st.add(arr[i-k]);
        }

        arr = new long[st.size()];
        int i=arr.length-1;
        for (Long val: st) {
            if(val!=0L)
            arr[i--] = val;

        }

        ArrayList<Long> result = new ArrayList();
        solve(0, 0, result);
        if(result.size()==1)
            result.add(0L);
        out.println(result.size());
        StringBuilder sb = new StringBuilder();
        for (int j = 0; j < result.size(); j++) {
            sb.append(result.get(j)+" ");
        }
        out.println(sb);

        out.close();

    }

    static boolean  solve(int i, long sum, ArrayList<Long> result){

        if(sum == s)return true;

        if(i>=arr.length || sum>s)return false;

        result.add(arr[i]);

        if(solve(i+1, sum+arr[i], result))
            return true;

        result.remove(result.size()-1);

        return solve(i+1, sum, result);
    }
    static class Comp implements Comparator<Long>{

        public int compare(Long x, Long y){
           if(x>y)return -1;
           return 1;
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

}


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

public class C {

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		int x = sc.nextInt()-1;
		int y = sc.nextInt()-1;

		long[][] arr= new long[n][m];

		if(n!=1 || m!=1)
		{
			if(n!=1)
			{
				long periods = k/(1l*n*m+1l*m*(n-2));
				//System.out.println(periods);
				long remain = k%(1l*n*m+1l*m*(n-2));
				//for()
				//int j = 0;
				for(int i=0;i<n;i++)
					if(i == 0 || i == n-1)
						Arrays.fill(arr[i], periods);
					else
						Arrays.fill(arr[i], 2*periods);

				k = remain;
			}
			int i = 0;
			boolean up = true;
			while(k>0)
			{
				//System.out.println(k);
				for(int j=0;j<m && k>0;j++,k--)
					arr[i][j]++;
				if(i==0)
				{
					i=Math.min(1, n-1);
					up = true;
				}
				else
					if(i==n-1)
					{
						i=n-2;
						up = false;
					}
					else
						if(up)
							i++;
						else
							i--;
			}

			long min = Long.MAX_VALUE;
			long max = 0;
			for(i=0;i<n;i++)
				for(int j=0;j<m;j++)
				{
					min = Math.min(min, arr[i][j]);
					max = Math.max(max, arr[i][j]);
				}

			System.out.println(max + " " + min + " " + arr[x][y]);
		}
		else
		{
			System.out.println(k +" " + k + " " + k);
		}
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}
	}

}


import java.util.Scanner;

public class ProblemC {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		long[][] R=new long[n][m];
		long k=sc.nextLong();
		long x=sc.nextLong();
		long y=sc.nextLong();

		if(n==1){
				while(k>0){
					for(int i=0;i<n && k>0;i++){
					for(int j=0;j<m && k>0;j++){
						R[i][j]++;
						k--;
						}
					}
				}
			}
		if(n>1){
			long total=(m)*(n-1);
			long g=k/((2)*total);
			long rem2=k%(total*2);
			if(g>=1){
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					if(i==0 || i==n-1){
						R[i][j]=g;
					}
					else
					R[i][j]=g*2;
				}
			}
			}/*for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					System.out.print(R[i][j]+" ");
				}
			}*/
			boolean loop1=true;
			while(rem2>0){
				if(loop1){
			for(int i=0;i<n && rem2>0;i++){
				for(int j=0;j<m && rem2>0;j++){
					R[i][j]++;
					rem2--;
						}
					}
			loop1=false;
				}
				else{
					for(int i=n-2;i>=0 && rem2>0;i--){
						for(int j=0;j<m && rem2>0;j++){
							R[i][j]++;
							rem2--;
						}
					}
				}
				}
		}
			/*for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					System.out.print(R[i][j]+" ");
				}
			}*/
		long max=0;
		long min=R[0][0];
		long Sergey=0;
			for(int i=0;i<n;i++){
				for(int j=0;j<m;j++){
					if(i==(x-1) && j==(y-1)){
						Sergey=R[i][j];
					}
					if(max<R[i][j]){
						max=R[i][j];
					}
					if(min>R[i][j]){
						min=R[i][j];
					}
				}
			}
			System.out.println(max+" "+min+" "+Sergey);
			sc.close();
		}

}


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

public class C2 {
	final static long MOD = 1000000007;
	static int[][] ar;
	static int[] ar1;

	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		long k = in.nextLong();
		int x = in.nextInt();
		int y = in.nextInt();
		if (n == 1) {
			ar1 = new int[m];
			long basicQuestions = k / m;
			long remainK = (long)(k % m);
			long maxQ = 0; long minQ = 0; long serQ = 0;
			for (int j = 0; j < m; j++) {
				if (remainK == 0) break;
				remainK--;
				ar1[j]++;
			}
			for (int j = 0; j < m; j++) {
				maxQ = Math.max(maxQ, ar1[j]);
				minQ = Math.min(minQ, ar1[j]);
			}
			maxQ += basicQuestions;
			minQ += basicQuestions;
			serQ = ar1[y-1] + basicQuestions;
			System.out.println(maxQ + " " + minQ + " " + serQ);
			return;
		}
		long round = n * m + (n -2) * m;
		long basicQuestions = k / round;
		long remainK = (long)(k % round);
		long maxQ = 0; long minQ = 0; long serQ = 0;
		ar = new int[n][m];
		for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
			if (remainK == 0) break;
			remainK--;
			ar[i][j]++;
		}
		for (int i = n-2; i > 0; i++) for (int j = 0; j < m; j++) {
			if (remainK == 0) break;
			remainK--;
			ar[i][j]++;
		}
		for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
			maxQ = Math.max(maxQ, ar[i][j]);
			minQ = Math.min(minQ, ar[i][j]);
		}
		maxQ += basicQuestions;
		minQ += basicQuestions;
		serQ = ar[x-1][y-1] + basicQuestions;
		System.out.println(maxQ + " " + minQ + " " + serQ);
	}
}


public class UnfairPoll
{
    public static long ceil(long x, long y)
    {
        if(x % y == 0)
            return x / y;
        else
            return x / y  + 1;
    }

    public static void main(String [] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); int m = in.nextInt(); long k = in.nextLong();
        int x = in.nextInt(); int y = in.nextInt();

        long max = 0; long min = 0; long sergei = 0;

        if(k <= m * n)
        {
            max = ceil(k, m * n);
            min = k / (m * n);
            sergei = (k >= m * (x - 1) + y) ? 1 : 0;
        }
        else
        {
            long mod = 0;
            if(n > 1)
            {
                mod = (k - m) % ((n - 1) * m);
                max = ceil(k - m, (n - 1) * m);
                min = max / 2 + ((max % 2) * (mod == 0 ? 1 : 0));
            }
            else
            {
                mod = k % m;
                max = ceil(k, m);
                min = k / m;
            }

            if(x == 1)
            {
                if(n > 1)
                {
                    sergei = ceil(max, 2);
                    if((max % 2 == 0 && ((n - ceil(mod, m) < x) || (n - ceil(mod, m) == x && (mod + m - 1) % m + 1 >= y))))
                        sergei++;
                }
                else
                    sergei = min + ((mod >= y) ? 1 : 0);
            }
            else
            if(x == n)
            {
                sergei = min;
                if(max % 2 == 1 && mod >= (x - 2) * m + y)
                    sergei++;
            }
            else
            {
                sergei = max;
                if(!((max % 2 == 1 && mod >= (x - 2) * m + y)
                        || (max % 2 == 0 && ((n - ceil(mod, m) < x) || (n - ceil(mod, m) == x && (mod + m - 1) % m + 1 >= y)))))
                    sergei--;
            }

            if(n == 2)
                max = min + (mod > 0 ? 1 : 0);
        }

        System.out.println(max + " " + min + " " + sergei);
    }
}


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

public class Main {
    public static void main(String args[]){

        try {
            BufferedReader d = new BufferedReader(new InputStreamReader(System.in));

            /******点数の数、各点数の人数、x,yの読込み******/
            int num = Integer.parseInt(d.readLine());
            String[] str = d.readLine().split(" ");

            int[] point = new int[num]; // 各点数の人数

            for(int i = 0; i < num; i++){
                point[i] = Integer.parseInt(str[i]); // 各点数の人数を格納
            }

            int x = 0;
            int y = 0;
            String[] str2 = d.readLine().split(" ");
            x = Integer.parseInt(str2[0]);
            y = Integer.parseInt(str2[1]);
            /****************************************/

            System.out.println(solve(point, num, x, y));

        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static int solve(int[] point, int num, int x, int y) {
        int border = 0; // passing rate
        int sumOfInterGp = 0; // 中級クラスの人数
        int sumOfBigiGp = 0; // 初心者クラスの人数

        for(int i = 0; i < num - 1; i++){
            sumOfBigiGp += point[i]; // 初心者クラスの人数を算出
            sumOfInterGp = sumOfRest(i + 1, num, point); // 中級クラスの人数を算出
            if(sumOfBigiGp >= x && sumOfBigiGp <= y){ // 初心者クラスの人数がクラス人数の範囲内ならば中級クラスの人数をチェック
                if(sumOfInterGp >= x && sumOfInterGp <= y){ // 中級クラスの人数が適切ならpassing rateを算出
                    border = i + 2;
                    return border;
                }
            }
            else if(sumOfInterGp < x){
                return 0;
            }
        }
        return 0;
    }

    /***************i点より点数の高い学生の数を数える関数***************/
    private static int sumOfRest(int i, int num, int[] point) {
        int sumOfRest = 0;

        for(int j = i; j < num; j++){
            sumOfRest += point[j];
        }

        return sumOfRest;
    }
    /**********************************************************/
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Erasyl Abenov
 *
 *
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
            try (PrintWriter out = new PrintWriter(outputStream)) {
                TaskB solver = new TaskB();
                solver.solve(1, in, out);
            }
    }
}
class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
       int n = in.nextInt();
       int ball[] = new int[n];
       int sumOfBeginer = 0;
       int sumOfAdvanced = 0;
       for(int i = 0; i < n; ++i){
           ball[i] = in.nextInt();
       }
       int lowestPassingScore = 0;
       int x = in.nextInt();
       int y = in.nextInt();
       for(int i = 0; i < n; ++i){
           sumOfBeginer += ball[i];
           lowestPassingScore = i + 2;
           if(sumOfBeginer <= y){
               if(sumOfBeginer >= x){
                  for(int j = i + 1; j < n; ++j){
                      sumOfAdvanced += ball[j];
                  }
                  else if(Math.min(sumOfBeginer, sumOfAdvanced) >= x && Math.max(sumOfBeginer, sumOfAdvanced) <= y){
                      out.println(lowestPassingScore);
                      return;
                  }
                  sumOfAdvanced = 0;
               }
           }else break;
       }
       out.println(0);
    }
}

class InputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;
    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

public class Main {
    public static void main(String args[]){

        BufferedReader d = new BufferedReader(new InputStreamReader(System.in));

        try {
            /******点数の数、各点数の人数、x,yの読込み******/
            int num = Integer.parseInt(d.readLine());
            String[] str = d.readLine().split(" ");

            int[] point = new int[num]; // 各点数の人数

            for(int i = 0; i < num; i++){
                point[i] = Integer.parseInt(str[i]); // 各点数の人数を格納
            }

            int x = 0;
            int y = 0;
            String[] str2 = d.readLine().split(" ");
            x = Integer.parseInt(str2[0]);
            y = Integer.parseInt(str2[1]);
            /****************************************/

            System.out.println(solve(point, num, x, y));

        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static int solve(int[] point, int num, int x, int y) {
        int border = 0; // passing rate
        int sumOfInterGp = 0; // 中級クラスの人数
        int sumOfBigiGp = 0; // 初心者クラスの人数

        for(int i = 0; i < num - 1; i++){
            sumOfBigiGp += point[i]; // 初心者クラスの人数を算出
            sumOfInterGp = sumOfRest(i + 1, num, point); // 中級クラスの人数を算出
            if(sumOfBigiGp >= x && sumOfBigiGp <= y){ // 初心者クラスの人数がクラス人数の範囲内ならば中級クラスの人数をチェック
                if(sumOfInterGp >= x && sumOfInterGp <= y){ // 中級クラスの人数が適切ならpassing rateを算出
                    border = i + 2;
                    return border;
                }
            }
            else if(sumOfInterGp < x){
                return 0;
            }
        }
        return 0;
    }

    /***************i点より点数の高い学生の数を数える関数***************/
    private static int sumOfRest(int i, int num, int[] point) {
        int sumOfRest = 0;

        for(int j = i; j < num; j++){
            sumOfRest += point[j];
        }

        return sumOfRest;
    }
    /**********************************************************/
}


import java.io.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Task {
    public void run() throws Exception {
        final int m = in.nextInt();
        final int[] c = in.nextInts();
        final int x = in.nextInt(), y = in.nextInt();

        int[] lsum = new int[m+1];
        int[] psum = new int[m+1];
        lsum[0] = 0;
        for(int i = 0; i < m; i++) {
            lsum[i + 1] = lsum[i] + c[i];
            psum[m - i - 1] = psum[m - i] + c[m - 1 - i];
        }

        for(int i = m; i >= 0; i--) {
            boolean match1 = x <= lsum[i] && lsum[i] <= y;
            boolean match2 = x <= psum[i] && psum[i] <= y;
            if(match1 && match2) {
                println(i+1);
                return;
            }
        }
        return 0;
    }

    // other stuff
    public void println(Object o) {
        System.out.println(o);
    }
    public void print(Object o) {
        System.out.println(o);
    }
    private final MyReader in = new MyReader();
    private static class MyReader {
        private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer tokenizer = null;
        public String nextToken() throws Exception {
            if(tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }
        public int nextInt() throws Exception {
            return Integer.parseInt(nextToken());
        }
        public double nextDouble() throws Exception {
            return Double.parseDouble(nextToken());
        }
        public long nextLong() throws Exception {
            return Long.parseLong(nextToken());
        }
        public BigInteger nextBigInteger() throws Exception {
            return new BigInteger(nextToken());
        }
        public List<Integer> nextIntegerList() throws Exception {
            if(tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            final List<Integer> data = new ArrayList<Integer>(tokenizer.countTokens());
            while(tokenizer.hasMoreTokens()) {
                data.add(new Integer(tokenizer.nextToken()));
            }
            return data;
        }
        public int[] nextInts() throws Exception {
            if(tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            final int[] data = new int[tokenizer.countTokens()];
            for(int i = 0; i < data.length; i++) {
                data[i] = nextInt();
            }
            return data;
        }
    }
    public static void main(String[] args) throws Exception {
        new Task().run();
    }
}


import java.util.*;
import java.util.ArrayList;

public class v
{
    public static void main(String args[])
    {
        String a= "1"
        int=String.parseInt("a");
        return;
        Scanner sc=new Scanner(System.in);
        int mom=sc.nextInt();
        long[] bro= new long[mom];
        String coo= sc.nextLine();
        sc.close();
        for(int lam=mom-1;lam>=0;lam--)
        {
            bro[lam]=String.parseInt(coo.substring(coo.length()-1));
            coo=coo.substring(0,coo.length()-1);
            if(coo.equals(coo.substring(0,1)))
            {break;}
        }
        boolean q= false;
        int point=0;
       while(point<mom-1)
        {
            int moose=0;
            int curry=0;
            for(int re=0;re<=point;re++)
            {
                moose+=bro[re];
            }
            for(int re=point+1;re<bro.length;re++)
            {
                curry+=bro[re];
                    if(curry==moose)
                    {
                        if(re==bro.length-1)
                        {
                            q=true;
                        }
                        if(re<bro.length-1&&bro[re+1]==0)
                        {}
                        else
                        {curry=0;}
                    }
            }
            point++;
        }
        if(q)
        {
        System.out.println("YES");
        }
        else
        {
        System.out.println("NO");
        }
    }
}


import java.util.*;
import java.util.ArrayList;
import java.util.String;

public class v
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int mom=sc.nextInt();
        long[] bro= new long[mom];
        String coo= sc.nextLine();
        sc.close();
        for(int lam=mom-1;lam>=0;lam--)
        {
            bro[lam]=String.parseInt(coo.substring(coo.length()-1));
            coo=coo.substring(0,coo.length()-1);
            if(coo.equals(coo.substring(0,1)))
            {break;}
        }
        boolean q= false;
        int point=0;
       while(point<mom-1)
        {
            int moose=0;
            int curry=0;
            for(int re=0;re<=point;re++)
            {
                moose+=bro[re];
            }
            for(int re=point+1;re<bro.length;re++)
            {
                curry+=bro[re];
                    if(curry==moose)
                    {
                        if(re==bro.length-1)
                        {
                            q=true;
                        }
                        if(re<bro.length-1&&bro[re+1]==0)
                        {}
                        else
                        {curry=0;}
                    }
            }
            point++;
        }
        if(q)
        {
        System.out.println("YES");
        }
        else
        {
        System.out.println("NO");
        }
    }
}


import java.util.*;
import java.util.ArrayList;

public class v
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int mom=sc.nextInt();
        int[] bro= new int[mom];
        String coo= sc.nextString();
        sc.close();
        for(int lam=0;lam<bro.length;lam++)
        {
            bro[lam]=Integer.parseInt(coo.substring(lam,lam+1));
        }
        boolean q= false;
        int point=0;
       while(point<mom-1)
        {
            int moose=0;
            int curry=0;
            for(int re=0;re<=point;re++)
            {
                moose+=bro[re];
            }
            for(int re=point+1;re<bro.length;re++)
            {
                curry+=bro[re];
                    if(curry==moose)
                    {
                        if(re==bro.length-1)
                        {
                            q=true;
                        }
                        if(re<bro.length-1&&bro[re+1]==0)
                        {}
                        else
                        {curry=0;}
                    }
            }
            point++;
        }
        if(q)
        {
        System.out.println("YES");
        }
        else
        {
        System.out.println("NO");
        }
    }
}


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

        int n = scanner.nextInt();
        int[] array = new int[n];

        String intString = scanner.next();

        for (int i = 0; i < intString.length(); i++) {
            array[i] = Character.getNumericValue(intString.charAt(i));
        }

        int xPos = 1;
        int happySegment = array[0];

        int sum = 0;
        boolean success = true;

        for (int i = xPos; i <= intString.length(); i++) {
            if (sum > happySegment) {
                happySegment+=array[xPos];
                xPos++;
                i = xPos;
                sum = 0;
            }
            if (sum == happySegment) {
                sum = 0;
                success = true;
            } else {
                success = false;
            }

            if (i < intString.length())
                sum += array[i];
        }

        if (success) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


//package Contest515div3;

import java.io.PrintWriter;
import java.sql.SQLOutput;
import java.util.*;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
          int n=enter.nextInt();
          point mass[] =new point[n+1];
        for (int i = 0; i <n ; i++) {
            mass[i]=new point(enter.nextLong(),enter.nextLong());
        }
        mass[n]=new point((long)1e10,(long)1e10);
        Arrays.sort(mass,0,n);
        ArrayList<point> arrayList=new ArrayList<>(n);
        //arrayList.add(mass[0]);
        arrayList.add(new point(0,0));
        arrayList.add(new point(0,0));

       // System.out.println(Arrays.toString(mass));
        for (int i = 0; i <n ; i++) {
            if(Math.max(mass[i+1].x,mass[i+1].y)>Math.max(mass[i].x,mass[i].y)){
                if(i==0){
                    arrayList.add(mass[i]);
                }
                arrayList.add(mass[i]);
                arrayList.add(mass[i+1]);
            }
        }

        //arrayList.remove(arrayList.size()-1);
        //System.out.println(arrayList);
        long dp[]=new long[2*n];
        int last=0;
        for (int i = 2; i <arrayList.size()-1 ; i+=2) {
            dp[i]=Math.min(dist(arrayList.get(i+1),arrayList.get(i-1))+dp[i-1],dist(arrayList.get(i+1),arrayList.get(i-2))+dp[i-2])+dist(arrayList.get(i),arrayList.get(i+1));
            dp[i+1]=Math.min(dist(arrayList.get(i),arrayList.get(i-1))+dp[i-1],dist(arrayList.get(i),arrayList.get(i-2))+dp[i-2])+dist(arrayList.get(i),arrayList.get(i+1));
            last=i+1;
        }
        out.println(Math.min(dp[last],dp[last-1]));
        out.close();
    }

    public static long dist(point a,point b){
        return Math.abs(a.x-b.x)+Math.abs(a.y-b.y);

    }

}

class point implements Comparable<point>{
    long x,y;

    public point(long x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public int compareTo(point o) {
        if(Math.max(x,y)<Math.max(o.x,o.y)) return -1;
        else if(Math.max(x,y)>Math.max(o.x,o.y)) return 1;
        else{
             if(y==o.y){
                return (x<=o.x)? -1: 1;
            }
            else if(x==o.x){
                 return (y>=o.y)? -1: 1;
             }
             else{
                 return (x<=o.x)? -1: 1;
             }
        }
    }

    @Override
    public String toString() {
        return "("+x+", "+y+")";
    }
}


//package Contest515div3;

import java.io.PrintWriter;
import java.sql.SQLOutput;
import java.util.*;

public class mainF {
    public static Scanner enter = new Scanner(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {
          int n=enter.nextInt();
          point mass[] =new point[n+1];
        for (int i = 0; i <n ; i++) {
            mass[i]=new point(enter.nextLong(),enter.nextLong());
        }
        mass[n]=new point((long)1e10,(long)1e10);
        Arrays.sort(mass,0,n);
        ArrayList<point> arrayList=new ArrayList<>(n);
        //arrayList.add(mass[0]);
        arrayList.add(new point(0,0));
        arrayList.add(new point(0,0));

       // System.out.println(Arrays.toString(mass));
        for (int i = 0; i <n ; i++) {
            if(Math.max(mass[i+1].x,mass[i+1].y)>Math.max(mass[i].x,mass[i].y)){
                if(i==0){
                    arrayList.add(mass[i]);
                }
                arrayList.add(mass[i]);
                arrayList.add(mass[i+1]);
            }
        }

        arrayList.remove(arrayList.size()-1);
        //System.out.println(arrayList);
        long dp[]=new long[(int)1e6];
        int last=0;
        for (int i = 2; i <arrayList.size() ; i+=2) {
            dp[i]=Math.min(dist(arrayList.get(i+1),arrayList.get(i-1))+dp[i-1],dist(arrayList.get(i+1),arrayList.get(i-2))+dp[i-2])+dist(arrayList.get(i),arrayList.get(i+1));
            dp[i+1]=Math.min(dist(arrayList.get(i),arrayList.get(i-1))+dp[i-1],dist(arrayList.get(i),arrayList.get(i-2))+dp[i-2])+dist(arrayList.get(i),arrayList.get(i+1));
            last=i+1;
        }
        out.println(Math.min(dp[last],dp[last-1]));
        out.close();
    }

    public static long dist(point a,point b){
        return Math.abs(a.x-b.x)+Math.abs(a.y-b.y);

    }

}

class point implements Comparable<point>{
    long x,y;

    public point(long x, long y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public int compareTo(point o) {
        if(Math.max(x,y)<Math.max(o.x,o.y)) return -1;
        else if(Math.max(x,y)>Math.max(o.x,o.y)) return 1;
        else{
             if(y==o.y){
                return (x<=o.x)? -1: 1;
            }
            else if(x==o.x){
                 return (y>=o.y)? -1: 1;
             }
             else{
                 return (x<=o.x)? -1: 1;
             }
        }
    }

    @Override
    public String toString() {
        return "("+x+", "+y+")";
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

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

    static class TaskF {
        static void addPoint(ArrayList<Integer>[] points, int idx, int coord) {
            if (points[idx] == null)
                points[idx] = new ArrayList<>();
            points[idx].add(coord);
        }

        static long getDist(TaskF.Point p1, TaskF.Point p2) {
            return Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y);
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.ni();
            int MAX_LEN = 200007;
            long INF = Long.MAX_VALUE;
            ArrayList<Integer>[] ypoints = new ArrayList[MAX_LEN];
            ArrayList<Integer>[] xpoints = new ArrayList[MAX_LEN];
            for (int i = 0; i < n; i++) {
                int x = in.ni();
                int y = in.ni();
                if (x >= y) {
                    addPoint(xpoints, x, y);
                } else {
                    addPoint(ypoints, y, x);
                }
            }
            for (int i = 0; i < MAX_LEN; i++) {
                if (xpoints[i] != null)
                    Collections.sort(xpoints[i]);
                if (ypoints[i] != null)
                    Collections.sort(ypoints[i]);
            }
            long[] levelDist = new long[MAX_LEN];
            TaskF.Point[][] levelPoints = new TaskF.Point[MAX_LEN][2];
            levelPoints[0][0] = levelPoints[0][1] = new TaskF.Point(0, 0);
            for (int i = 0; i < MAX_LEN; i++) {
                if (xpoints[i] == null && ypoints[i] == null)
                    continue;
                long dist = 0;
                if (xpoints[i] != null) {
                    int maxy = xpoints[i].get(xpoints[i].size() - 1);
                    dist = maxy - xpoints[i].get(0);
                    levelPoints[i][0] = new TaskF.Point(i, xpoints[i].get(0)); //min point
                    levelPoints[i][1] = new TaskF.Point(i, maxy);
                }
                if (ypoints[i] != null) {
                    int maxx = ypoints[i].get(ypoints[i].size() - 1);
                    dist += maxx - ypoints[i].get(0);
                    if (xpoints[i] == null) {
                        levelPoints[i][0] = new TaskF.Point(maxx, i);
                        levelPoints[i][1] = new TaskF.Point(ypoints[i].get(0), i);
                    } else {
                        dist += getDist(levelPoints[i][1], new TaskF.Point(ypoints[i].get(ypoints[i].size() - 1), i));
                        levelPoints[i][1] = new TaskF.Point(ypoints[i].get(0), i);
                    }
                }
                levelDist[i] = dist;
            }
            long d[][] = new long[MAX_LEN][2];
            int prevLevel = 0;
            for (int level = 1; level < MAX_LEN; level++) {
                if (xpoints[level] == null && ypoints[level] == null) {
                    continue;
                }
                assert levelPoints[level][0] != null;
                assert levelPoints[level][1] != null;
                assert levelPoints[prevLevel][0] != null;
                assert levelPoints[prevLevel][1] != null;
                d[level][0] += Math.min(d[prevLevel][0] + getDist(levelPoints[level][1], levelPoints[prevLevel][0]), d[prevLevel][1] + getDist(levelPoints[level][1], levelPoints[prevLevel][1])) + levelDist[level];
                d[level][1] += Math.min(d[prevLevel][0] + getDist(levelPoints[level][0], levelPoints[prevLevel][0]), d[prevLevel][1] + getDist(levelPoints[level][0], levelPoints[prevLevel][1])) + levelDist[level];
                prevLevel = level;
            }

            out.println(Math.min(d[prevLevel][0], d[prevLevel][1]));
        }

        static class Point {
            int x;
            int y;

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }

        }

    }

    static class InputReader extends BufferedReader {
        public InputReader(InputStream st) {
            super(new InputStreamReader(st));
        }

        public String readLine() {
            try {
                return super.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        private int readByte() {
            try {
                return read();
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }

        public int ni() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

    }
}


import java.util.*;

import cf1.pair;

import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;

/* spar5h */

public class cf6{

	static int[] left, down, val;
	static long[][] dp;

	static void recur(int i, int d, int m, int x, int y) {

		if(i == m) {
			 dp[i][d] = 0; return;
		}

		dp[i][d] = Long.MAX_VALUE;

		int x1, y1;

		if(left[i + 1] != -1) {
			x1 = left[i + 1]; y1 = val[i + 1];
		}
		else {
			x1 = val[i + 1]; y1 = down[i + 1];
		}

		int x2, y2;

		if(down[i + 1] != -1) {
			x2 = val[i + 1]; y2 = down[i + 1];
		}
		else {
			x2 = left[i + 1]; y2 = down[i + 1];
		}

		int dist = abs(x1 - x2) + abs(y1 - y2);

		if(dp[i + 1][0] == -1)
			recur(i + 1, 0, m, x2, y2);

		dp[i][d] = min(abs(x - x1) + abs(y - y1) + dist + dp[i + 1][0], dp[i][d]);

		if(dp[i + 1][1] == -1)
			recur(i + 1, 1, m, x1, y1);

		dp[i][d] = min(abs(x - x2) + abs(y - y2) + dist + dp[i + 1][1], dp[i][d]);
	}

	public static void main(String[] args) {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int n = s.nextInt();

		int[] x = new int[n];
		int[] y = new int[n];

		TreeSet<Integer> ts = new TreeSet<Integer>();

		for(int i = 0; i < n; i++) {

			x[i] = s.nextInt();
			y[i] = s.nextInt();

			ts.add(max(x[i], y[i]));
		}

		int m = 0;
		val = new int[ts.size() + 1];

		HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
		hm.put(0, 0);

		for(int i : ts) {
			m = m + 1; val[m] = i; hm.put(i, m);
		}

		left = new int[m + 1];
		Arrays.fill(left, -1);

		down = new int[m + 1];
		Arrays.fill(down, -1);

		for(int i = 0; i < n; i++) {

			int j = hm.get(max(x[i], y[i]));

			if(x[i] == max(x[i], y[i])) {

				if(down[j] == -1 || y[i] < down[j])
					down[j] = y[i];
			}

			else {

				if(left[j] == -1 || x[i] < left[j])
					left[j] = x[i];
			}
		}

		dp = new long[m + 1][2];

		for(int i = 0; i <= m; i++)
			for(int j = 0; j < 2; j++)
				dp[i][j] = -1;

		recur(0, 0, m, 0, 0);

		w.println(dp[0][0]);

		w.close();
	}

	static 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 String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			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 long nextLong()
		{
			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 double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			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 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);
		}
	}

}


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

public class HelloWorld {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

    public static void main(String[] args) throws IOException {
        FastReader scn = new FastReader();
        OutputStream out = new BufferedOutputStream(System.out);
        program(scn, out);
        out.flush();
    }

    public static void print(OutputStream out, Object str) throws IOException {
        out.write(str.toString().getBytes());
    }

    static class Length implements Comparable<Length> {
        Integer length;

        public Length(int length) {
            this.length = length;
        }

        @Override
        public int compareTo(Length o) {
            return o.length - this.length;
        }
    }

    private static void program(FastReader scn, OutputStream out) throws IOException {
        int n = scn.nextInt();
        int a = scn.nextInt();
        int b = scn.nextInt();
        PriorityQueue<Length> priorityQueue = new PriorityQueue<>();
        Integer ans = 0;
        priorityQueue.add(new Length(n - a));
        ans = 1;
        ans = helper(priorityQueue, ans, a, n);
        ans = helper(priorityQueue, ans, a, n);
        ans = helper(priorityQueue, ans, a, n);
        ans = helper(priorityQueue, ans, b, n);
        ans = helper(priorityQueue, ans, b, n);
        print(out, ans);
    }

    private static Integer helper(PriorityQueue<Length> priorityQueue, Integer ans, int a, int n) {
        Length k = priorityQueue.poll();
        if (k.length >= a) {
            priorityQueue.add(new Length(k.length - a));
        } else {
            priorityQueue.add(new Length(n - a));
            priorityQueue.add(k);
            ans++;
        }
        return ans;
    }

}


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

/**
 * Created by trung.pham on 27/12/17.
 */
public class B_Testing_Round_14 {
    static int[][][]dp;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        dp = new int[n + 1][5][3];
        for(int [][]x : dp){
            for(int[]y : x){
                Arrays.fill(y, -1);
            }
        }
        out.println(cal(n, 4, 2, n, a, b));
        out.close();
    }

    public static int cal(int left, int a, int b, int n, int A, int B){
        if(a == 0 && b == 0){
            return 1;
        }
        if(dp[left][a][b] != -1){
            return dp[left][a][b];
        }
        int result = Integer.MAX_VALUE;
        if(left >= A && a > 0){
            result = cal(left - A, a - 1, b, n,  A, B);
        }
        if(left >= B && b > 0){
            result = Math.min(result , cal(left - B, a, b - 1, n , A, B));
        }
        if(left < A && left < B){
            result = 1 + cal(n, a, b, b, A, B);
        }
        return dp[left][a][b] = result;
    }
}


package solution;

import java.util.*;

public class Solution {

    public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);
      int n,a,b;
      int pieces,ans,r;
      ArrayList<Integer> rP= new ArrayList<Integer>();
      n=sc.nextInt();
      a=sc.nextInt();
      b=sc.nextInt();
      ans=1;
      r=0;
      pieces=n/a;
      if(pieces>=4)
      {
          rP.add(n-(a*4));
      }else if(pieces==3)
      {
          ans++;
          rP.add(n-a);
          rP.add(n-(a*3));
      }else if(pieces==2)
      {
          ans++;
          rP.add(n-(a*2));
          rP.add(n-(a*2));
      }else
      {
          ans+=3;
          rP.add(n-a);
          rP.add(n-a);
          rP.add(n-a);
          rP.add(n-a);
      }
        for (Integer i : rP) {
            if(i/b>0)r+=i/b;
        }
        if(r<2)
        {
            if(n>(b*(2-r)))ans++;
            else ans+=2;
        }
        System.out.println(ans);
    }
}


package algorithms;

import java.util.Scanner;

public class B910 {

	static int sizeA;
	static int sizeB;
	static int sizeN;

	static void doit(int a, int b, int size, int count){
		if(a == 0 && b == 0) res = Math.min(res, count);
		else {
			if(a > 0 && size >= sizeA) doit(a-1,b,size-sizeA,count);
			if(a > 0 && size < sizeA) doit(a,b,sizeN,count+1);
			if(b > 0 && size >= sizeB) doit(a,b-1,size-sizeB,count);
			if(b > 0 && size < sizeB) doit(a,b,sizeN,count+1);
		}
	}

	static int res = 10;

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

		sizeN = in.nextInt();
		sizeA = in.nextInt();
		sizeB = in.nextInt();
		doit(4,2, sizeN,1);
		System.out.println(res);

		in.close();
	}
}


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

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String input = sc.next();
        String[] handle = input.split("/");
        if (input.contains("//") || handle.length > 2 || input.charAt(input.length() - 1) == '/' || (handle.length == 2 && !isUserName(handle[1].toCharArray())) || handle[0].charAt(handle[0].length() - 1) == '@' || handle[0].contains("@@")) {
            System.out.println("NO");
            return;
        }
        String[] one = handle[0].split("@");
        if (one.length != 2 || !isUserName(one[0].toCharArray()) || one[1].length() > 32 || one[1].charAt(0) == '.' || one[1].charAt(one[1].length() - 1) == '.' || one[1].contains("..")) {
            System.out.println("NO");
            return;
        }
        String[] three = one[1].split(".");
        for (String x : three)
            if (!isUserName(x.toCharArray())) {
                System.out.println("NO");
                return;
            }
        System.out.println("YES");
        out.close();
        out.flush();
    }

    static boolean isUserName(char[] x) {
        if (x.length == 0 || x.length > 16) return false;

        for (char c : x) {
            if (c != '_' && !isDigit(c) && !isLetter(c)) {
                return false;
            }
        }
        return true;
    }

    static boolean isDigit(char c) {
        return c >= '0' && c <= '9';
    }

    static boolean isLetter(char c) {
        return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

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

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String input = sc.next();
        String[] handle = input.split("/");
        if (input.contains("//") || handle.length > 2 || input.charAt(input.length() - 1) == '/' || (handle.length == 2 && !isUserName(handle[1].toCharArray())) || handle[0].charAt(handle[0].length() - 1) == '@' || handle[0].contains("@@")) {
            System.out.println("NO");
            return;
        }
        String[] one = handle[0].split("@");
        if (one.length != 2 || !isUserName(one[0].toCharArray()) || one[1].length() > 32 || one[1].charAt(0) == '.' || one[1].charAt(one[1].length() - 1) == '.' || one[1].contains("..")) {
            System.out.println("NO");
            return;
        }
        String[] three = one[1].split(".");
        for (String x : three)
            if (!isUserName(x.toCharArray())) {
                System.out.println("NO");
                return;
            }
        System.out.println("YES");
        out.close();
        out.flush();
    }

    static boolean isUserName(char[] x) {
        if (x.length == 0 || x.length > 16) return false;

        for (char c : x) {
            if (c != '_' && !isDigit(c) && !isLetter(c)) {
                return false;
            }
        }
        return true;
    }

    static boolean isDigit(char c) {
        return c >= '0' && c <= '9';
    }

    static boolean isLetter(char c) {
        return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

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

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;

public class Main {
    //StreamTokenizer in;
    BufferedReader in;
    PrintWriter out;

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

    void run() throws IOException {
        //in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        doit();
        out.flush();
    }

    void doit() throws IOException {
        String s = in.readLine().trim();
        String r = "@";
        String[] tmp = s.split(r);
        if(tmp.length != 2) {
            out.println("NO");
            return;
        }
        else {
            if(!isUsername(tmp[0])) {
                out.println("NO");
                return;
            }
            else {
                r = "/";
                tmp = tmp[1].split(r);
                if(tmp.length > 2) {
                    out.println("NO");
                    return;
                }
                else {
                    if(!isHostname(tmp[0])) {
                        out.println("NO");
                        return;
                    }
                    else {
                        if(tmp.length == 2) {
                            if(!isUsername(tmp[1])) {
                                out.println("NO");
                                return;
                            }
                        }
                    }
                }
            }
        }
        out.println("YES");
    }

    boolean isUsername(String s) {
        if(s.length() > 16 || s.length() < 1) return false;
        for(int i = 0; i < s.length(); i++)
            if(!(s.charAt(i) >= '0' && s.charAt(i) <= '9' || s.charAt(i) >= 'a' && s.charAt(i) <= 'z' ||
            s.charAt(i) >= 'A' && s.charAt(i) <= 'Z' || s.charAt(i) == '_')) return false;
        return true;
    }
    boolean isHostname(String s) {
        if(s.length() > 32 || s.length() < 1 || s.charAt(s.length() - 1) == '.') return false;
        String r = ".";
        String[] tmp = s.split(r);
        for (String aTmp : tmp) if (!isUsername(aTmp)) return false;
        return true;
    }
    //int ni() throws IOException { in.nextToken(); return (int) in.nval; }


import static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import java.util.*;
import java.math.*;
import java.io.*;

public class A implements Runnable
{
    String file = "input";

    void init() throws IOException
    {
        //input = new BufferedReader(new FileReader(file + ".in"));
        input = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedOutputStream(System.out));
    }

    void solve() throws IOException
    {
        String s = next();
        if(!s.contains("@"))
        {
            System.out.println("NO");
            return;
        }
        String[] str = s.split("@")
        if(str.length > 2)
        {
            System.out.println("NO");
            return;
        }
        if(!good(str[0]))
        {
            System.out.println("NO");
            return;
        }
        if(str[1].contains("/"))
        {
            String[] ss = str[1].split("/");
            if(ss.length != 2)
            {
                System.out.println("NO");
                return;
            }
            if(!good(ss[1]))
            {
                System.out.println("NO");
                return;
            }
            check(ss[0]);
        }
        check(str[1]);
        System.out.println("YES");
    }

    void check(String s)
    {
        if(s.length() <= 0 || s.length() > 32)
        {
            System.out.println("NO");
            System.exit(0);
        }
        String[] sss = s.split(".");
        for(int i = 0; i < sss.length; i++)
            if(!good(sss[i]))
            {
                System.out.println("NO");
                System.exit(0);
            }
    }

    boolean good(String s)
    {
        return s.length() > 0 && s.length() <= 16 && s.matches("[a-zA-Z0-9_]+");
    }

    String next() throws IOException
    {
        if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());
        return st.nextToken();
    }

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

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

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

    void print(Object... o)
    {
        System.out.println(deepToString(o));
    }

    void gcj(Object o)
    {
        String s = String.valueOf(o);
        out.println("Case #" + test + ": " + s);
        System.out.println("Case #" + test + ": " + s);
    }

    BufferedReader input;
    PrintWriter out;
    StringTokenizer st;
    int test;

    public static void main(String[] args) throws IOException
    {
        new Thread(null, new A(), "", 1 << 20).start();
    }

    public void run()
    {
        try
        {
            init();
            solve();
            out.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.exit(1);
        }
    }
}


import java.util.*;
import java.lang.Math;
import java.util.regex.*;

public class Main{
    public static void main(String []args){
        Scanner s = new Scanner(System.in);
        String id = s.nextLine();
        String pattern = "^[a-zA-Z0-9_]+@([a-zA-Z0-9_]{1,16})(\.[a-zA-Z0-9_]{1,16})?(\/[a-zA-Z0-9_]{1,16})?$";
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(id);
        if(m.find()){
            System.out.println("YES");
        }else System.out.println("NO");
    }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class MessMakers {
	static long tree[];

	static long read(int idx) {
		long sum = 0;
		while (idx > 0) {
			sum += tree[idx];
			idx -= (idx & -idx);
		}
		return sum;
	}

	static void update(int idx, long val) {
		while (idx <= tree.length) {
			tree[idx] += val;
			idx += (idx & -idx);
		}
	}

	public static void main(String[] args) {
		InputReader r = new InputReader(System.in);
		int n = r.nextInt();
		int k = Math.min(n / 2, r.nextInt());
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++) {
			arr[i] = i + 1;
		}
		for (int i = 0; i < k; i++) {
			int temp = arr[i];
			arr[i] = arr[n - 1 - i];
			arr[n - 1 - i] = temp;
		}
		tree = new long[n * 2];
		long res = 0;
		for (int j = n - 1; j >= 0; j--) {
			long x = read(arr[j] - 1);
			res += x;
			update(arr[j], 1);
		}
		System.out.println(res);
	}

	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

}


import java.util.Scanner;
public class messMakers {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int k = input.nextInt();
		int cows[] = new int[n];
		input.close();
		for (int i = 0; i < n; i++) {
			cows[i] = i;
		}
		int j=n-1;
		for (int i = 0; i < k; i++){
			int temp=cows[i];
			cows[i]=cows[j];
			cows[j]=temp;
			j--;

		}
		int mess=0;
		for (int i = 0; i < n-1; i++){
			for (int l = i+1; l < n; l++){
				if(cows[i]>cows[l]){
					mess++;
				}
			}

		}
		System.out.println(mess);
	}

}


package codeforces;
import java.io.*;
import java.util.*;
import java.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Random;
import java.lang.*;

public class zadacha {
private static BufferedReader in;
private static StringTokenizer tok;
private static PrintWriter out;
final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") !=null;

public static void init() throws FileNotFoundException{
if(ONLINE_JUDGE){
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
else{
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("out.txt");
}
}

private static String readString() throws IOException {
while (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}

private static int readInt() throws IOException {
return Integer.parseInt(readString());
}
private static double readDouble() throws IOException {
return Double.parseDouble(readString());
}
private static long readLong() throws IOException {
return Long.parseLong(readString());
}
private static float readFloat() throws IOException{
    return Float.parseFloat(readString());
}

public static void Solve() throws IOException{

	int n =readInt();
	int k = readInt();

	if(k<= n/2){
		out.print((n-1)*n/2);
		return;
	}
	if(n==1){
		out.print(0);
		return;
	}

	out.print(k*(2*n+1)-3*k*k);

}

public static void main(String[] args) throws IOException {
init();
Solve();

in.close();
out.close();
}
}


import java.io.*;
import java.util.Scanner;
public class Main {
public static void main(String args[])throws IOException
{
	Scanner s1=new Scanner(System.in);
	int n=Integer.parseInt(s1.next());
	int k=Integer.parseInt(s1.next());
	long cows[]=new long[n];
	long counter=0;
	for(int i=0;i<n;i++)
		cows[i]=i;
	int j=0;
	for(int i=0;i<k;i++)
	{
		if(cows[j]==j && j!=n-1-j)
		{
		long temp=cows[j];
		cows[j]=cows[n-1-j];
		cows[n-1-j]=temp;
		j++;
		}
		if(j>=n)
			break;
	}
	for(int i=0;i<n;i++)
	{
		for(int z=i+1;z<n;z++)
		{
			if(cows[i]>cows[z])
				counter++;
		}
	}
	/*
	for(int i=0;i<n;i++)
	{
		if(cows[i]!=i)
			counter+=cows[i];
			else if(n!=1)
				counter+=j;
	}*/
	System.out.println(counter);
}
}


import java.util.*;
public class CF124A_TheNumberOfPositions{
    public static void main(String[] args){

Scanner in = new Scanner(System.in;
System.out.println(Math.min(in.nextInt() - in.nextInt(), in.nextInt() + 1 ));
}
}


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

public class Solution127A
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader inp = new BufferedReader(new FileReader("input.txt"));
        StringTokenizer st = new StringTokenizer(inp.readLine());
        int n,a,b;
        n = Integer.parseInt();
        a = Integer.parseInt();
        b = Integer.parseInt();
        inp.close();
        System.out.println(n - a);
    }
}


import java.util.*;
import java.lang.*;

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

     int n=sc.nextInt();
     int a=sc.nextInt();
     int b=sc.nextInt();

       int k=n-a;
      int p=b+1;
      if(k<p)
      System.out.println(k);
      else
      System.out.println(p);
    }
}
}
}


import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();

        System.out.println(Math.min(n-a,b+1);

  }
}


public class CodeForce {

    public static void main(String[] args)
    {
        Scanner input=new Scanner(System.in);
        int a,b,c,arr[],i,j,k,v,arr5[];
        long fullCount=0;
        a=input.nextInt();
        b=input.nextInt();
        c=input.nextInt();
        arr=new int[a*b*c+1];
        arr5=new int[a*b+1];

        for( i=1;i<=a;i++)
        {
            for( j=1;j<=b;j++)
            {
                int count5=0;
                if(arr5[j*i]>0)
                    fullCount=fullCount+arr5[j*i];
                else
                for( k=1;k<=c;k++)
                {
                    int count=0;
                    if(arr[k*j*i]>0)
                    {
                        fullCount=fullCount+arr[k*j*i];
                        count5+=arr[k*j*i];
                    }
                    else
                    {
                   for( v=k*j*i;v>0;v--)
                   {
                       if((k*j*i)%v==0)
                           count++;
                   }
                   arr[k*j*i]=count;
                   count5+=count;
                    }
                }
                arr5[j*i]=count5;
            }
        }
        for(int z=1;z<arr.length;z++)
        fullCount=(fullCount+arr[z])%1073741824;
        System.out.println(fullCount);

    }
}


import java.util.*;
import java.Math;

public class Solution{
    int[] mem;
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        int answer = 0;
        mem = new int[a*b*c];
        for(int i = 0; i < a; i++){
            for(int j = 0; j < b; j++){
                for(int k = 0; k < c; k++){
                    answer += help(i*j*k);
                }
            }
        }

        System.out.println(answer);
    }

    public static int help(int n){
        if(n==1)return 1;
        if(mem[n] != 0) return mem[n];
        int s = (int)(Math.sqrt(n));
        int answer = 1;
        for(int i = 1; i <= s; i++){
            if(n%i==0) answer++;
        }
        mem[n] = answer;
        return answer;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Divisors {

    public static void main(String[] args) throws IOException {

        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(bf.readLine());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int c = Integer.parseInt(st.nextToken());
        int[] d = new int[10000000];
        int n=a*b*c;
        for(int i=1; i<=n;i++){
            for(int j=i; j<=n;j+=i){
                d[j]++;
            }
        }
        int suma=0;
        for(int i=1;i<=a;i++){
            for(int j=1;j<=b;j++){
                for(int k=1;k<=c;k++){
                    suma+=d[i*j*k]%1073741824;
                }
            }
        }
        System.out.println(suma);
    }

    public static int divisores(int numero){
        if (numero==1) return 1;
}


public class B {

    static int maxn = 1111111;
    static int prime[] = new int[maxn];
    static int check[] = new int[maxn];
    static int cnt = 0;

    static void getprime() {
        for (int i = 0; i < maxn; i++)
            check[i] = 0;
        for (int i = 2; i < maxn; i++) {
            if (check[i] == 0) prime[cnt++] = i;
            for (int j = i + i; j < maxn; j += i)
                check[j] = 1;
        }
    }

    static int solve(int x) {
        int sum = 1;
        int tmp = x;
        for (int i = 0; (long)prime[i]*prime[i] <= x && i < cnt; i++) {
            if (tmp % prime[i] == 0) {
                int tot = 0;
                while (tmp % prime[i] == 0) {
                    tmp /= prime[i]; tot++;
                }
                sum *= (tot + 1);
            }
        }
        if (tmp > 1) sum *= 2;
        return sum;
    }

    public static void main(String args[]) {
        getprime();
        Scanner cin = new Scanner(System.in);
        int a = cin.nextInt(); int b = cin.nextInt();
        int c = cin.nextInt();
        long sum = 0;
        long mod = 1073741824;
        for (int i = 1; i <= a; i++) {
            for (int j = 1; j <= b; j++) {
                for (int k = 1; k <= c; k++) {
                    sum += solve(i * j * k);
                    sum %= mod;
                }
            }
        }
        System.out.println(sum);
    }
}


public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String str = sc.next();
        int mas[] = new int[a];
        int ch = 0;

        for (int i = 0; i < str.length(); i++) {
            if(str.charAt(i) == '0'){
                mas[i] = 0;
            }else{
                mas[i] = 1;
            }
        }
       // System.out.println(str);
       /* for (int i = 0; i < a; i++) {
            System.out.print(mas[i] + " ");
        }
        */
        for (int i = a - 1; i > 0; i--) {
            if(mas[i] == 1 && mas[i - 1] == 0){
                mas[i - 1] = 1;
                mas[i] = 0;
            }else if(mas[i] == 1 && mas[i - 1] == 1){
                mas[i] = 0;
                ch++;
            }
        }

        for (int i = 0; i < a - ch; i++) {
            System.out.print(mas[i]);
        }

    }
}


import java.util.*;

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

		int n = sc.nextInt();
		int string = sc.nextLine();

		int counter = 0;
		for(int i=0; i<n; i++){
			if(string.getChar(i)=='0'){
				counter++;
			}
		}

		string ans = "1"
		for(int i=0; i<counter; i++){
			ans = ans+"0";
		}

		System.out.println(ans);
	}
}


//package geometry;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

import java.text.*;
import java.math.*;
import java.util.regex.*;

import java.awt.Point;
/**
 *
 * @author prabhat // use stringbuilder,TreeSet, priorityQueue
 */
   public class  point4{
   public  static long[] BIT;
   public  static long[] tree;
   public  static long[] sum;
   public  static int mod=1000000007;
   public  static int[][] dp;
   public  static boolean[][] isPalin;
   public  static int max1=1000010;
   public  static int[][] g;
   public  static LinkedList<Pair> l[];
   public  static int n,m,q,k,t,a[],b[],arr[],cnt[],chosen[],pos[],val[],blocksize,count;
   public  static long V[],low,high,min=Long.MAX_VALUE,cap[],has[],ans,max,pre[];
   public  static ArrayList<Integer> adj[],al;
   public  static TreeSet<Integer> ts;
   public  static   char s[];
   public  static int depth,mini,maxi;
   public  static boolean visit[][],isPrime[],used[];
   public  static int[][] dist;
   public  static ArrayList<Integer>prime;
   public  static int[] x={0,1};
   public  static int[] y={-1,0};
   public  static ArrayList<Integer> divisor[]=new ArrayList[1500005];
   public  static  int[][] subtree,parent,mat;
   public  static  TreeMap<Integer,Integer> tm;
   public  static LongPoint[] p;
   public  static int[][] grid,memo;
   public  static ArrayList<Pair> list;
   public  static TrieNode root;
   public  static  LinkedHashMap<String,Integer> map;
   public  static ArrayList<String> al1;
   public static int upper=(int)(1e7);
   public  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   public  static void main(String[] args) throws Exception
   {
   	   InputReader in = new InputReader(System.in);
	   PrintWriter pw=new PrintWriter(System.out);
	  n=in.ii();
	  s=in.is().toCharArray();
	  int z=0;
	  for(char c:s)if(c=='0')z++;
	  int o=n-z;
	  String s="";
	  for(int i=0;i<z;i++)s+='0';
	 if(o>0) s='1'+s;
	 else s='0';
	  pw.println(s);
	 /* n=in.ii();
	  long ans=0;
	  Point[] p=new Point[n];
	  for(int i=0;i<n;i++)
	   {
		  p[i]=new Point(in.ii(),in.ii());
	   }
	   for(int i=0;i<n;i++)
	   {
		   if(orient(p[i],p[(i+1)%n],p[(i+2)%n])<0)ans++;
	   }
	   pw.println(ans);*/
	   pw.close();
}
static void Seive()
{
	isPrime=new boolean[upper+1];
	Arrays.fill(isPrime,false);

	for(int i=2;i<=(upper);i++)
	{
		if(!isPrime[i])
		{
			for(int j=1;j*i<=upper;j++)
			{
				isPrime[j*i]=true;
				pre[i]+=cnt[j*i];
			}
		}
	}
}
static int orient(Point a,Point b,Point c)
{
	//return (int)(c.x-a.x)*(int)(b.y-a.y)-(int)(c.y-a.y)*(int)(b.x-a.x);
	Point p1=c.minus(a);
	Point p2=b.minus(a);
	return (int)(p1.cross(p2));
}
public static class Polygon {

	static final double EPS = 1e-15;
	public int n;
	public Point p[];

	Polygon(int n, Point x[]) {
		this.n = n;
		p = Arrays.copyOf(x, n);
	}

	long area(){ //returns 2 * area
		long ans = 0;
		for(int i = 1; i + 1 < n; i++)
			ans += p[i].minus(p[0]).cross(p[i + 1].minus(p[0]));
		return ans;
	}

	boolean PointInPolygon(Point q) {
		boolean c = false;
		for (int i = 0; i < n; i++){
			int j = (i+1)%n;
			if ((p[i].y <= q.y && q.y < p[j].y ||
					p[j].y <= q.y && q.y < p[i].y) &&
					q.x < p[i].x + (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y))
			c = !c;
		 }
		return c;
	}

		// determine if point is on the boundary of a polygon
	boolean PointOnPolygon(Point q) {
		 for (int i = 0; i < n; i++)
		 if (ProjectPointSegment(p[i], p[(i+1)%n], q).dist(q) < EPS)
			 return true;
		 return false;
	}

	// project point c onto line segment through a and b
	Point ProjectPointSegment(Point a, Point b, Point c) {
	  double r = b.minus(a).dot(b.minus(a));
	  if (Math.abs(r) < EPS) return a;
	  r = c.minus(a).dot(b.minus(a))/r;
	  if (r < 0) return a;
	  if (r > 1) return b;
	  return a.plus(b.minus(a).mul(r));
	}
}

public static class Point {
	public double x, y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public Point minus(Point b) {
		return new Point(x - b.x, y - b.y);
	}

	public Point plus(Point a){
		return new Point(x + a.x, y + a.y);
	}

	public double cross(Point b) {
		return (double)x * b.y - (double)y * b.x;
	}

	public double dot(Point b) {
		return (double)x * b.x + (double)y * b.y;
	}

	public Point mul(double r){
		return new Point(x * r, y * r);
	}

	public double dist(Point p){
		return Math.sqrt(fastHypt( x - p.x , y - p.y));
	}

	public double fastHypt(double x, double y){
		return x * x + y * y;
	}
}
static class Query implements Comparable<Query>{
	int index,k;
	int L;
	int R;
	public Query(){}
	public Query(int a,int b,int index)
	{
	  this.L=a;
	  this.R=b;
	  this.index=index;
	}
   public int compareTo(Query o)
   {
	  if(L/blocksize!=o.L/blocksize)return L/blocksize-o.L/blocksize;
	  else return R-o.R;
   }

 }

static double dist(Point p1,Point p2)
{
	return Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
}

static class coder {
	int indx;
	String name;
	coder(int indx,String name)
	{
		this.indx=indx;
		this.name=name;
	}
}
static class TrieNode
{
	int value;  // Only used in leaf nodes
	int freq;
	TrieNode[] arr =  new TrieNode[2];
	public TrieNode() {
		value = 0;
		freq=0;
		arr[0] = null;
		arr[1] = null;
	}
}
static void insert(int pre_xor,int add)
{
	TrieNode temp = root;

	// Start from the msb, insert all bits of
	// pre_xor into Trie
	for (int i=31; i>=0; i--)
	{
		// Find current bit in given prefix
		int val = (pre_xor & (1<<i)) >=1 ? 1 : 0;

		// Create a new node if needed
		if (temp.arr[val] == null)
			temp.arr[val] = new TrieNode();

		temp = temp.arr[val];
		temp.freq+=add;
	}

	// Store value at leaf node
	//temp.value = pre_xor;
}

static long query(int pre_xor)
{
	TrieNode temp = root;
	long ans=0;
	for (int i=31; i>=0; i--)
	{
		// Find current bit in given prefix
		int val = (pre_xor & (1<<i)) >= 1 ? 1 : 0;

		if(temp.arr[1-val]!=null&&temp.arr[1-val].freq>0)
		{
			ans|=1l<<i;
			temp=temp.arr[1-val];
		}
        else if(temp.arr[val]!=null&&temp.arr[val].freq>0)
            temp=temp.arr[val];
		else break;
	}
	return ans;
}
static void update(int indx,long val)
   {
	   while(indx<max1)
	   {
		   BIT[indx]+=val;
		   indx+=(indx&(-indx));
	   }

   }
static long query1(int indx)
   {
	   long sum=0;
	   while(indx>0)
	   {
		  sum+=BIT[indx];
		   indx-=(indx&(-indx));
	   }
	   return sum;
	}

static int gcd(int a, int b)
{
	int res=0;
	while(a!=0)
	{
		res=a;
		a=b%a;
		b=res;
	}
	return b;
}
static slope getSlope(Point p, Point q)
	{
		int dx = (int)(q.x - p.x), dy = (int)(q.y - p.y);
		int g = gcd(dx, dy);
		return new slope(dy / g, dx / g);
	}

static class slope implements Comparable<slope>
{
	int x,y;
	public slope(int y,int x)
	{
		this.x=x;
		this.y=y;
	}
	public int compareTo(slope s)
	{
		if(s.y!=y)return y-s.y;
	return x-s.x;
	}
}

static class Ball implements Comparable
	{
		int r;
		int occ;
		public Ball(int r,int occ)
		{
			this.r = r;
			this.occ = occ;
		}
		@Override
		public int compareTo(Object o) {
			Ball b = (Ball) o;
			return b.occ-this.occ;
		}
	}

static class E implements Comparable<E>{
	int x,y;
	char c;
	E(int  x,int y,char c)
	{
		this.x=x;
		this.y=y;
		this.c=c;
	}
	public int compareTo(E o)
	{
		if(x!=o.x)return o.x-x;
		else return y-o.y;

	}
}

static ArrayList<String> dfs(String s,String[] sarr,HashMap<String, ArrayList<String>> map)
{
   if(map.containsKey(s))return map.get(s);
   ArrayList<String> res=new ArrayList<>();
   if(s.length()==0)
   {
	   res.add("");
	   return res;
   }

   for(String word:sarr)
   {
	   if(s.startsWith(word))
	   {
		   ArrayList<String > sub=dfs(s.substring(word.length()),sarr,map);
		   for(String s2:sub)
		   {
			   res.add(word+ (s2.isEmpty() ? "" : " ")+s2);
		   }
	   }
   }
   map.put(s,res);
   return res;
}
static class SegmentTree{

  int n;
  int max_bound;

  public SegmentTree(int n)
  {

	  this.n=n;
	  tree=new long[4*n+1];
	  build(1,0,n-1);
  }
void build(int c,int s,int e)
{
   if(s==e)
   {
	   tree[c]=arr[s];
	   return ;
   }

   int mid=(s+e)>>1;
   build(2*c,s,mid);
   build(2*c+1,mid+1,e);
   tree[c]=(tree[2*c]&tree[2*c+1]);
}
void put(int c,int s, int e,int l,int r,int  v) {
	if(l>e||r<s||s>e)return ;
	if (s == e)
	{
		tree[c] = arr[s]^v;
		return;
	}
	int mid = (s + e) >> 1;
	if (l>mid) put(2*c+1,m+1, e , l,r, v);
	else if(r<=mid)put(2*c,s,m,l,r , v);
	else{

	}

}
long query(int c,int s,int e,int l,int r)
{
   if(e<l||s>r)return 0L;

   if(s>=l&&e<=r)
   {
	return tree[c];
   }

	int mid=(s+e)>>1;
	long ans=(1l<<30)-1;
	if(l>mid)return query(2*c+1,mid+1,e,l,r);
	else if(r<=mid)return query(2*c,s,mid,l,r);
	else{
		return query(2*c,s,mid,l,r)&query(2*c+1,mid+1,e,l,r);
	}

 }
}

   public static ListNode removeNthFromEnd(ListNode a, int b) {

    int cnt=0;
	ListNode ra1=a;
	ListNode ra2=a;
	while(ra1!=null){ra1=ra1.next; cnt++;}

	if(b>cnt)return a.next;
	else if(b==1&&cnt==1)return null;
	else{
		int y=cnt-b+1;
		int u=0;
		ListNode prev=null;
		while(a!=null)
		{
			u++;
		   if(u==y)
		   {
			   if(a.next==null)prev.next=null;
			   else
			   {
				   if(prev==null)return ra2.next;
				   prev.next=a.next;
				   a.next=null;
			   }
			   break;
		   }
		   prev=a;
		   a=a.next;
		}
	}
	return ra2;
}
   static ListNode rev(ListNode a)
   {
       ListNode prev=null;
       ListNode cur=a;
       ListNode next=null;
       while(cur!=null)
       {
           next=cur.next;
           cur.next=prev;
           prev=cur;
           cur=next;
       }
       return prev;
   }

  static class ListNode {
	     public int val;
	     public ListNode next;
	     ListNode(int x) { val = x; next = null; }
	 }

   public static String add(String s1,String s2)
   {
	   int n=s1.length()-1;
	   int m=s2.length()-1;
	   int rem=0;
	   int carry=0;
	   int i=n;
	   int j=m;
	   String ans="";
	   while(i>=0&&j>=0)
	   {
		 int c1=(int)(s1.charAt(i)-'0');
		 int c2=(int)(s2.charAt(j)-'0');
		 int sum=c1+c2;
		 sum+=carry;
		 rem=sum%10;
		 carry=sum/10;
         ans=rem+ans;
		  i--; j--;

	   }
	   while(i>=0)
	   {
		int c1=(int)(s1.charAt(i)-'0');

		int sum=c1;
		sum+=carry;
		rem=sum%10;
		carry=sum/10;
		ans=rem+ans;
		i--;
	   }
	   while(j>=0)
	   {

		int c2=(int)(s2.charAt(j)-'0');
		int sum=c2;
		sum+=carry;
		rem=sum%10;
		carry=sum/10;
		ans=rem+ans;
		j--;
	   }

	   if(carry>0)ans=carry+ans;
	   return ans;
   }
   public static String[] multiply(String A, String B) {
	int lb=B.length();
	char[] a=A.toCharArray();
	char[] b=B.toCharArray();
	String[] s=new String[lb];
	int cnt=0;
	int y=0;
	String s1="";
q=0;
	for(int i=b.length-1;i>=0;i--)
	{
		int rem=0;
		int carry=0;

		for(int j=a.length-1;j>=0;j--)
		{
			int mul=(int)(b[i]-'0')*(int)(a[j]-'0');
			mul+=carry;
			rem=mul%10;
			carry=mul/10;
			s1=rem+s1;
		}
		s1=carry+s1;
		s[y++]=s1;
		q=Math.max(q,s1.length());
		s1="";
		for(int i1=0;i1<y;i1++)s1+='0';

	}
	return s;
}
   public static long nCr(long total, long choose)
   {
	   if(total < choose)
		   return 0;
	   if(choose == 0 || choose == total)
		   return 1;
	   return nCr(total-1,choose-1)+nCr(total-1,choose);
   }

   static int get(long s)
   {
	  int ans=0;
	  for(int i=0;i<n;i++)
	  {
		  if(p[i].x<=s&&s<=p[i].y)ans++;
	  }
	  return ans;
   }
   static class LongPoint {
	public long x;
	public long y;

	public LongPoint(long x, long y) {
		this.x = x;
		this.y = y;
	}

	public LongPoint subtract(LongPoint o) {
		return new LongPoint(x - o.x, y - o.y);
	}

	public long cross(LongPoint o) {
		return x * o.y - y * o.x;
	}

}
    static int CountPs(String s,int n)
       {
    	boolean b=false;
    	     char[] S=s.toCharArray();
	       int[][] dp=new int[n][n];
	       boolean[][] p=new boolean[n][n];
	       for(int i=0;i<n;i++)p[i][i]=true;

	       for(int i=0;i<n-1;i++)
	       {
	    	   if(S[i]==S[i+1])
	    	   {
	    		p[i][i+1]=true;
	    		dp[i][i+1]=0;
	    		b=true;
	    	   }
	       }

	       for(int gap=2;gap<n;gap++)
	       {
	    	   for(int i=0;i<n-gap;i++)
	    	   {
	    		   int j=gap+i;
	    		   if(S[i]==S[j]&&p[i+1][j-1]){p[i][j]=true;}

	    		  if(p[i][j])
	    			   dp[i][j]=dp[i][j-1]+dp[i+1][j]+1-dp[i+1][j-1];

	    		   else if(!p[i][j]) dp[i][j]=dp[i][j-1]+dp[i+1][j]-dp[i+1][j-1];

	    		   //if(dp[i][j]>=1)
                             //  return true;
	    	   }
	       }

	   // return b;
    return dp[0][n-1];

    }

  static long divCeil(long a,long b)
  {
      return (a+b-1)/b;
  }
  static long root(int pow, long x) {
        long candidate = (long)Math.exp(Math.log(x)/pow);
        candidate = Math.max(1, candidate);
        while (pow(candidate, pow) <= x) {
            candidate++;
        }
        return candidate-1;
    }

    static long pow(long x, int pow)
    {
        long result = 1;
        long p = x;
        while (pow > 0) {
            if ((pow&1) == 1) {
                if (result > Long.MAX_VALUE/p) return Long.MAX_VALUE;
                result *= p;
            }
            pow >>>= 1;
            if (pow > 0 && p >= 4294967296L) return Long.MAX_VALUE;
            p *= p;
        }
        return result;
    }

  static boolean valid(int i,int j)
  {
	  if(i>=0&&i<n&&j>=0&&j<m)return true;
	  return false;
  }
  private static class DSU{
		int[] parent;
		int[] rank;
		int cnt;
		public DSU(int n){
			parent=new int[n];
			rank=new int[n];
			for(int i=0;i<n;i++){
				parent[i]=i;
				rank[i]=1;
			}
			cnt=n;
		}
		int find(int i){
	        while(parent[i] !=i){
	        	parent[i]=parent[parent[i]];
	        	i=parent[i];
	        }
	        return i;
	    }
		int Union(int x, int y){
	        int xset = find(x);
	        int yset = find(y);
	        if(xset!=yset)
	        	cnt--;
	        if(rank[xset]<rank[yset]){
	        	parent[xset] = yset;
		        rank[yset]+=rank[xset];
		        rank[xset]=0;
		        return yset;
	        }else{
	        	parent[yset]=xset;
	        	rank[xset]+=rank[yset];
	        	rank[yset]=0;
	        	return xset;
	        }
	    }
	}
  public static int[][] packU(int n, int[] from, int[] to, int max) {

	    int[][] g = new int[n][];
	    int[] p = new int[n];
	    for (int i = 0; i < max; i++) p[from[i]]++;
	    for (int i = 0; i < max; i++) p[to[i]]++;
	    for (int i = 0; i < n; i++) g[i] = new int[p[i]];
	    for (int i = 0; i < max; i++) {
	        g[from[i]][--p[from[i]]] = to[i];
	        g[to[i]][--p[to[i]]] = from[i];
	    }
	    return g;
	}
	public static int[][] parents3(int[][] g, int root) {
	    int n = g.length;
	    int[] par = new int[n];
	    Arrays.fill(par, -1);

	    int[] depth = new int[n];
	    depth[0] = 0;

	    int[] q = new int[n];
	    q[0] = root;
	    for (int p = 0, r = 1; p < r; p++) {
	        int cur = q[p];
	        for (int nex : g[cur]) {
	            if (par[cur] != nex) {
	                q[r++] = nex;
	                par[nex] = cur;
	                depth[nex] = depth[cur] + 1;
	            }
	        }
	    }
	    return new int[][]{par, q, depth};
	}
	public static int lower_bound(int[] nums, int target) {
        int low = 0, high = nums.length - 1;
        while (low < high) {
            int mid = low + (high - low) / 2;
            if (nums[mid] < target)
                low = mid + 1;
            else
                high = mid;
        }
        return nums[low] == target ? low : -1;
    }

    public static int upper_bound(int[] nums, int target) {
        int low = 0, high = nums.length - 1;
        while (low < high) {
            int mid = low + (high + 1 - low) / 2;
            if (nums[mid] > target)
                high = mid - 1;
            else
                low = mid;
        }
        return nums[low] == target ? low : -1;
    }
  public static boolean palin(String s)
	{
	   int i=0;
	   int j=s.length()-1;
	   while(i<j)
	   {
		   if(s.charAt(i)==s.charAt(j))
		   {
			   i++;
			   j--;
		   }
		   else return false;
	   }
	   return true;
	}

static int lcm(int a,int b)
{
	return (a*b)/(gcd(a,b));
}

public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;

	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}

    /**
     *
     * @param n
     * @param p
     * @return
     */
    public static long pow(long n,long p)
     {
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;

     }

static class Edge implements Comparator<Edge> {
	private int u;
	private int v;
	private long w;
	public Edge() {
	}
	public Edge(int u, int v, long w) {
		this.u=u;
		this.v=v;
		this.w=w;
	}
	public int getU() {
		return u;
	}
	public void setU(int u) {
		this.u = u;
	}
	public int getV() {
		return v;
	}
	public void setV(int v) {
		this.v = v;
	}
	public long getW() {
		return w;
	}
	public void setW(int w) {
		this.w = w;
	      }
	public long compareTo(Edge e)
	  {
		return (this.getW() - e.getW());
	}

        @Override
        public int compare(Edge o1, Edge o2) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

}

static class Pair implements Comparable<Pair>
{
	int x,y;
	Pair (int a,int b)
	{
		this.x=a;
		this.y=b;
	}

	public int compareTo(Pair o) {
		// TODO Auto-generated method stub
		if(this.x!=o.x)
		return -Integer.compare(this.x,o.x);
		else
			return -Integer.compare(this.y, o.y);
		//return 0;
	}
	public boolean equals(Object o) {
       if (o instanceof Pair) {
           Pair p = (Pair)o;
           return p.x == x && p.y == y;
       }
       return false;
   }
   public int hashCode() {
       return new Integer(x).hashCode() * 31 + new Integer(y).hashCode();
   }
}

static  class InputReader
{
   private InputStream stream;
   private byte[] buf = new byte[1024];

   private SpaceCharFilter filter;
    byte inbuffer[] = new byte[1024];
   int lenbuffer = 0, ptrbuffer = 0;
    final int M = (int) 1e9 + 7;
   int md=(int)(1e7+1);
    int[] SMP=new int[md];
   final double eps = 1e-6;
   final double pi = Math.PI;

	PrintWriter out;
   String check = "";
 InputStream   obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());
   public InputReader(InputStream stream)
   {
       this.stream = stream;
   }

    int readByte() {
	        if (lenbuffer == -1) throw new InputMismatchException();
	        if (ptrbuffer >= lenbuffer) {
	            ptrbuffer = 0;
	            try {
	                lenbuffer = obj.read(inbuffer);
	            } catch (IOException e) {
	                throw new InputMismatchException();
	            }
	        }
	        if (lenbuffer <= 0) return -1;
	        return inbuffer[ptrbuffer++];
   }

   public  int read()
   {
       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;
   }

   String is() {
	        int b = skip();
	        StringBuilder sb = new StringBuilder();
	        while (!(isSpaceChar(b))) // when nextLine, (isSpaceChar(b) && b!=' ')
	        {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
   }
   public   int ii() {
	        int num = 0, b;
	        boolean minus = false;
	        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        while (true) {
	            if (b >= '0' && b <= '9') {
	                num = num * 10 + (b - '0');
	            } else {
	                return minus ? -num : num;
	            }
	            b = readByte();
	        }
   }
 public   long il() {
	        long num = 0;
	        int b;
	        boolean minus = false;
	        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        while (true) {
	            if (b >= '0' && b <= '9') {
	                num = num * 10 + (b - '0');
	            } else {
	                return minus ? -num : num;
	            }
	            b = readByte();
	        }
   }

	    boolean isSpaceChar(int c) {
	        return (!(c >= 33 && c <= 126));
	       }

	      int skip()
	        {
	        int b;
	        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
	        return b;
	        }

	    float nf() {
	        return Float.parseFloat(is());
	    }

	    double id() {
	        return Double.parseDouble(is());
	    }

	    char ic() {
	        return (char) skip();
	    }

	    int[] iia(int n) {
	        int a[] = new int[n];
	        for (int i = 0; i<n; i++) a[i] = ii();
	        return a;
	    }

	    long[] ila(int n) {
	        long a[] = new long[n];
	        for (int i = 0; i <n; i++) a[i] = il();
	        return a;
	    }

	    String[] isa(int n) {
	        String a[] = new String[n];
	        for (int i = 0; i < n; i++) a[i] = is();
	        return a;
	    }

		 long mul(long a, long b) { return a * b % M; }

			long div(long a, long b)
				 {
					return mul(a, pow(b, M - 2));

		           }

	    double[][] idm(int n, int m) {
	        double a[][] = new double[n][m];
	        for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = id();
	        return a;
	        }

	    int[][] iim(int n, int m) {
	        int a[][] = new int[n][m];
	        for (int i = 0; i < n; i++) for (int j = 0; j <m; j++) a[i][j] = ii();
	        return a;
          }

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

   public interface SpaceCharFilter
   {
       public boolean isSpaceChar(int ch);
   }
   public boolean isEndOfLine(int c) {
       return c == '\n' || c == '\r' || c == -1;
   }
}

}


import java.util.Scanner;

import org.apache.catalina.Session;
import org.hibernate.Hibernate;
import org.hibernate.SessionFactory;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.xml.sax.SAXException;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.nextLine();
		if(s.equals("0")) System.out.println(0);
		else {
			StringBuilder sb = new StringBuilder();
			sb.append('1');
			for(int i = 0 ; i < s.length() ; ++i) {
				if(s.charAt(i) == '0') sb.append('0');
			}
			System.out.println(sb);
		}
	}

}