import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = 0;
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }
        if (s.isEmpty()){
            res++;
        }
        Collections.sort(s);
        k -= cold;

        while (!s.isEmpty() || k != 0) {
            int q = s.size();
            for (int i = 0; i < s.size(); ++i) {
                if (k - s.get(i) >= 0) {
                    k -= s.get(i);
                    res -= 2;
                }
            }
            if (q == s.size()) {
                break;
            }
        }
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean first = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (tmp < 0) {
                first = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && first) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
        }
        int last = 0;
        if (length != 0) {
            last = length;
        }

        if (cold > k) {
            System.out.println(-1);
            return;
        }
        if (cold == 0){
            System.out.println(0);
            return;
        }

        if (s.isEmpty()) {
            res++;
            System.out.println(res);
            return;
        }
        //System.out.println(s);

        Collections.sort(s);
        k -= cold;
        int count = 0;
        for (int i = 0; i < s.size(); ++i) {
            int t = s.get(i);
            k = k - t;
            if (k < 0) {
                k = k + t;
                break;
            }

            count++;
        }
        res -= count * 2;
        if (k - last >= 0 && last != 0) {
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = 0;
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }
        if (s.isEmpty()){
            res++;
        }
        Collections.sort(s);
        k -= cold;

        while (!s.isEmpty() || k != 0) {
            int q = s.size();
            for (int i = 0; i < s.size(); ++i) {
                if (k - s.get(i) >= 0) {
                    k -= s.get(i);
                    res -= 2;
                    s.remove(i);
                }
            }
            if (q == s.size()) {
                break;
            }
        }
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        if (cold == 0){
            System.out.println(0);
            return;
        }
        int last = 0;
        if (s.isEmpty()) {
            res++;
            System.out.println(res);
            return;
        }
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }

        Collections.sort(s);
        k -= cold;
        int count = 0;
        for (int i = 0; i < s.size(); ++i) {
            int t = s.get(i);
            k = k - t;
            if (k < 0) {
                k = k + t;
                break;
            }

            count++;
        }
        res -= count * 2;
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = 0;
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }
        if (s.isEmpty()) {
            res++;
        }
        Collections.sort(s);
        k -= cold;
        int count = 0;
        for (int i = 0; i < s.size(); ++i) {
            int t = s.get(i);
            k = k - t;
            if (k < 0) {
                k = k + t;
                break;
            }

            count++;
        }
        res -= count * 2;
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean notFirst = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (tmp < 0) {
                notFirst = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && notFirst) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
        }
        if (cLength){
            res++;
        }
        int last = 0;
        if (length != 0) {
            last = length;
        }

        if (cold > k) {
            System.out.println(-1);
            return;
        }
        if (cold == 0){
            System.out.println(0);
            return;
        }

        Collections.sort(s);
        k -= cold;
        int count = 0;
        for (int i = 0; i < s.size(); ++i) {
            int t = s.get(i);
            k = k - t;
            if (k < 0) {
                k = k + t;
                break;
            }

            count++;
        }
        res -= count * 2;
        if (k - last >= 0 && last != 0) {
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = 0;
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }
        if (s.isEmpty()) {
            res++;
        }
        Collections.sort(s);
        k -= cold;

        while (!s.isEmpty() || k != 0) {
            if (k - s.get(0) >= 0) {
                k -= s.get(0);
                res -= 2;
                s.remove(0);
            } else {
                break;
            }
        }
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0) {
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
            //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = 0;
        if (l) {
            last = s.get(s.size() - 1);
            s.remove(s.size() - 1);
        }
        if (s.isEmpty()) {
            res++;
        }
        Collections.sort(s);
        k -= cold;

        while (!s.isEmpty() && k != 0) {
            if (k - s.get(0) >= 0) {
                k -= s.get(0);
                res -= 2;
                s.remove(0);
            } else {
                break;
            }
        }
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


import java.util.*;

/**
 * Created by matt on 12/22/16.
 */
public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        //int[] d = new int[n];
        int cold = 0;
        ArrayList<Integer> s = new ArrayList();
        int length = 0;
        boolean cLength = false;
        int res = 0;
        boolean f = false;
        boolean l = false;
        for (int i = 0; i < n; ++i) {
            int tmp = sc.nextInt();
            if (i == n - 1 && tmp >= 0){
                l = true;
            }
            if (tmp < 0) {
                f = true;
                cLength = true;
                cold++;
                if (length != 0) {
                    s.add(length);
                }
                length = 0;
            } else if (tmp >= 0 && f) {
                if (cLength) {
                    res += 2;
                }
                cLength = false;
                length++;
            }
        //    d[i] = tmp;
        }
        if (length != 0) {
            s.add(length);
        }
        if (cold > k) {
            System.out.println(-1);
            return;
        }
        int last = s.get(s.size() - 1);
        s.remove(s.size() - 1);
        Collections.sort(s);
        k -= cold;

        while (!s.isEmpty() || k != 0) {
            int q = s.size();
            for (int i = 0; i < s.size(); ++i) {
                if (k - s.get(i) >= 0) {
                    k -= s.get(i);
                    res -= 2;
                }
            }
            if (q == s.size()) {
                break;
            }
        }
        if (k - last >= 0 && l) {
            k -= last;
            res -= 1;
        }

//        System.out.println(k);
//        System.out.println(s);
        System.out.println(res);

    }
}


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

public class D387 {
	public static void main(String[] args) {
		FS scan = new FS();
		int N = scan.nextInt(), K = scan.nextInt();

		int[] list = new int[N];
		for(int i=0;i<N;i++)list[i] = scan.nextInt();

		int[] prev = new int[N];

		int idx = -1;
		for(int i=0;i<N;i++){
			prev[i] = idx;
			if(list[i]<0)idx=i;
		}
		ArrayList<Edge> e = new ArrayList<>();
		for(int i=0;i<N;i++){
			if(list[i]<0&&prev[i]!=-1){
				e.add(new Edge(prev[i],i));
			}
		}

		int count =2*(e.size()+1);
		if(count==2){
			System.out.println(0);
			return;
		}
		K-=(e.size()+1);
		if(K<0){

			System.out.println(-1);
			return;
		}
		Collections.sort(e);
		DisjointSet d = new DisjointSet(N+2);
		for(Edge f : e) {
			int a = f.a+1, b = f.b+1;
			if(d.find(a, b))continue;
			if(f.dist<=K){
				d.union(a, b);
				if(a==0||b==0||a==N+1||b==N+1)count--;
				else count-=2;
				K-=f.dist;
			}
		}
		if(N-idx-1<=K)count--;
		System.out.println(count);

	}
	private static class Edge implements Comparable<Edge>{
		int a, b, dist;
		public Edge(int a, int b) {
			this.a = a;
			this.b=b;
			this.dist = Math.abs(a-b)-1;
		}
		public int compareTo(Edge e) {
			return Integer.compare(this.dist, e.dist);
		}
	}
	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS() {
			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());}
	}
	private static class DisjointSet {
		int[] id, sz;
		public DisjointSet(int N) {//N=Number of verts
			id = new int[N];
			sz = new int[N];
			for (int i=0;i<N;i++){sz[i]=1;id[i]=i;}
		}

		private int root(int i){
			return id[i] = (i!=id[i])?root(id[i]):i;
		}
		public boolean find(int p, int q){
			return root(p)==root(q);
		}
		public void union(int p, int q){
			int i=root(p);
			int j=root(q);
			if (sz[i]<sz[j]){id[i]=j;sz[j]+=sz[i];}
			else 			{id[j]=i;sz[i]+=sz[j];};
		}
	}

}


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

public class D387 {
	public static void main(String[] args) {
		FS scan = new FS();
		int N = scan.nextInt(), K = scan.nextInt();

		int[] list = new int[N];
		for(int i=0;i<N;i++)list[i] = scan.nextInt();

		int[] prev = new int[N];

		int idx = -1;
		for(int i=0;i<N;i++){
			prev[i] = idx;
			if(list[i]<0)idx=i;
		}
		ArrayList<Edge> e = new ArrayList<>();
		for(int i=0;i<N;i++){
			if(list[i]<0&&prev[i]!=-1){
				e.add(new Edge(prev[i],i));
			}
		}

		int count =2*(e.size()+1);
		K-=(e.size()+1);
		if(K<0){

			System.out.println(-1);
			return;
		}
		Collections.sort(e);
		DisjointSet d = new DisjointSet(N+2);
		for(Edge f : e) {
			int a = f.a+1, b = f.b+1;
			if(d.find(a, b))continue;
			if(f.dist<=K){
				d.union(a, b);
				if(a==0||b==0||a==N+1||b==N+1)count--;
				else count-=2;
				K-=f.dist;
			}
		}
		if(N-idx-1<=K)count--;
		System.out.println(count);

	}
	private static class Edge implements Comparable<Edge>{
		int a, b, dist;
		public Edge(int a, int b) {
			this.a = a;
			this.b=b;
			this.dist = Math.abs(a-b)-1;
		}
		public int compareTo(Edge e) {
			return Integer.compare(this.dist, e.dist);
		}
	}
	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS() {
			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());}
	}
	private static class DisjointSet {
		int[] id, sz;
		public DisjointSet(int N) {//N=Number of verts
			id = new int[N];
			sz = new int[N];
			for (int i=0;i<N;i++){sz[i]=1;id[i]=i;}
		}

		private int root(int i){
			return id[i] = (i!=id[i])?root(id[i]):i;
		}
		public boolean find(int p, int q){
			return root(p)==root(q);
		}
		public void union(int p, int q){
			int i=root(p);
			int j=root(q);
			if (sz[i]<sz[j]){id[i]=j;sz[j]+=sz[i];}
			else 			{id[j]=i;sz[i]+=sz[j];};
		}
	}

}


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

public class D387 {
	public static void main(String[] args) {
		FS scan = new FS();
		int N = scan.nextInt(), K = scan.nextInt();

		int[] list = new int[N];
		for(int i=0;i<N;i++)list[i] = scan.nextInt();

		int[] prev = new int[N];

		int idx = -1;
		for(int i=0;i<N;i++){
			prev[i] = idx;
			if(list[i]<0)idx=i;
		}
		ArrayList<Edge> e = new ArrayList<>();
		for(int i=0;i<N;i++){
			if(list[i]<0&&prev[i]!=-1){
				e.add(new Edge(prev[i],i));
			}
		}

		int count =2*(e.size()+1);
		boolean seen = false;
		for(int i=0;i<N;i++)if(list[i]<0)seen=true;
		if(!seen){
			System.out.println(0);
			return;
		}
		K-=(e.size()+1);
		if(K<0){

			System.out.println(-1);
			return;
		}
		Collections.sort(e);
		DisjointSet d = new DisjointSet(N+2);
		for(Edge f : e) {
			int a = f.a+1, b = f.b+1;
			if(d.find(a, b))continue;
			if(f.dist<=K){
				d.union(a, b);
				if(a==0||b==0||a==N+1||b==N+1)count--;
				else count-=2;
				K-=f.dist;
			}
		}
		if(N-idx-1<=K)count--;
		System.out.println(count);

	}
	private static class Edge implements Comparable<Edge>{
		int a, b, dist;
		public Edge(int a, int b) {
			this.a = a;
			this.b=b;
			this.dist = Math.abs(a-b)-1;
		}
		public int compareTo(Edge e) {
			return Integer.compare(this.dist, e.dist);
		}
	}
	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS() {
			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());}
	}
	private static class DisjointSet {
		int[] id, sz;
		public DisjointSet(int N) {//N=Number of verts
			id = new int[N];
			sz = new int[N];
			for (int i=0;i<N;i++){sz[i]=1;id[i]=i;}
		}

		private int root(int i){
			return id[i] = (i!=id[i])?root(id[i]):i;
		}
		public boolean find(int p, int q){
			return root(p)==root(q);
		}
		public void union(int p, int q){
			int i=root(p);
			int j=root(q);
			if (sz[i]<sz[j]){id[i]=j;sz[j]+=sz[i];}
			else 			{id[j]=i;sz[i]+=sz[j];};
		}
	}

}


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

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class D {
    private static BufferedReader br;
    private static StringTokenizer st;
    private static PrintWriter pw;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int numDays = readInt();
        int survive = readInt();

        /*
            On negative days, we have to use winter tires.

            If `survive` is more than the number of negative days,
            then we can use winter tires to "connect" to winter periods.
         */
        int negDays = 0;
        int[] temps = new int[numDays];
        for (int i = 0; i < numDays; i++) {
            temps[i] = readInt();
            if (temps[i] < 0) negDays++;
        }

        if (negDays > survive) {
            pw.println(-1);
            pw.close();
            return;
        }

        /*
                winter x ... summer .. wunter x+1

                If we wear winter tires during summer, then we save switching tires
                twice.

                Only exception is the first winter.
                We start by using summer tires.
                So if is the case of
                summer... first winter,  we could wear winter tires, but save only once.
         */
        int numWinters = 0;
        int[] start = new int[numDays];
        int[] end = new int[numDays];
        for (int i = 0; i < numDays; i++) {
            if (temps[i] < 0 && (i == 0 || temps[i - 1] >= 0)) {
                start[numWinters] = i;
            }

            if (temps[i] < 0 && (i == numDays - 1 || temps[i + 1] >= 0)) {
                end[numWinters] = i;
                numWinters++;
            }
        }

        if (numWinters == 0) {
            pw.println(0);
            pw.close();
            return;
        }

        // there is at least one winter
        int luxury = survive - negDays; // number of days we can afford using winter tire during summer
        int res = 0;
        res += 2 * numWinters; // tire switch at the beginning, and at the end
        if (temps[numDays - 1] < 0) res--; // no need to change tire at the end of last day.

        int lastSummerLength = numDays - end[numWinters - 1] - 1;

        /*
            0: wear winter tire during last summer
            1: don't wear winter tire during last summer
         */
        int[] optRes = new int[2];
        int[] optLux = new int[2];
        Arrays.fill(optRes, res);
        Arrays.fill(optLux, luxury);

        if (lastSummerLength <= luxury) {
            optRes[0]--;
            optLux[0] -= lastSummerLength;
        }

        if (numWinters >= 2) {
            int[] cost = new int[numWinters - 1];
            for (int i = 1; i < numWinters; i++) {
                cost[i - 1] = start[i] - end[i - 1] - 1;
            }
            Arrays.sort(cost);
            for (int i = 0; i < numWinters - 1; i++) {
                if (optLux[0] >= cost[i]) {
                    optLux[0] -= cost[i];
                    optRes[0] -= 2;
                }
                if (optLux[1] >= cost[i]) {
                    optLux[1] -= cost[i];
                    optRes[1] -= 2;
                }
            }
        }

        Arrays.sort(optRes);

        pw.println(optRes[0]);
        pw.close();
    }

    private static void exitImmediately() {
        pw.close();
        System.exit(0);
    }

    private static long readLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private static double readDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private static int readInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
//            if (!br.ready()) {
//                exitImmediately();
//            }
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
}


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

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class D {
    private static BufferedReader br;
    private static StringTokenizer st;
    private static PrintWriter pw;

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int numDays = readInt();
        int survive = readInt();

        /*
            On negative days, we have to use winter tires.

            If `survive` is more than the number of negative days,
            then we can use winter tires to "connect" to winter periods.
         */
        int negDays = 0;
        int[] temps = new int[numDays];
        for (int i = 0; i < numDays; i++) {
            temps[i] = readInt();
            if (temps[i] < 0) negDays++;
        }

        if (negDays > survive) {
            pw.println(-1);
            pw.close();
            return;
        }

        /*
                winter x ... summer .. wunter x+1

                If we wear winter tires during summer, then we save switching tires
                twice.

                Only exception is the last summer, which we save switching tires only once.

         */
        int numWinters = 0;
        int[] start = new int[numDays];
        int[] end = new int[numDays];
        for (int i = 0; i < numDays; i++) {
            if (temps[i] < 0 && (i == 0 || temps[i - 1] >= 0)) {
                start[numWinters] = i;
            }

            if (temps[i] < 0 && (i == numDays - 1 || temps[i + 1] >= 0)) {
                end[numWinters] = i;
                numWinters++;
            }
        }

        if (numWinters == 0) {
            pw.println(0);
            pw.close();
            return;
        }

        // there is at least one winter
        int luxury = survive - negDays; // number of days we can afford using winter tire during summer
        int res = 0;
        res += 2 * numWinters; // tire switch at the beginning, and at the end

        int lastSummerLength = numDays - end[numWinters - 1] - 1;

        /*
            0: wear winter tire during last summer
            1: don't wear winter tire during last summer
         */
        int[] optRes = new int[2];
        int[] optLux = new int[2];
        Arrays.fill(optRes, res);
        Arrays.fill(optLux, luxury);

        if (lastSummerLength <= luxury) {
            optRes[0]--;
            optLux[0] -= lastSummerLength;
        }

        if (numWinters >= 2) {
            int[] cost = new int[numWinters - 1];
            for (int i = 1; i < numWinters; i++) {
                cost[i - 1] = start[i] - end[i - 1] - 1;
            }
            Arrays.sort(cost);
            for (int i = 0; i < numWinters - 1; i++) {
                if (optLux[0] >= cost[i]) {
                    optLux[0] -= cost[i];
                    optRes[0] -= 2;
                }
                if (optLux[1] >= cost[i]) {
                    optLux[1] -= cost[i];
                    optRes[1] -= 2;
                }
            }
        }

        Arrays.sort(optRes);

        pw.println(optRes[0]);
        pw.close();
    }

    private static void exitImmediately() {
        pw.close();
        System.exit(0);
    }

    private static long readLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private static double readDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private static int readInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
//            if (!br.ready()) {
//                exitImmediately();
//            }
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
}


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

public class D {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] L = br.readLine().split(" ");

		int N = Integer.parseInt(L[0]);
		int K = Integer.parseInt(L[1]);

		int[] T = new int[N];
		L = br.readLine().split(" ");

		int cold = 0;

		for (int i = 0; i < N; i++) {
			T[i] = Integer.parseInt(L[i]);
			if (T[i] < 0)  cold++;
		}

		if (cold > K) {
			System.out.println(-1);
			return;
		}

		boolean warm = true;
		int changes = 0;
		int lastCold = -1;

		List<Integer> intervals = new ArrayList<>();

		for (int i = 0; i < N; i++) {
			if ((T[i] >= 0) != warm) {
				warm = !warm;
				changes++;
			}
			if (T[i] < 0) {
				if (lastCold >= 0 && i - lastCold > 1) {
					intervals.add(i - lastCold - 1);
				}
				lastCold = i;

			}
		}

		int leeway = K - cold;
		Collections.sort(intervals);
		//System.err.println(intervals);

		int interval = 0;
		while (leeway > 0 && interval < intervals.size()) {
			if (intervals.get(interval) <= leeway) {
				leeway -= intervals.get(interval);
				interval++;
				changes -= 2;
				//System.err.println(intervals);
			} else {
				break;
			}
		}

		//System.err.println(lastCold + " " + leeway);
		//System.err.println(changes);
		if (lastCold >= 0 && lastCold < N - 1 && N - 1 - lastCold <= leeway) {
			changes--;
		}

		System.out.println(changes);

	}
}


import java.util.ArrayList;
import java.util.BitSet;
import java.util.Scanner;

/**
 * Created by Luis Ngo on 22/12/2016.
 */
public class P747D {
    public static void main (String[] args){
        Scanner  scanner =  new Scanner(System.in);
        int n =  scanner.nextInt();
        int k =  scanner.nextInt();
        ArrayList<Integer> temp =  new ArrayList<>();
        temp.add(0);
        int lastNeg = 0;
        int numNegTemp = 0;
        for (int i = 0 ; i < n ; i++){
            int t = scanner.nextInt();
            temp.add(t);
            if (t < 0) {
                lastNeg = i+1;
                numNegTemp++;
            }
        }
        if (numNegTemp > k) {
            System.out.println (-1);
        } else{
            int count= 0;
            for (int i = 1; i <=n ; i++){
                int prev = temp.get(i-1);
                int today =  temp.get(i);
                if (prev >= 0 && today <0){
                    k--;
                    if (i + k >=n){
                        count = count+1;
                        break;
                    }if (i + k >=lastNeg){
                        count = count+2;
                        break;
                    }else {
                        count++;
                    }
                }else if (prev <0 && today >= 0){   //winter to summer
                    count++;
                }else if (today < 0) k--;
            }
            System.out.println(count);
        }

    }

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * Created by Luis Ngo on 22/12/2016.
 */
public class P747D {
    static int numNegTemp = 0;
    public static void main (String[] args){
        Scanner  scanner =  new Scanner(System.in);
        int n =  scanner.nextInt();
        int k =  scanner.nextInt();
        ArrayList<Integer> temp =  new ArrayList<>();
        temp.add(0);
        for (int i = 0 ; i < n ; i++){
            int t = scanner.nextInt();
            temp.add(t);
            if (t < 0) numNegTemp++;
        }
        if (numNegTemp > k) System.out.println (-1);
        else calculate(n, k, temp);
    }

    private static void calculate(int n, int k, ArrayList<Integer> temp) {
        int count= 0;
        int sum = 0;
        ArrayList<Integer> posGap = new ArrayList<Integer>();
        for (int i = 1; i <=n ; i++){
            int prev = temp.get(i-1);
            int today =  temp.get(i);
            if (prev >=0 && today < 0){
                sum+= count;
                posGap.add(count);
            }
            if (today >= 0){
                count++;
            }else{
                count = 0;
            }
        }
        posGap.add(count);
        sum+=count;
        if (posGap.size() == 1) System.out.println(0);
        else findResult(posGap,sum,k);
    }

    private static void findResult(ArrayList<Integer> posGap, int sum, int k) {
        k = k-numNegTemp;
        int numNegSeg = posGap.size()-1;
        posGap.remove(0);
        int last = posGap.get(posGap.size()-1);
        posGap.remove(posGap.get(posGap.size()-1));
        Collections.sort(posGap);
        int count = 0;
        for (int i = 0; i < posGap.size(); i++){
            int t =  posGap.get(i);
            k = k -t;
            if (k<0) {
                k = k+t;
                break;
            }
            count++;
        }
        int result =  (numNegSeg-count)*2;
        if (last <= k) System.out.println(result-1);
        else System.out.println(result);
    }

}


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

public class Main {

	static PrintWriter out;

	final static int INF = (int) 1e9;
	final static int MOD = (int) 1e9 + 7;
	final static long LINF = (long) 1e18;
	final static double PI = Math.acos(-1.0);
	final static double EPS = (double) 1e-9;

	static void solve() {
		int n = Input.nextInt();
		int k = Input.nextInt();
		int[] a = new int[n];
		int tot = 0;
		for (int i = 0; i < n; i++) {
			a[i] = Input.nextInt() >= 0 ? 1 : 0;
			tot += a[i] == 0 ? 1 : 0;
		}
		if (tot > k) {
			out.println(-1);
			return;
		}
		k -= tot;
		int st = -1, cnt = 0;
		ArrayList<Integer> ar = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (a[i] != st) {
				if (st != -1) {
					if (st == 1) {
						ar.add(cnt);
					}
					else {
						ar.add(-1);
					}
				}
				st = a[i];
				cnt = 1;
			}
			else {
				cnt++;
			}
		}
		if (st == 1) {
			ar.add(cnt);
		}
		else {
			ar.add(-1);
		}
		int ans = ar.size() + (a[0] == 1 ? 0 : 1) - 1;
		int mx = 0;
		for (int it = 0; it < 2; it++) {
			ArrayList<Integer> heap = new ArrayList<>();
			for (int i = 1; i < ar.size() - 1; i++) {
				if (ar.get(i) > 0) {
					heap.add(ar.get(i));
				}
			}
			int kk = k, tmp = 0;
			if (it == 1 && ar.size() > 1 && ar.get(ar.size() - 1) > 0) {
				if (kk >= ar.get(ar.size() - 1)) {
					kk -= ar.get(ar.size() - 1);
					tmp++;
				}
			}
			Collections.sort(heap);
			for (int e : heap) {
				if (kk >= e) {
					kk -= e;
					tmp += 2;
				}
			}
			mx = Math.max(mx, tmp);
		}
		out.println(ans - mx);
	}

	public static void main(String[] args) {
		try {
			out = new PrintWriter(System.out);
			//out = new PrintWriter(new FileWriter("a.out"));
		}
		catch (Exception ex) {
		}
		long stime = System.currentTimeMillis();
		solve();
		if (System.getProperty("ONLINE_JUDGE") == null) {
			out.println("\nTime elapsed: " + (System.currentTimeMillis() - stime) + "ms");
		}
		out.close();
	}

	static class Input {
		static StringTokenizer token = null;
		static BufferedReader in;
		static {
			try {
				if (System.getProperty("ONLINE_JUDGE") == null) {
					in = new BufferedReader(new FileReader("in.txt"));
				}
				else {
					in = new BufferedReader(new InputStreamReader(System.in));
				}
			}
			catch (Exception ex) {
			}
		}
		static int nextInt() {
			return Integer.parseInt(nextString());
		}
		static long nextLong() {
			return Long.parseLong(nextString());
		}
		static double nextDouble() {
			return Double.parseDouble(nextString());
		}
		static String nextString() {
			try {
				while (token == null || !token.hasMoreTokens()) {
					token = new StringTokenizer(in.readLine());
				}
			}
			catch (IOException e) {
			}
			return token.nextToken();
		}
	}
}


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

public class Main {

	static PrintWriter out;

	final static int INF = (int) 1e9;
	final static int MOD = (int) 1e9 + 7;
	final static long LINF = (long) 1e18;
	final static double PI = Math.acos(-1.0);
	final static double EPS = (double) 1e-9;

	static void solve() {
		int n = Input.nextInt();
		int k = Input.nextInt();
		int[] a = new int[n];
		int tot = 0;
		for (int i = 0; i < n; i++) {
			a[i] = Input.nextInt() >= 0 ? 1 : 0;
			tot += a[i] == 0 ? 1 : 0;
		}
		if (tot > k) {
			out.println(-1);
			return;
		}
		k -= tot;
		int st = -1, cnt = 0;
		ArrayList<Integer> ar = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (a[i] != st) {
				if (st != -1) {
					if (st == 1) {
						ar.add(cnt);
					}
					else {
						ar.add(-1);
					}
				}
				st = a[i];
				cnt = 1;
			}
			else {
				cnt++;
			}
		}
		if (st == 1) {
			ar.add(cnt);
		}
		else {
			ar.add(-1);
		}
		int ans = ar.size() + (a[0] == 1 ? 0 : 1) - 1;
		int mx = 0;
		for (int it = 0; it < 2; it++) {
			ArrayList<Integer> heap = new ArrayList<>();
			for (int i = 1; i < ar.size() - 1; i++) {
				if (ar.get(i) > 0) {
					heap.add(ar.get(i));
				}
			}
			int kk = k, tmp = 0;
			if (it == 1 && ar.get(ar.size() - 1) > 0) {
				if (kk >= ar.get(ar.size() - 1)) {
					kk -= ar.get(ar.size() - 1);
					tmp++;
				}
			}
			Collections.sort(heap);
			for (int e : heap) {
				if (kk >= e) {
					kk -= e;
					tmp += 2;
				}
			}
			mx = Math.max(mx, tmp);
		}
		out.println(ans - mx);
	}

	public static void main(String[] args) {
		try {
			out = new PrintWriter(System.out);
			//out = new PrintWriter(new FileWriter("a.out"));
		}
		catch (Exception ex) {
		}
		long stime = System.currentTimeMillis();
		solve();
		if (System.getProperty("ONLINE_JUDGE") == null) {
			out.println("\nTime elapsed: " + (System.currentTimeMillis() - stime) + "ms");
		}
		out.close();
	}

	static class Input {
		static StringTokenizer token = null;
		static BufferedReader in;
		static {
			try {
				if (System.getProperty("ONLINE_JUDGE") == null) {
					in = new BufferedReader(new FileReader("in.txt"));
				}
				else {
					in = new BufferedReader(new InputStreamReader(System.in));
				}
			}
			catch (Exception ex) {
			}
		}
		static int nextInt() {
			return Integer.parseInt(nextString());
		}
		static long nextLong() {
			return Long.parseLong(nextString());
		}
		static double nextDouble() {
			return Double.parseDouble(nextString());
		}
		static String nextString() {
			try {
				while (token == null || !token.hasMoreTokens()) {
					token = new StringTokenizer(in.readLine());
				}
			}
			catch (IOException e) {
			}
			return token.nextToken();
		}
	}
}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class D387 {

  public void solve() throws IOException {
    int n = nextInt();
    int k = nextInt();

    int count = 0;
    int lastwinter = -1;
    ArrayList<Integer> gaps = new ArrayList<Integer>();
    for (int i = 0; i < n; i++) {
      int temp = nextInt();
      if (temp < 0) {
        count++;
        if (lastwinter != -1) {
          gaps.add(i - lastwinter - 1);
        }
        lastwinter = i;
      }
    }
    if (lastwinter == -1) {
      System.out.println(0);
      return;
    }

    int lastgap = n - lastwinter - 1;

    if (count > k) {
      System.out.println(-1);
      return;
    }

    int baseline = count * 2;
    int allotment = k - count;

    Collections.sort(gaps);

    int best = baseline;
    if (allotment >= lastgap) {
      best -= 1;
    }

    int usage = baseline;
    for (int i = 0; i < gaps.size(); i++) {
      if (allotment >= gaps.get(i)) {
        allotment -= gaps.get(i);
        usage -= 2;
        best = Math.min(best, usage);
        if (allotment >= lastgap) {
          best = Math.min(best, usage - 1);
        }
      } else {
        break;
      }
    }

    System.out.println(best);
  }

  public BufferedReader br;
  public StringTokenizer st;
  public PrintWriter out;

  public String nextToken() 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(nextToken());
  }

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

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

  public void run() throws IOException {
    boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    oj = true;
    br = new BufferedReader(
        new InputStreamReader(oj ? System.in : new FileInputStream("input.txt")));
    out = new PrintWriter(oj ? System.out : new FileOutputStream("output.txt"));
    solve();
    out.close();
  }

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


//package round387;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class D {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), K = ni();
		int[] ts = na(n);
		if(K == 0 && Arrays.stream(ts).anyMatch(x -> x < 0)){
			out.println(-1);
			return;
		}
		int time = 0;
		int ope = 0;
		while(time < n){
			if(ts[time] < 0){
				ope++;
				time += K;
				if(time <= n)ope++;
			}else{
				time++;
			}
		}
		out.println(ope);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

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

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

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

	private long nl()
	{
		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();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ary[n+1];
    for(int i = 0;i<n;i++)cin>>ary[i];
    int y[n+1];
    y[0] = 0;
    y[1] = ary[0];
    int mini= ary[0];
    int maxi = ary[0];
    for(int i=2;i<n+1;i++){
        y[i] = y[i-1]+(i%2==1 ? ary[i-1]:-ary[i-1]);
        mini = min(mini,y[i]);
        maxi = max(maxi,y[i]);
    }
    //for(int i=0;i<=n;i++)cout << y[i]<< " ";
   // cout << mini << " " << maxi << endl;
    int numberOfLines = maxi-mini+1;
    string s[numberOfLines];
    int currentIndex = maxi-1;

    int l = 0;
    bool up = false;
    for(int i = 1;i<=n;i++){
        int counter = abs(y[i]-y[i-1]);
        int countRound = 0;
        //cout <<"X: "<< counter<<endl;
        up = !up;
        //if(requiredIndex > currentIndex)up=true;
        //else up = false;
        while(countRound < counter){
            countRound++;
            //cout << currentIndex<<endl;
            if(!up){
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="\\";
                l++;
                currentIndex++;
            }else{
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="/";
                l++;
                currentIndex--;
            }
        }
        if(!up)currentIndex--;
        else currentIndex++;
       /* if(up && i !=n){
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="\\";
            l++;
        }else{
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="/";
            l++;
        }*/
    }

    for(int i = 0;i<maxi-mini;i++){
        while(s[i].length() < l-1)s[i]+=" ";
        cout << s[i]<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ary[n+1];
    for(int i = 0;i<n;i++)cin>>ary[i];
    int y[n+1];
    y[0] = 0;
    y[1] = ary[0];
    int mini= y[0];
    int maxi = ary[0];
    for(int i=2;i<n+1;i++){
        y[i] = y[i-1]+(i%2==1 ? ary[i-1]:-ary[i-1]);
        mini = min(mini,y[i]);
        maxi = max(maxi,y[i]);
    }
    //for(int i=0;i<=n;i++)cout << y[i]<< " ";
    cout << mini << " " << maxi << endl;
    int numberOfLines = maxi-mini+1;

    string s[numberOfLines];
    int currentIndex = maxi-1;

    int l = 0;
    bool up = false;
    for(int i = 1;i<=n;i++){
        int counter = abs(y[i]-y[i-1]);
        int countRound = 0;
        cout <<"X: "<< counter<<endl;
        up = !up;
        //if(requiredIndex > currentIndex)up=true;
        //else up = false;

        while(countRound < counter){
            cout << currentIndex<<endl;
            countRound++;
            //cout << currentIndex<<endl;
            if(!up){
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="\\";
                l++;
                currentIndex++;
            }else{
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="/";
                l++;
                currentIndex--;
            }
        }
        if(!up)currentIndex--;
        else currentIndex++;
       /* if(up && i !=n){
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="\\";
            l++;
        }else{
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="/";
            l++;
        }*/
    }

    for(int i = 0;i<maxi-mini+1;i++){
        while(s[i].length() < l)s[i]+=" ";
        cout << s[i]<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ary[n+1];
    for(int i = 0;i<n;i++)cin>>ary[i];
    int y[n+1];
    y[0] = 0;
    y[1] = ary[0];
    int mini= ary[0];
    int maxi = ary[0];
    for(int i=2;i<n+1;i++){
        y[i] = y[i-1]+(i%2==1 ? ary[i-1]:-ary[i-1]);
        mini = min(mini,y[i]);
        maxi = max(maxi,y[i]);
    }
    //for(int i=0;i<=n;i++)cout << y[i]<< " ";
   // cout << mini << " " << maxi << endl;
    int numberOfLines = maxi-mini+1;
    string s[numberOfLines];
    int currentIndex = maxi-1;

    int l = 0;
    bool up = false;
    for(int i = 1;i<=n;i++){
        int counter = abs(y[i]-y[i-1]);
        int countRound = 0;
        cout <<"X: "<< counter<<endl;
        up = !up;
        //if(requiredIndex > currentIndex)up=true;
        //else up = false;
        while(countRound < counter){
            countRound++;
            //cout << currentIndex<<endl;
            if(!up){
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="\\";
                l++;
                currentIndex++;
            }else{
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="/";
                l++;
                currentIndex--;
            }
        }
        if(!up)currentIndex--;
        else currentIndex++;
       /* if(up && i !=n){
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="\\";
            l++;
        }else{
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="/";
            l++;
        }*/
    }

    for(int i = 0;i<maxi-mini+1;i++){
        while(s[i].length() < l)s[i]+=" ";
        cout << s[i]<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ary[n+1];
    for(int i = 0;i<n;i++)cin>>ary[i];
    int y[n+1];
    y[0] = 0;
    y[1] = ary[0];
    int mini= ary[0];
    int maxi = ary[0];
    for(int i=2;i<n+1;i++){
        y[i] = y[i-1]+(i%2==1 ? ary[i-1]:-ary[i-1]);
        mini = min(mini,y[i]);
        maxi = max(maxi,y[i]);
    }
    //for(int i=0;i<=n;i++)cout << y[i]<< " ";
   // cout << mini << " " << maxi << endl;
    int numberOfLines = maxi-mini+1;
    string s[numberOfLines];
    int currentIndex = maxi-1;

    int l = 0;
    bool up = false;
    for(int i = 1;i<=n;i++){
        int counter = abs(y[i]-y[i-1]);
        int countRound = 0;
        //cout <<"X: "<< counter<<endl;
        up = !up;
        //if(requiredIndex > currentIndex)up=true;
        //else up = false;
        while(countRound < counter){
            countRound++;
            //cout << currentIndex<<endl;
            if(!up){
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="\\";
                l++;
                currentIndex++;
            }else{
                while(s[currentIndex].length() < l){
                    s[currentIndex]+=" ";
                }
                s[currentIndex]+="/";
                l++;
                currentIndex--;
            }
        }
        if(!up)currentIndex--;
        else currentIndex++;
       /* if(up && i !=n){
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="\\";
            l++;
        }else{
            while(s[currentIndex].length() < l){
                s[currentIndex]+=" ";
            }
            s[currentIndex]+="/";
            l++;
        }*/
    }

    for(int i = 0;i<maxi-mini+1;i++){
        while(s[i].length() < l)s[i]+=" ";
        cout << s[i]<<endl;
    }
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int b[n][2];
    b[0][0]=a[0];
    b[0][1]=a[0];
    for(int i=1;i<n;i++){
        b[i][0]=b[i-1][0]+a[i];
        if(i%2==1) b[i][1]=b[i-1][1]-a[i];
        else b[i][1]=b[i-1][1]+a[i];
    }
    int maxey=0;
    int miney=10001;
    for(int i=0;i<n;i++){
        maxey=max(maxey,b[i][1]);
        miney=min(miney,b[i][1]);
    }
    int tot= maxey;
    if(miney<0) tot+=(miney*-1);
    string s[tot]={""};
    for(int i=0;i<tot;i++){
            int siz=b[n-1][0];
            char blank=' ';
            for(int j=0;j<siz;j++){
                s[i]+=blank;
            }
    }
    int sy=0;
    int sx=0;
    int pos=maxey-1;
    for(int i=0;i<n;i++){
        int destx=b[i][0];
        int desty=b[i][1];
        if(desty>sy){
            for(int i=sx;i<destx;i++){
                s[pos][i]='/';
                pos--;
            }
            pos++;
        }else{
           for(int i=sx;i<destx;i++){
                s[pos][i]='\\';
                pos++;
            }
            pos--;
        }
        sx=destx;
        sy=desty;
    }
    for(int i=0;i<tot;i++){
        cout<<s[i];
        if(i!=tot-1) cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define s(x, n) memset(x, n, sizeof(x));
#define pb(x) push_back(x)
#define NIL -1
#define MAXN 11

void solve()
{
    long long n;
    int k;
    cin >> n;
    char str[2005][1005];
    for (int i = 0; i < 2005; i++)
        for (int j = 0; j < 1005; j++)
            str[i][j] = ' ';
    int x = 0, y = 1002, MX = 0, MN = 1002;
    for (int i = 0; i < n; i++)
    {
        cin >> k;
        if (i % 2 == 0)
        {
            for (int i = 0; i < k; i++)
            {
                str[y++][x++] = '/';
            }
            y--;
        }
        else
        {
            for (int i = 0; i < k; i++)
            {
                str[y--][x++] = '\\';
            }
            y++;
        }
        if (y < MN)
            MN = y;
        if (y > MX)
            MX = y;
    }
    for (int j = MX; j >= MN; j--)
    {
        for (int i = 0; i < x; i++)
        {
            cout << str[j][i];
        }
        cout << "\n";
    }
}
int main()
{
#ifdef WIN32
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

#ifndef WIN32
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#endif
    int t;
    t = 1;
    /// cin >> t;
    for (int I = 1; I <= t; I++)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    int b[n];
    for(int i = 0; i<n; i++)
    {
        cin >> b[i];
    }
    char a[1100][1100];
    int i = 550, j = -1, ma = 550, mi = 550;
    for(int l = 0; l<n; l++)
    {
        if (l%2==0)
        {
            j++;
            a[i][j] = '/';
            b[l]--;
            mi = min(mi,i);
            ma = max(ma,i);
            while (b[l]>0)
            {
                i--; j++;
                a[i][j] = '/';
                mi = min(mi,i);
                ma = max(ma,i);
                b[l]--;
            }
        }
        else
        {
            j++;
            a[i][j] = '-';
            b[l]--;
            mi = min(mi,i);
            ma = max(ma,i);
            while (b[l]>0)
            {
                i++; j++;
                a[i][j] = '-';
                mi = min(mi,i);
                ma = max(ma,i);
                b[l]--;
            }
        }
    }
    int s = j;
    for(int i = mi; i<=ma; i++)
    {
        for(j = 0; j<=s; j++)
        {
            char c = 92;
            if (a[i][j]=='-') cout << c;
            else if (a[i][j]=='/') cout << "/";
            else cout << " ";
        }
        cout << endl;
    }
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	int X = 0;
	map<int, unordered_map<int, char>> mp;
	int Y = 0;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		if (i & 1) {
			while (a--) {
				mp[Y++][X++] = '\\';
			}
		} else {
			while (a--) {
				mp[--Y][X++] = '/';
			}
		}
	}
	for (const auto& it : mp) {
		for (int v = 0; v < X; v++) {
			auto jt = it.second.find(v);
			if (jt == it.second.end()) {
				cout << ' ';
			} else {
				cout << jt->second;
			}
		}
		cout << '\n';
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX INT_MAX
#define MIN INT_MIN
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
vector<ll> v[301],vv,v1;
ll a,b,c[1234567],c1[123][123],d[1234567],e,i,j,n,x,y,l,r,k;
string s,s1;
ll used[301];
ll ans;
char ch[5001][5001];
int main(){
    memset(ch,0,sizeof(ch));
    cin>>n;
    x=2000;
    y=100;
    rep(i,1,n){
		cin>>a;
		if(i % 2 == 1){
			rep(j,1,a){
				ch[x][y] = '/';
				x--;
				y++;
			}
			x++;
		}
		else{
			rep(j,1,a){
				ch[x][y] = '\\';
				x++;
				y++;
			}
			x--;
		}
	}
	ll x1 = 10000, x2 = 0, y1 = 10000, y2 = 0;
	rep(i,0,5000)
		rep(j,0,5000)
			if(ch[i][j] != 0) {
				x1 = min(x1, i);
				x2 = max(x2, i);
				y1 = min(y1, j);
				y2 = max(y2, j);
			}
	for(int i = x1; i <= x2; i++){
		for(int j = y1; j <= y2; j++)
			if(ch[i][j] == 0)
				cout<<' ';
			else
				cout<<ch[i][j];
		cout<<'\n';
	}
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n ;
    cin >> n ;
    int arr[n+1]={0};
    int arr2[n+1][2] = {(0,0)};
    int sum1 = 0 ,sum2= 0 , minY = 0 , maxY = 0;
    for(int i=1;i<=n;i++){
        cin >> arr[i] ;
        sum1 += arr[i] ;
        sum2 += pow(-1,i+1)*arr[i];
        arr2[i][0]=sum1;
        arr2[i][1]=sum2;
        minY=min(sum2,minY);
        maxY=max(sum2,maxY);
    }
    int res[abs(maxY-minY)+1][sum1+1]={(0,0)};
    // cout << minY << " " << maxY << endl ;
    map<int,int> index ;
    int k=0;
    for(int i=maxY ;i>=minY ; k++,i--){
              index[i] = k;
             // cout << i << " " << k << endl ;
    }
    for(int i=0;i<n;i++){
        if(arr2[i][1] < arr2[i+1][1]){
                int m = 0 ;
            for(int j=arr2[i][0] ; j < arr2[i+1][0] ; j++){
                   res[index[arr2[i][1]+m]][j] = 1;
        m++;
                   // cout << index[arr2[i][1]+j] << " " << j  << endl ;
            }
        }
        else{
                int m = 1 ;
                for(int j=arr2[i][0] ; j < arr2[i+1][0] ; j++){
                   res[index[arr2[i][1]-m]][j] = 2 ;
                   m++ ;
                  //  cout << index[arr2[i][1]-j] << " " << j  << endl ;
            }
        }
    }

    for(int i=1;i<abs(maxY-minY)+1;i++){
        for(int j=0 ; j< sum1; j++){
            if(res[i][j] == 0 ) cout << " " ;
             if(res[i][j] == 1 ) cout << "/" ;
              if(res[i][j] == 2 ) cout << "\\" ;
        }
        cout << endl ;
    }

    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n ;
    cin >> n ;
    int arr[n+1]={0};
    int arr2[n+1][2] = {(0,0)};
    int sum1 = 0 ,sum2= 0 , minY = 0 , maxY = 0;
    for(int i=1;i<=n;i++){
        cin >> arr[i] ;
        sum1 += arr[i] ;
        sum2 += pow(-1,i+1)*arr[i];
        arr2[i][0]=sum1;
        arr2[i][1]=sum2;
        minY=min(sum2,minY);
        maxY=max(sum2,maxY);
    }
    int res[abs(maxY-minY)+1][sum1+1]={(0,0)};
    // cout << minY << " " << maxY << endl ;
    map<int,int> index ;
    int k=0;
    for(int i=maxY ;i>=minY ; k++,i--){
              index[i] = k;
             // cout << i << " " << k << endl ;
    }
    for(int i=0;i<n;i++){
        if(arr2[i][1] < arr2[i+1][1]){
                int m = 0 ;
            for(int j=arr2[i][0] ; j < arr2[i+1][0] ; j++){
                   res[index[arr2[i][1]+m]][j] = 1;
        m++;
                   // cout << index[arr2[i][1]+j] << " " << j  << endl ;
            }
        }
        else{
                int m = 1 ;
                for(int j=arr2[i][0] ; j < arr2[i+1][0] ; j++){
                   res[index[arr2[i][1]-m]][j] = 2 ;
                   m++ ;
                  //  cout << index[arr2[i][1]-j] << " " << j  << endl ;
            }
        }
    }

    for(int i=1;i<abs(maxY-minY)+1;i++){
        for(int j=0 ; j< sum1+1 ; j++){
            if(res[i][j] == 0 ) cout << " " ;
             if(res[i][j] == 1 ) cout << "/" ;
              if(res[i][j] == 2 ) cout << "\\" ;
        }
        cout << endl ;
    }

    return 0;
}


/* -*- coding: utf-8 -*-
 *
 * 0435C.cc: C. Cardiogram
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 1000;
const int MAX_A = 1000;

/* typedef */

/* global variables */

int as[MAX_N];
char fs[MAX_A][MAX_A + 4];

/* subroutines */

/* main */

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

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

  int w = 0, minh = 0, maxh = 0;
  for (int i = 0, d = 1, h = 0; i < n; i++, d *= -1) {
    scanf("%d", as + i);
    w += as[i];
    h += as[i] * d;
    if (minh > h) minh = h;
    if (maxh < h) maxh = h;
  }
  int h = maxh - minh;
  //printf("w=%d, h=%d, minh=%d, maxh=%d\n", w, h, minh, maxh);

  for (int y = 0; y < h; y++) fill(fs[y], fs[y] + w, ' ');

  for (int i = 0, y = -minh, x = 0, d = 1; i < n; i++, d *= -1)
    for (int j = 0; j < as[i]; j++) {
      if (d > 0) fs[y++ ][x++] = '/';
      else fs[--y][x++] = '\\';
    }

  for (int y = h - 1; y >= 0; y--) puts(fs[y]);
  return 0;
}


#include "algorithm"
#include "iostream"
using namespace std;
#define F first
#define S second
#define Mn 1010
int            n, a[Mn];
char           out[2 * Mn][2 * Mn];
pair<int, int> p[Mn];

int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < 2 * Mn; i++)
    for (int j = 0; j < 2 * Mn; j++) out[i][j] = ' ';
  p[0]   = {0, 0};
  int lb = 0, ub = 0;
  for (int i = 1; i <= n; i++) {
    int k       = (i & 1) ? 1 : -1;
    p[i]        = {p[i - 1].F + a[i], p[i - 1].S + k * a[i]};
    char placed = (i & 1) ? '/' : '\\';
    int  y      = p[i - 1].S;
    if (k < 0) y--;
    for (int x = p[i - 1].F; x < p[i].F; x++) {
      out[Mn + y][x] = placed;
      y += k;
      lb = min(lb, y);
      ub = max(ub, y);
    }
  }
  for (int i = ub - 1; i > lb; i--) {
    for (int j = 0; j < p[n].F; j++) cout << out[Mn + i][j];
    cout << '\n';
  }
}


#include "algorithm"
#include "iostream"
using namespace std;
#define F first
#define S second
#define Mn 1010
int            n, a[Mn];
char           out[2 * Mn][2 * Mn];
pair<int, int> p[Mn];

int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < 2 * Mn; i++)
    for (int j = 0; j < 2 * Mn; j++) out[i][j] = ' ';
  p[0] = {0, 0};
  for (int i = 1; i <= n; i++) {
    p[i]        = {p[i - 1].F + a[i], p[i - 1].S + (-1 + 2 * (i & 1)) * a[i]};
    char placed = (i & 1) ? '/' : '\\';
    int  k      = (i & 1) ? 1 : -1;
    int  y      = p[i - 1].S;
    if (k < 0) y--;
    for (int x = p[i - 1].F; x < p[i].F; x++) {
      out[Mn + y][x] = placed;
      y += k;
    }
  }
  int ub = max_element(p, p + n, [](auto x, auto b) { return x.S < b.S; })->second;
  int lb = min_element(p, p + n, [](auto x, auto b) { return x.S < b.S; })->second;
  for (int i = ub - 1; i >= lb; i--) {
    for (int j = 0; j < p[n].F; j++) cout << out[Mn + i][j];
    cout << '\n';
  }
}


#include "algorithm"
#include "iostream"
using namespace std;
#define F first
#define S second
#define Mn 1010
int            n, a[Mn];
char           out[2 * Mn][2 * Mn];
pair<int, int> p[Mn];

int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < 2 * Mn; i++)
    for (int j = 0; j < 2 * Mn; j++) out[i][j] = ' ';
  p[0]   = {0, 0};
  int lb = 0, ub = 0;
  for (int i = 1; i <= n; i++) {
    int k       = (i & 1) ? 1 : -1;
    p[i]        = {p[i - 1].F + a[i], p[i - 1].S + k * a[i]};
    char placed = (i & 1) ? '/' : '\\';
    int  y      = p[i - 1].S;
    if (k < 0) y--;
    for (int x = p[i - 1].F; x < p[i].F; x++) {
      out[Mn + y][x] = placed;
      lb             = min(lb, y);
      ub             = max(ub, y);
      y += k;
    }
  }
  for (int i = ub; i >= lb; i--) {
    for (int j = 0; j < p[n].F; j++) cout << out[Mn + i][j];
    cout << '\n';
  }
}


#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pdd pair<ld,ld>
typedef long double ld;
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define X first
#define Y second
#define oset tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update>
#define readfile freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
const int mod = 1e9 + 7, x = 864197532, N = 300087, logN = 18, K = 500, C = 1e5 + 87;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n], b[n + 1], u = 1;
    b[0] = 0;
    fop (i,0,n) {
        cin >> a[i];
        b[i + 1] = b[i] + a[i] * u;
        u *= -1;
    }
    int mn = *min_element(b, b + n + 1);
    fop (i,0,n + 1) b[i] -= mn;
    int mx = *max_element(b, b + n + 1);
    int id = 0, now = mx - b[0] - 1;
    set <pii> s1, s2;
    fop (i,0,n) {
        fop (j,0,a[i]) {
            if (i & 1) {
                s2.insert({now++, id++});
            } else {
                s1.insert({now--, id++});
            }
        }
        if (i & 1) now--;
        else now++;
    }
    fop (i,0,mx) {
        fop (k,0,id) {
            if (s1.count({i, k})) cout << '/';
            else if (s2.count({i, k})) cout << '\\';
            else cout << ' ';
        }
        cout << endl;
    }
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    int n;
    cin>>n;
    vi a(n);
    int sm=0;
    rep(i,0,n) cin>>a[i],sm+=a[i];
    vector<string>canvas;
    int mx=0,my=INF,ss=0;
    rep(i,0,n){
        if(i&1) ss-=a[i];
        else ss+=a[i];
        mx=max(ss,mx);
        my=min(ss,my);
        // cout<<mx<<' '<<my<<'\n';
    }
    int s=abs(mx)+abs(my);
    // cout<<s<<'\n';
    rep(i,0,2*s){
        string test="";
        rep(i,0,sm){
            test+=" ";
        }
        canvas.pb(test);
    }
    int x=mx,y=0;
    rep(i,0,n){
        if(i&1){
            rep(j,0,a[i]) canvas[++x][y++]=(char)(92);
        }
        else{
            rep(j,0,a[i]) canvas[x--][y++]=(char)(47);
        }
    }
    rep(i,0,2*s){
        bool f=0;
        rep(j,0,sm){
            if(canvas[i][j]!=' '){
                f=1;
                break;
            }
        }
        if(f){
            cout<<canvas[i];
            cout<<'\n';
        }
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i)
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0);

void solve(){
    map<string,int>pt,m;
    int q,n;
    cin>>q;
    char a;
    string b,x;
    while(q--){
        cin>>a>>b;
        if(a=='+'){
            m[b]++;
            n=b.size();
            x="";
            int l=b[0]-'0',r;
            if(l&1){
                x+="1";
            }
            else{
                x+="0";
            }
            rep(i,1,n){
                r=b[i]-'0';
                if((r&1)!=(l&1)){
                    if(r&1){
                        x+="1";
                    }
                    else{
                        x+="0";
                    }
                }
                l=r;
            }
            // cout<<x<<' ';
            set<string>checker;
            n=x.size();
            rep(i,0,n){
                if(checker.count(x.substr(i,n))==0) pt[x.substr(i,n)]++,checker.insert(x.substr(i,n));//cout<<x.substr(i,n)<<' ';
            }
            rep(i,0,n){
                if(checker.count(x.substr(0,i+1))==0) pt[x.substr(0,i+1)]++,checker.insert(x.substr(0,i+1));//cout<<x.substr(0,i+1)<<' ';
            }
            // cout<<'\n';
        }
        if(a=='-'){
            m[b]--;
            n=b.size();
            x="";
            int l=b[0]-'0',r;
            if(l&1){
                x+="1";
            }
            else{
                x+="0";
            }
            rep(i,1,n){
                r=b[i]-'0';
                if((r&1)!=(l&1)){
                    if(r&1){
                        x+="1";
                    }
                    else{
                        x+="0";
                    }
                }
                l=r;
            }
            // cout<<x<<' ';
            set<string>checker;
            n=x.size();
            rep(i,0,n){
                if(checker.count(x.substr(i,n))==0) pt[x.substr(i,n)]--,checker.insert(x.substr(i,n));//cout<<x.substr(i,n)<<' ';
            }
            rep(i,0,n){
                if(checker.count(x.substr(0,i+1))==0) pt[x.substr(0,i+1)]--,checker.insert(x.substr(0,i+1));//cout<<x.substr(0,i+1)<<' ';
            }
            // cout<<'\n';
        }
        if(a=='?'){
            n=b.size();
            string c,d;
            int ctr=0;
            set<string>checker;
            if(b[0]=='0'){
                c=b.substr(1,n);
                if(checker.count(c)==0) ctr+=pt[c];
                checker.insert(c);
            }
            else{
                c='0'+b;
                if(checker.count(c)==0) ctr+=pt[c];
                checker.insert(c);
            }
            if(b[n-1]=='0'){
                d=b.substr(0,n-1);
                if(checker.count(d)==0) ctr+=pt[d];
                checker.insert(d);
            }
            else{
                d=b+'0';
                if(checker.count(d)==0) ctr+=pt[d];
                checker.insert(d);
                d='0'+c;
                if(checker.count(d)==0) ctr+=pt[d];
                checker.insert(d);
            }
            // cout<<c<<' '<<d<<'\n';
            if(checker.count(b)==0){
                ctr+=pt[b];
                checker.insert(b);
            }
            cout<<ctr<<'\n';
        }
    }
}

int main(){
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
    // #endif
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}


#include <bits/stdc++.h>
#define roflan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ld long double
#define int long long
using namespace std;

signed main(){
  roflan;
  int n;
  cin >> n;
  vector <int> a(n);
  int sum = 0, chk = 0;
  int mn = 0, mx = 0;
  for (int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
    if (i % 2 == 0) chk += a[i];
    else chk -= a[i];
    mn = min(mn, chk);
    mx = max(mx, chk);
  }
  mx -= mn;
  assert((mx + 2) * (sum + 2) < 1e8);
  //cout << mn << '\n';
  //cout << mx << ' ' << sum << '\n';
  vector <vector <char>> v(mx + 2, vector <char> (sum + 2, ' '));
  int row = mx + mn;
  int col = 1;
  for (int i = 0; i < n; i++){
    int x = a[i];
    if (i % 2 == 0){
      for (; x && row >= 1; row--, col++, x--){
        v[row][col] = '/';
      }
      row++;
    }
    else{
      for (; x && row <= mx; row++, col++, x--){
        v[row][col] = '\\';
      }
      row--;
    }
  }
  for (int i = 1; i <= mx; i++){
    for (int j = 1; j <= sum; j++){
      //if (v[i][j] != '\\' && v[i][j] != '/') cout << "*";
      //else
      cout << v[i][j];
    }
    cout << '\n';
  }
  return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[2005][2005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(ans,' ',sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=0;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx-1;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[1005][1005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(0,ans,sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[1005][1005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(ans,' ',sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx-1;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[1005][1005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(ans,0,sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[2005][2005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(ans,' ',sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx-1;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
int a[1005];
char ans[1005][1005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	memset(ans,' ',sizeof ans);
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <iostream>
using namespace std;
int a[1005];
char ans[1005][1005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin >> x;
		if(i&1) a[i]=a[i-1]+x;
		else a[i]=a[i-1]-x;
	}
	int mn=1e9,mx=-1e9;
	for(int i=1;i<=n;i++) mn=min(mn,a[i]);
	for(int i=0;i<=n;i++) a[i]-=mn,mx=max(mx,a[i]);
	int now=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>a[i-1])
		{
			for(int j=a[i-1];j<a[i];j++)
				ans[j][now++]='/';
		}
		else
		{
			for(int j=a[i-1]-1;j>=a[i];j--)
				ans[j][now++]='\\';
		}
	}
	for(int i=mx;i>=0;i--)
	{
		for(int j=0;j<now;j++)
			cout << ans[i][j];
		puts("");
	}
	return 0;
}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN]={' '};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i >= mn ; i--){
        for(int j = 0 ; j < x ; j++){
            cout << a[j][i] ;
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN]={' '};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                y--;
                z--;
                a[x][y]='\\';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i >= mn ; i--){
        for(int j = 0 ; j < x ; j++){
            cout << a[j][i] ;
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i > mn ; i--){
        for(int j = 0 ; j < x ; j++){
            if(a[j][i]=='/' or a[j][i]=='\\')cout << a[j][i] ;
            else cout << " ";
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
                mn=min(y,mn);
                mx=max(y,mx);
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
                mn=min(y,mn);
                mx=max(y,mx);
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i >= mn ; i--){
        for(int j = 0 ; j < x ; j++){
            if(a[j][i]=='/' or a[j][i]=='\\')cout << a[j][i] ;
            else cout << " ";
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i >= mn ; i--){
        for(int j = 0 ; j < x ; j++){
            if(a[j][i]=='/' or a[j][i]=='\\')cout << a[j][i] ;
            else cout << " ";
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
            }
            mn=min(y,mn);
            mx=max(y,mx);
        }
    }

    for(int i = mx ; i > mn ; i--){
        for(int j = 0 ; j < x ; j++){
            cout << a[j][i] ;
        }
        cout << endl;
    }

}


#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define vp vector<pair<ll,ll>>
#define vi vector<ll>
#define skip continue
#define ll long long
#define pb push_back

using namespace std;

const ll INF=1e18 , MAXN= 2222 , MOD=1e9+7;

ll n , mn=INF , mx=0 , x , y=1000;

char a[MAXN][MAXN];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n ;

    for(int z , i = 0 ; i < n ; i++){
        cin >> z;
        if(i%2==0){
            while(z){
                y++;
                z--;
                a[x][y]='/';
                x++;
                mn=min(y,mn);
                mx=max(y,mx);
            }
        }
        else{
            while(z){
                z--;
                a[x][y]='\\';
                y--;
                x++;
                mn=min(y,mn);
                mx=max(y,mx);
            }
        }
    }
    for(int i = mx ; i >= mn ; i--){
        for(int j = 0 ; j < x ; j++){
            if(a[j][i]=='/' or a[j][i]=='\\')cout << a[j][i] ;
            else cout << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, x, s, maxx, minn, offset, d;
	cin >> n;
	vector<int> a(n);
	s = 0; maxx = 0, minn = 0;
	x = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) x += a[i];
		else x -= a[i];
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}
	d = maxx - minn;

	vector<vector<char>> ans(d * 5, vector<char>(s, ' '));
	vector<bool> touched(d * 5, false);
	s = 0;
	x = maxx + maxx;
	for (i = 0; i < n; i++) {
		for (j = 0; j < a[i]; j++) {
			if (i % 2 == 0) {
				ans[x][s] = '/';
				touched[x] = true;
				x--;
			}
			else {
				x++;
				touched[x] = true;
				ans[x][s] = '\\';
			}
			s++;
		}
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}

	for (i = 0; i < d * 5; i++) {
		if (!touched[i]) continue;
		for (j = 0; j < s; j++) cout << ans[i][j];
		cout << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

#define MAXN 1200
char ans[MAXN][MAXN];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, x, s, maxx, minn, offset, d;
	cin >> n;
	vector<int> a(n);
	s = 0; maxx = 0, minn = 0;
	x = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) x += a[i];
		else x -= a[i];
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}
	d = maxx - minn;

	vector<bool> touched(d + 30, false);
	s = 0;
	x = maxx + 3;
	for (i = 0; i < n; i++) {
		for (j = 0; j < a[i]; j++) {
			if (i % 2 == 0) {
				ans[x][s] = '/';
				touched[x] = true;
				x--;
			}
			else {
				x++;
				touched[x] = true;
				ans[x][s] = '\\';
			}
			s++;
		}
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}

	for (i = 0; i < d + 30; i++) {
		if (!touched[i]) continue;
		for (j = 0; j < s; j++) {
			if (ans[i][j] == 0) cout << ' ';
			else cout << ans[i][j];
		}
		cout << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

#define MAXN 2200
char ans[MAXN][MAXN];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, x, s, maxx, minn, offset, d;
	cin >> n;
	vector<int> a(n);
	s = 0; maxx = 0, minn = 0;
	x = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) x += a[i];
		else x -= a[i];
		maxx = max(maxx, s);
		minn = min(minn, s);
	}
	d = maxx - minn;

	vector<bool> touched(MAXN, false);
	s = 0;
	x = maxx + 3;
	for (i = 0; i < n; i++) {
		for (j = 0; j < a[i]; j++) {
			if (i % 2 == 0) {
				ans[x][s] = '/';
				touched[x] = true;
				x--;
			}
			else {
				x++;
				touched[x] = true;
				ans[x][s] = '\\';
			}
			s++;
		}
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}

	for (i = 0; i < MAXN; i++) {
		if (!touched[i]) continue;
		for (j = 0; j < s; j++) {
			if (ans[i][j] == 0) cout << ' ';
			else cout << ans[i][j];
		}
		cout << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

#define MAXN 2200
char ans[MAXN][MAXN];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, x, s, maxx, minn, offset, d;
	cin >> n;
	vector<int> a(n);
	s = 0; maxx = 0, minn = 0;
	x = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) x += a[i];
		else x -= a[i];
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}
	d = maxx - minn;

	vector<bool> touched(MAXN, false);
	s = 0;
	x = maxx + 3;
	for (i = 0; i < n; i++) {
		for (j = 0; j < a[i]; j++) {
			if (i % 2 == 0) {
				ans[x][s] = '/';
				touched[x] = true;
				x--;
			}
			else {
				x++;
				touched[x] = true;
				ans[x][s] = '\\';
			}
			s++;
		}
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}

	for (i = 0; i < MAXN; i++) {
		if (!touched[i]) continue;
		for (j = 0; j < s; j++) {
			if (ans[i][j] == 0) cout << ' ';
			else cout << ans[i][j];
		}
		cout << "\n";
	}

	return 0;
}


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, i, j, k, x, s, maxx, minn, offset, d;
	cin >> n;
	vector<int> a(n);
	s = 0; maxx = 0, minn = 0;
	x = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		if (i % 2 == 0) x += a[i];
		else x -= a[i];
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}
	d = maxx - minn;

	vector<vector<char>> ans(d * 3, vector<char>(s, ' '));
	vector<bool> touched(d * 5, false);
	s = 0;
	x = maxx + 3;
	for (i = 0; i < n; i++) {
		for (j = 0; j < a[i]; j++) {
			if (i % 2 == 0) {
				ans[x][s] = '/';
				touched[x] = true;
				x--;
			}
			else {
				x++;
				touched[x] = true;
				ans[x][s] = '\\';
			}
			s++;
		}
		maxx = max(maxx, a[i]);
		minn = min(minn, a[i]);
	}

	for (i = 0; i < d * 3; i++) {
		if (!touched[i]) continue;
		for (j = 0; j < s; j++) cout << ans[i][j];
		cout << "\n";
	}

	return 0;
}