import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] r = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++) r[i] = in.nextInt();
            for (int i = 0; i < n; i++) b[i] = in.nextInt();
            int rcnt = 0, bcnt = 0;
            for (int i = 0; i < n; i++) {
                if (r[i] != b[i]) {
                    if (r[i] == 1) {
                        rcnt++;
                    } else {
                        bcnt++;
                    }
                }
            }
            if (rcnt == 0) {
                out.println(-1);
                return;
            }
            out.println(bcnt / rcnt + 1);
        }

    }
}

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

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

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

            return res.toString();
         }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        public U first;
        public V second;

        public Pair(U first, V second) {
            this.first = first;
            this.second = second;
        }

        public int hashCode() {
            return (first == null ? 0 : first.hashCode() * 31) + (second == null ? 0 : second.hashCode());
        }

        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }
            Pair<U, V> p = (Pair<U, V>) o;
            return (first == null ? p.first == null : first.equals(p.first)) &&
                    (second == null ? p.second == null : second.equals(p.second));
        }

        public int compareTo(Pair<U, V> b) {
            int cmpU = first.compareTo(b.first);
            return cmpU != 0 ? cmpU : second.compareTo(b.second);
        }

        public String toString() {
            return String.format("Pair = (%s, %s)", first.toString(), second.toString());
        }
    }

    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }
    public void run() {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);

             int n=sc.nextInt();
             int arr1[]=new int[n];
             int arr2[]=new int[n];
             int p1=0,p2=0;
             for(int i=0;i<n;i++)
             {
                 arr1[i]=sc.nextInt();
                 if(arr1[i]==1)
                    p1++;
             }
             int cnt=0;
             for(int i=0;i<n;i++)
             {
                 arr2[i]=sc.nextInt();
                 if(arr2[i]==1)
                    p2++;
             }
             int flag=0;
             if(p1>p2)
             {
                 w.println(1);
             }
             else
             {
                 for(int i=0;i<n;i++)
                 {
                     if(arr1[i]>arr2[i])
                     {
                         cnt++;
                         flag=1;
                     }
                     else if(arr1[i]==1 && arr2[i]==1)
                     {
                         p1--;p2--;
                     }
                 }
                 if(flag==0)
                 {
                     w.println("-1");
                 }
                 else
                 {
                     int temp=1;
                     int points=cnt;
                     while(points<=p2)
                     {
                         temp++;
                         points=cnt*temp;
                         //w.println(points+" "+p2);

                     }
                     w.println(temp);
                 }
             }
        w.close();
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author LUCIANO.
 */
import java.util.*;

public class Solve {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] r = new int[n];
        int[] b = new int[n];
        int rp = 0;
        int rc = 0;
        int bp = 0;
        for(int i = 0; i < n; i++) r[i] = in.nextInt();
        for(int i = 0; i < n; i++) b[i] = in.nextInt();
        for(int i = 0; i < n; i++)
        {
            if(r[i] == 1 && b[i] == 0)
            {
                rp += 1;
                rc += 1;
            }else if(b[i] == 1 && r[i] == 0)
            {
                bp += 1;
            }
        }
        if(rp > bp)
        {
            System.out.println(1);
        }else{
            if(rc == 0)
            {
                System.out.println(-1);
            }else{
                int toreach = (bp - rp) + 1;
                int ans = toreach / rc + 1;
                if((toreach % rc) != 0) ans += 1;
                System.out.println(ans);
            }
        }
    }
}

import java.util.*;

import java.util.Scanner;

// Working program with FastReader

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.util.Scanner;

import java.util.StringTokenizer;

public class Solution {

    public static void main(String[] args) {

               FastReader s=new FastReader();
               int n=s.nextInt();
               int left[]=new int[n];
               int right[]=new int[n];
               for(int i=0;i<n;i++)left[i]=s.nextInt();
               for(int i=0;i<n;i++)right[i]=s.nextInt();
               int x=0;
               int y=0;
               int i=0;
               while(i<n)
               {
                   if(left[i]==right[i]&&left[i]==1)
                   {
                       i++;
                       continue;
                   }
                   else
                   {
                       x+=left[i];
                       y+=right[i];
                       i++;
                   }
               }

               if(x==0)
               {
                   System.out.println(-1);

               }
               else{
                   int ans=y/x+1;
                   System.out.println(ans);
               }

    }

static class FastReader

    {

        BufferedReader br;

        StringTokenizer st;

        public FastReader()

        {

            br = new BufferedReader(new

                     InputStreamReader(System.in));

        }

        String next()

        {

            while (st == null || !st.hasMoreElements())

            {

                try

                {

                    st = new StringTokenizer(br.readLine());

                }

                catch (IOException  e)

                {

                    e.printStackTrace();

                }

            }

            return st.nextToken();

        }

        int nextInt()

        {

            return Integer.parseInt(next());

        }

        long nextLong()

        {

            return Long.parseLong(next());

        }

        double nextDouble()

        {

            return Double.parseDouble(next());

        }

        String nextLine()

        {

            String str = "";

            try

            {

                str = br.readLine();

            }

            catch (IOException e)

            {

                e.printStackTrace();

            }

            return str;

        }

    }

}

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

import static java.lang.Math.*;

public class Cf182 implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

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

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}
	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Cf182(),"Main",1<<27).start();
	}

	public static long gcd(long a, long b)
	{
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
	//  array sorting by colm
	static void sortbycolomn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>() {

          public int compare(final int[] entry1,
                             final int[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }

	// gcd

	public static long findGCD(long arr[], int n)
	{
		long result = arr[0];
		for (int i = 1; i < n; i++)
			result = gcd(arr[i], result);
		return result;
	}
	// fibonaci
	static int fib(int n)
    {
        int a = 0, b = 1, c;
        if (n == 0)
            return a;
        for (int i = 2; i <= n; i++)
        {
            c = a + b;
            a = b;
            b = c;
        }
        return b;
    }

// sort a string
    public static String sortString(String inputString)
    {

        char tempArray[] = inputString.toCharArray();

        Arrays.sort(tempArray);

        return new String(tempArray);
    }
	public void run()
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int n = sc.nextInt();
		int a[] = new int[n];
		int b[] = new int[n];
		for(int i=0;i<n;i++)
		    a[i] = sc.nextInt();
		for(int i=0;i<n;i++)
		    b[i] = sc.nextInt();
		int a1=0,b1=0;
		for(int i=0;i<n;i++)
		{
		    if(a[i]==1 && b[i]==0)
		        a1++;
		    if(a[i]==0 && b[i]==1)
		        b1++;
		}
		if(a1==0)
		    System.out.println("-1");
		else
		    System.out.println((int)Math.ceil((1+b1)/(float)a1));
	}
}

import java.io.OutputStream;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedHashSet;
import java.io.Writer;
import java.io.OutputStreamWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Egor Kulikov (egor@egork.net)
 */
public class Solution {

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Solutio solver = new Solutio();
        int testCount = 1;//Integer.parseInt(in.next());
        int sum=0,te=0;
        for (int i = 1; i <= testCount; i++)
        {
            solver.solve(i, in, out);
        }
        out.close();
    }
//**********************SOLVE    HERE     EVERYTHING******************************

    //1 2 3 4 5
    static class Solutio {

        public void solve(int testNumber, InputReader in, OutputWriter out) {
        	int n=in.readInt();
        	int ro[]=new int[n];
        	int bo[]=new int[n];
        	int z1=0,o1=0;
        	for(int i=0;i<n;i++) {
        		ro[i]=in.readInt();
        		if(ro[i]==1)
        			o1++;
        		else
        			z1++;
        	}
        	int z2=0,o2=0;
        	for(int i=0;i<n;i++) {
        		bo[i]=in.readInt();
        		if(bo[i]==1)
        			o2++;
        		else
        			z2++;}

        	if(z1==n || (o1==o2 && o1==n) ||o2==n )
        	{
        		System.out.println(-1);return;
        	}
        	int ropts=0,bopts=0;
        	int arr[]=new int[n];
        	for(int i=0;i<n;i++)
        	{
        		if(ro[i]==1 && bo[i]==1)
        		{
        			arr[i]=1;
        		}
        		else if(ro[i]==0 && bo[i]==1)
        		{
        			arr[i]=1;
        		}

        	}
        	int zeros=0;
        	for(int i=0;i<n;i++)
        	{
        		if(arr[i]==1 && bo[i]==1)
        			bopts++;
        		if(arr[i]==1 && ro[i]==1)
        			ropts++;
        		if(bo[i]==0 && ro[i]==1)
        			zeros++;
        	}
        	if(ropts>bopts)
        	{
        		System.out.println(1);return;
        	}
        	int diff=bopts-ropts;
			if(zeros==0){
				System.out.println(-1);return;
			}
        	//System.out.println(bopts+"  "+ropts+"  "+diff+"  "+zeros);
        	int max=(int)Math.ceil(diff/(zeros*1.0));
        	if(zeros>diff)
        		max=1;
        	else if(diff%zeros==0)
				max=max+1;
        	System.out.println(max);

		}

    }

//*********************END        HERE       EVERYTHING*******************************

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public void readIntArrays(int[]... arrays) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++) {
                    arrays[j][i] = readInt();
                }
            }
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

}

import java.io.*;
import java.util.*;
public class Pa{
	public static void main(String[] args) throws IOException{
		FastReader sc = new FastReader();
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out),"ASCII"),512);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i=0;i<n;i++) a[i] = sc.nextInt();
		for(int i=0;i<n;i++) b[i] = sc.nextInt();
		int counta = 0;
		int countb = 0;
		for(int i=0;i<n;i++){
			if(a[i] == 0 && b[i] == 1) countb++;
			else if(a[i] == 1 && b[i] == 0) counta++;
		}
		if(counta == 0) out.write(-1 + "");
		else if(counta > countb) out.write(1 + "");
		else{
			int op = 0;
			if(countb%counta == 0) op = 1 + (countb/counta);
			else op = (int)Math.ceil((double)countb/counta);
			out.write(op + "");
		}
		out.flush();
	}
}
class FastReader{
	BufferedReader br;
	StringTokenizer st;
	public FastReader(){
		br = new BufferedReader(new InputStreamReader(System.in));
	}
	String next(){
		while(st == null || !st.hasMoreElements()){
			try{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e){
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}
	int nextInt(){
        return Integer.parseInt(next());
	}
    long nextLong(){
        return Long.parseLong(next());
    }
    double nextDouble(){
        return Double.parseDouble(next());
    }
    String nextLine(){
        String str = "";
        try{
            str = br.readLine();
        }
		catch (IOException e){
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;

public class Main {
    //n problems
    //each robot solves ith problem gets pi score
    //pi  is an integer not less than 1
    //minimize the maximum value of pi
    //If "Robo-Coder Inc." robot cannot outperform the "BionicSolver Industries" robot by any means, print one integer −1.
    //Otherwise, print the minimum possible value of maxi=1npi, if all values of pi are set in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot.
    public static void main(String[] args){
        int n;
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        int[] R = new int[n];
        int[] B = new int[n];
        int onlyR = 0;
        int onlyB = 0;
        for (int i=0;i<n;i++)
            R[i] = input.nextInt();
        for (int i=0;i<n;i++)
            B[i] = input.nextInt();
        for (int i=0;i<n;i++){
            int r = R[i];
            int b = B[i];
            if (r==1){
                if (r==b)
                    continue;
                onlyR++;
            }
            else if (b==1){
                if (r==1)
                    continue;
                onlyB++;
            }
        }
//        System.out.println("Only R "+onlyR);
//        System.out.println("Only B "+onlyB);
        if(onlyR == 0) {
            System.out.println("-1");
            return;
        }
        float div = ((float)onlyB+1)/((float)onlyR);
        System.out.println((int)Math.ceil(div));
    }

}

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;

public class CF625A {
    public static void main(String[] args) throws FileNotFoundException {
        //Scanner scanner = new Scanner(new File("in.txt"));
        Scanner scanner = new Scanner(System.in);
        Solution solution = new Solution();
        while(scanner.hasNext()) {
            var n = Integer.valueOf(scanner.nextLine());
            var r = Arrays.stream(scanner.nextLine().split(" "))
                    .mapToInt(value -> Integer.valueOf(value))
                    .toArray();
            var b = Arrays.stream(scanner.nextLine().split(" "))
                    .mapToInt(value -> Integer.valueOf(value))
                    .toArray();

            System.out.println(solution.result(n, r, b));
         }
    }
}

class Solution {
    public int result(int n, int[] r, int[] b) {
        int result = -1;
        int cr=0, cb=0, subset = 1;
        for (int i=0;i<n;i++) {
            if(b[i]==1 && r[i]==0) cb++;
            if(r[i]==1 && b[i]==0) { subset=0; cr++;}
        }

        if(subset == 1) result = -1;
        else {
            result = (int) Math.ceil((cb+1)/(double)cr);
        }

        return result;
    }
}

//package codes;
import java.io.*;

public class Robot {
	public static void main(String[] args) {
		BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
		int sum1=0,sum2=0;
		try {
			b.readLine();
			String s1[] =b.readLine().split(" ");
			String s2[] =b.readLine().split(" ");
			for(int i=0;i<s1.length;i++)
			{
				int a=Integer.parseInt(s1[i])-Integer.parseInt(s2[i]);
				if(a>0)
				{
					sum1 = sum1+a;
				}
				if(a<0)
				{
					sum2 = sum2+a;
				}
			}
			if(sum1!=0)
			{
				System.out.println(Math.abs(sum2)/sum1+1);
			}
			else
			{
				System.out.println(""+ -1);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}

import java.util.*;

public class Solver {

    public static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        int n = in.nextInt();
        double a = 0;
        double b = 0;
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = in.nextInt();

        }
        for (int i = 0; i < n; i++) {
            y[i] = in.nextInt();

        }
        a = 0;
        b = 0;
        for (int i = 0; i < n; i++) {
            if (y[i] == 1 && x[i] == 0) {
                b++;
            }
        }
        for (int i = 0; i < n; i++) {
            if (x[i] == 1 && y[i] == 0) {
                a++;
            }
        }

        if (a == 0) {
            System.out.println("-1");
        } else {
            double dif = b + 1;
            //System.out.println(dif);
            double ans = Math.ceil(dif / a);
            int xx = (int) ans;
            System.out.println(xx);
        }
    }
}

import java.net.Inet4Address;
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        int n = nextInt();
        int[] a1 = nextArray(n), a2 = nextArray(n);
        if (Arrays.equals(a1,a2)) {
            System.out.println(-1);
            return;
        }
        boolean check = true;
        for (int i = 0; i < n; i++) {
            if (a1[i] != 0) check = false;
        }
        if (check) {
            System.out.println(-1);
            return;
        }
        int z = 0, x = 0;
        for (int i = 0; i < n; i++) {
            if (a1[i] == a2[i]) continue;
            if (a1[i] == 1) {
                z++;
            } else x++;
        }
        if (z > 0)System.out.println((long)Math.ceil((double)(x+1)/z));
        else System.out.println(-1);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

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

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

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

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

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

    }

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

}

import java.io.*;
import java.lang.reflect.Array;
import java.security.acl.LastOwnerException;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    static Long max = (long) (2 * 10E5);
    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    // Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
    // Arrays.stream(br.readLine().split("\\s+")).map(Long::parseLong).toArray(Long[]::new);
    // Integer.parseInt(br.readLine());
    // Long.parseLong(br.readLine());

    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        Integer[] r = Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
        Integer[] b = Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
        int _b = 0;
        int _r = 0;
        for (int i = 0; i < n; i++) {
            if (r[i] == 1) {
                if (b[i] == 0)
                    _r++;
            } else
                _b += b[i];
        }
        if (_b + _r == 0 || _r == 0) {
            System.out.println(-1);
        } else {
            int x = (int) Math.ceil((_b * 1.0) / _r);
            if (_b == x * _r)
                x++;
            System.out.println(x);

        }
    }
}

import java.util.*;
public class ContestOfRobots{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int sameAll = 0;
		int countA = 0;
		int countB = 0;
		for(int i=0;i<n;i++)
		{
			int curr = sc.nextInt();
			if(curr == 1)
				countA++;
			a[i]=curr;
		}
		for(int i=0;i<n;i++)
		{
			int curr = sc.nextInt();
			if(curr == 1)
				countB++;
			b[i]=curr;
		}
		int same = 0;
		for(int i = 0;i<n;i++)
		{
			if(a[i]==b[i]&&a[i]==1)
				same++;
		}
		int nume =countB-same+1;
		int deno = countA-same;
		/*System.out.println(same);
		System.out.println(nume);
		System.out.println(deno);*/
		for(int i = 0;i<n;i++)
		{
			if(a[i]==b[i])
				sameAll++;
		}
		if(sameAll == n||countA==0||countB==n||countA-same==0)
			System.out.println("-1");
		else
		{
		int toBePrinted = (int)Math.ceil((double)nume/(double)deno);
		System.out.println(toBePrinted);
		}
	}
}

import java.util.*;

public class rob
{
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int ca=0,cb=0,cc=0;
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextInt();
		}
		for(int i=0;i<n;i++){
			b[i]=in.nextInt();
		}
		for(int i=0;i<n;i++){
			if(a[i]==1 && b[i]==0){
				ca++;
			}
			else if(a[i]==0 && b[i]==1){
				cb++;
			}
			else if(a[i]==b[i]){
				cc++;
			}
		}
		if(cc==n || (ca==0)){
			System.out.println("-1");
		}
		else if(ca==1){
			int diff=cb+1;
			System.out.println(diff);
		}
		else{
			int ans=(cb/ca)+1;
			System.out.println(ans);
		}
	}
}

import java.util.*;
public class VA9
{
  public static void main(String[] args)
   {
    Scanner s=new Scanner(System.in);

	int n=s.nextInt();
	int a[]=new int[n];
	int b[]=new int[n];
	for(int i=0;i<n;i++){a[i]=s.nextInt();}
	for(int i=0;i<n;i++){b[i]=s.nextInt();}
	int  count=0;
	int cb=0;
	for(int i=0;i<n;i++)
	{
	  if(a[i]==1&&b[i]==0)
	   count++;
	  else if(a[i]==0&&b[i]==1)
	   cb++;
	}
	cb++;
	if(count==0)
	 System.out.println("-1");
	else
	 System.out.println((int)Math.ceil((double)cb/count));

   }
}

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

       for(int i=0;i<t;i++){
           a[i] = scan.nextInt();
       }
       for(int i=0;i<t;i++){
           b[i] = scan.nextInt();
       }
       int aa=0,bb=0;
       for(int i=0;i<t;i++){
           if(a[i]>b[i]){
               aa++;
           }
           if(a[i]<b[i]){
               bb++;
           }
       }
       if(aa==0){
           System.out.println(-1);
       }
       else{
           System.out.println((bb/aa)+1);
       }
   }
}

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

public class Robot {

	public static void main(String[] args) {

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

		final int cases;
		try {
			cases = Integer.parseInt(br.readLine().trim());

			Solver sol = new Solver();
			sol.solve(br.readLine().trim().replaceAll("\\s", ""), br.readLine().trim().replaceAll("\\s", ""), cases);

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

}

class Solver {

	public void solve(String input, String input1, int len) {
		int[][] scores = new int[2][len];
		int greater = 0;
		int firstOne = 0;
		int secondOne = 0;
		int ans;
		for (int i = 0; i < len; i++)
		{
			scores[0][i] = Integer.parseInt(input.substring(i, i+1));
			scores[1][i] = Integer.parseInt(input1.substring(i, i+1));
		}

		for (int k = 0; k < len; k++)
		{
			if (scores[0][k] > scores[1][k])
			{
				greater++;
			}
			if (scores[0][k] == 1)
			{
				firstOne++;
			}
			if (scores[1][k] == 1)
			{
				secondOne++;
			}

		}
		firstOne -= greater;

		if (firstOne < secondOne || greater > 0)
		{
			if (greater > 0)
			{
					ans = ((secondOne - firstOne) / greater) + 1;
			}
			else
			{
				ans = -1;
			}

		}
		else if (firstOne > secondOne)
		{
			ans = 1;
		}
		else
		{
			ans = -1;
		}

		System.out.println(ans);
	}

}

//package com.netease.music.codeforces.round625.div12;

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

/**
 * Created by dezhonger on 2020/2/24
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();

    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                b[i] = in.nextInt();
            }
            int c = 0;
            int d = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] == b[i]) continue;
                if (a[i] == 1) c++;
                else d++;
            }
            if (c == 0) System.out.println(-1);
            else {
                System.out.println(d / c + 1);
            }
        }

    }

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

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

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

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

    }
}

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

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

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

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

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

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

    }
    static class TaskD{

        public void solve(int testNum,InputReader in,PrintWriter out){
          int n = in.nextInt();
          int robot1[] = new int[n];
          int robot2[] = new int[n];
          int count_r1 = 0,count_r2=0;
          for(int i=0;i<n;i++){
              robot1[i] = in.nextInt();
          }
          for(int i=0;i<n;i++){
              robot2[i] = in.nextInt();
          }
          for(int i=0;i<n;i++){
              if(robot1[i]==0 && robot2[i]==1) count_r2++;
              else if(robot2[i]==0 && robot1[i]==1) count_r1++;
          }
          if(count_r1==0) out.println(-1);
          else{
              int l = count_r2/count_r1 +1;
              out.println(l);
          }
          }
    }
}

import java.util.*;
public class A1321 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc= new Scanner(System.in);
		int n;
		n=sc.nextInt();
		int[] a=new int[109];
		int[] b=new int[109];
		int tonga= 0, tongb= 0;
		for(int i=0; i<n; i++) {
			a[i]=sc.nextInt();
		}
		for(int i=0; i<n; i++) {
			b[i]=sc.nextInt();
		}
		for(int j=0; j<n; j++) {
			if(a[j]==1 && b[j]==0) {
				tonga++;
			}
			if(b[j]==1 && a[j]==0) {
				tongb++;
			}
		}

		if((tonga==0 && tongb==0) || (tonga==0 && tongb!=0)) {
			System.out.print(-1);
		}else {
			if(tonga==1 && tongb==0) {
				System.out.print(1);
			}else {
				int res=(tongb/tonga)+1;
				System.out.print(res);
			}
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.math.*;
import java.util.*;
import java.lang.*;

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

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

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

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

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

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

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

    public static void main(String[] args)
    {
        FastReader fs=new FastReader();
        int n=fs.nextInt();
        int[] r=new int[n];
        int[] b=new int[n];
        for(int i=0;i<n;i++){
            r[i]=fs.nextInt();
        }
        for(int j=0;j<n;j++){
            b[j]=fs.nextInt();
        }

        int x=0,y=0;

        for(int i=0;i<n;i++){
            if(r[i] ==1 && b[i] ==0){
                x+=1;
            }
            if(r[i] ==0 && b[i]==1){
                y+=1;
            }
        }
        if(x==0){
            System.out.println(-1);
        }
        else{
            System.out.println((int)Math.ceil((float)(y+1)/x));
        }

    }
    public static int sum(int[] arr){
        int ans=0;
        for(int i=0;i<arr.length;i++){
            ans+=arr[i];
        }
        return ans;
    }
}

import java.util.Scanner;

public class A1 {

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);
		int n = nik.nextInt();
		int a = 0, b = 1;
		int[] a1 = new int[n];
		int[] b1 = new int[n];
		for (int i = 0; i < n; i++) {
			a1[i] = nik.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b1[i] = nik.nextInt();
		}

		for (int i = 0; i < n; i++) {
			if (a1[i] == 1 && b1[i] == 1) {
				continue;
			} else if (a1[i] == 0 && b1[i] == 0) {
				continue;
			} else if (a1[i] == 1) {
				a++;
			} else {
				b++;
			}
		}
		if ( a==0) {
			System.out.println(-1);
		} else {
			int res = b % a == 0 ? b / a : b / a + 1;
			System.out.println(res);
		}
	}

}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
    public static int fun(int n,int[] a,int[] b)
    {

        int r=0;
        int t=0;
        int bi=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==1 && b[i]==1)
                t++;
            else if(a[i]==1 && b[i]==0)
                r++;
            else if(b[i]==1 && a[i]==0)
                bi++;
        }
        /*System.out.println("t="+ t);
        System.out.println("r="+ r);
        System.out.println("bi="+ bi);*/
        if(r==0)
            return -1;
        int x=(bi/r)+1;
        return x;
    }
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		int i=0;
		int y=n;
		while(y-->0)
		{
		    a[i++]=input.nextInt();
		}
		i=0;
		y=n;
		while(y-->0)
		{
		    b[i++]=input.nextInt();
		}
		System.out.println(fun(n,a,b));
		input.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskA {
        public static void solve(int testNumber, FastReader in, PrintWriter out) {
            int n=in.nextInt();

            int[] r=in.readIntArray(n);
            int[] b=in.readIntArray(n);
            int x=0, y=0;
            for(int i=0;i<n;++i){
                if(r[i]==1 && b[i]==0) x++;
                else if(r[i]==0 && b[i]==1) y++;
            }
            if(x==0) out.print(-1);
            else out.print((int)Math.ceil(((double)y+1)/x));
        }
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

    }
}

import java.util.*;
public class Main
{

	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    int a[]=new int[n];
	    int b[]=new int[n];
	    int aa=0,bb=0;
	   for(int i=0;i<n;i++)
	   {
	       a[i]=sc.nextInt();
	   }

	   for(int i=0;i<n;i++)
	   {
	       b[i]=sc.nextInt();
	   }
	   for(int i=0;i<n;i++)
	   {
	      if(a[i]==1 && a[i]!=b[i])
	      {
	          aa++;
	      }
	      if(b[i]==1 && a[i]!=b[i])
	      {
	          bb++;
	      }
	   }
	   if(aa==0){
	       System.out.println(-1);

	   }
	   else{
	   int ans=bb/aa;
	   System.out.println(ans+1);}

	}
}

import java.util.*;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = scan.nextInt();
        }
        int count1 = 0, count2 = 0, k = 0;
        for (int i = 0; i < n; i++) {
            if (b[i] == 1 && a[i] == 0){
                count1++;
            }
            if(b[i] == 1 && a[i] == 1){
                count1++;
                count2++;
            }
            if(b[i] == 0 && a[i] == 1){
                k++;
            }
        }
        boolean f = true;
        for (int i = 0; i < n; i++) {
            if (b[i] == a[i]) {
                continue;
            }else{
                f = false;
                break;
            }
        }
        if (!f)
            if (k != 0) {System.out.print(((count1 - count2)/k)+1);}
            else{System.out.print("-1");}
        else System.out.print("-1");
    }
}

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

          for(int i=0;i<n;i++)
              a[i]=sc.nextInt();
          for(int i=0;i<n;i++)
              b[i]=sc.nextInt();

          int as=0,bs=0,ans;
          boolean flag=true;

          for(int i=0;i<n;i++){
              if(a[i]==1 && b[i]==0)
                  as++;
              else if(a[i]==0 && b[i]==1)
                  bs++;
          }

          if(as>bs)
              System.out.println(1);
          else if(as==0)
              System.out.println(-1);
          else{
              ans=(int)Math.floor(bs/as)+1;
              System.out.println(ans);
          }

    }
}

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

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

        int n = in.nextInt();
        int[] arr = new int[n];
        int[] brr = new int[n];

        int a = 0;
        int b = 0;

        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }

        for (int i = 0; i < n; i++) {
            brr[i] = in.nextInt();
        }

        for (int i = 0; i < n; i++) {
            if(arr[i] == 1 && brr[i] == 0)
                a++;

            if(brr[i] == 1 && arr[i] == 0)
                b++;
        }

        if(a == 0)
            out.println(-1);
        else
            out.println(b/a + 1);

        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MyCode {

	public static void main(String[] args) throws IOException
	{
		int i,n,x;
		List<Integer> list1 = new ArrayList<Integer>();
		List<Integer> list2 = new ArrayList<Integer>();
		list1.clear();
		list2.clear();
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
	    n = Integer.parseInt(s[0]);
	    String s2[] = br.readLine().split(" ");
	    int count1=0;
	    int count2=0;
	    for(String str: s2)
	    {
	    	x = Integer.parseInt(str);
	    	if(x==1)count1++;
	    	list1.add(x);
	    }
	    String s3[] = br.readLine().split(" ");
	    for(String str: s3)
	    {
	    	x = Integer.parseInt(str);
	    	if(x==1)count2++;
	    	list2.add(x);
	    }
	    int ans=-1;
	    if(count1>count2)
	    {
	    	ans=1;
	    	System.out.println(ans);
	    }
	    else if(count1==count2 && count1==n || count1==0)
	    {
	    	System.out.println("-1");
	    }
	    else
	    {
	    	int u=0;
	    	int v=0;
	    	for(i=0;i<n;i++)
	    	{
	    		if(list1.get(i)==1 && list2.get(i)==0)
	    		{
	    			u++;
	    		}
	    		if(list1.get(i)==0 && list2.get(i)==1)
	    		{
	    			v++;
	    		}
	    	}
	    	if(u!=0)
	    	{
	    		ans = (v/u)+1;
	    	}
	    	System.out.println(ans);
	    }
	}

}

import java.util.*;
public class solution{
    static int check(int n, int a[],int b[],int m[])
    {
        int aa=0,bb=0;
        for(int i=0;i<n;i++)
        {
            aa+=(a[i]*m[i]);
        }
        for(int i=0;i<n;i++)
        {
            bb+=(b[i]*m[i]);
        }

        if(aa>bb)
            return 1;
        else
            return -1;

    }
    static int getanswer(int n,int a[],int b[])
    {
        int m[]=new int[n];
        for(int i=0;i<n;i++)
            m[i]=1;

        int flag=-1,flag1=-1;

		flag=check(n,a,b,m);
        while(flag<0){
        for(int i=0;i<n;i++)
        {
         if(a[i]==1&&b[i]==0)
         {
            flag1++;
          m[i]++;
         }
        }
        if(flag1<0)
            return -1;

        flag=check(n,a,b,m);

        }

        Arrays.sort(m);

        return m[n-1];
    }

    public static void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int a[]=new int[n],b[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=s.nextInt();
        }
        for(int i=0;i<n;i++)
        {
            b[i]=s.nextInt();
        }

        int ans=getanswer(n,a,b);
		System.out.println(ans);
    }
}

import java.util.Scanner;
public class mezo{
public static void main(String[] args) {
	Scanner obj = new Scanner(System.in);
	int num = obj.nextInt();
	int[] robo = new int[num];
	int[] bot = new int[num];
	for(int i=0;i<num;i++) {
	    robo[i] = obj.nextInt();
	}
	for(int i=0;i<num;i++) {
	    bot[i] = obj.nextInt();
	}
	int countr=0,countb=0,counte=0;
	for(int i=0;i<num;i++) {
		if(robo[i] > bot[i]) {
			countr++;
		}
		else if(robo[i] < bot[i]) {
			countb++;
		}
		else {
			counte++;
		}
	}
	if(countr>0 && countb>0) {
	if(counte==num) {
		System.out.println(-1);
	}
	else{
		int z = (countb/countr) + 1;
		System.out.println(z);
	}
	}
	else if(countb==0 && countr>0) {
		System.out.println(1);
	}
	else {
		System.out.println(-1);
	}
}
}

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

public class Main {

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

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

		int n = Integer.parseInt(in.readLine());

		int[] r = new int[n];
		StringTokenizer st = new StringTokenizer(in.readLine());
		for(int i = 0; i < n; i++) {
			r[i] = Integer.parseInt(st.nextToken());
		}

		int[] b = new int[n];
		st = new StringTokenizer(in.readLine());
		for(int i = 0; i < n; i++) {
			b[i] = Integer.parseInt(st.nextToken());
		}

		int rc = 0;
		int bc = 0;
		for(int i = 0; i < n; i++) {
			if(r[i] == 1 && b[i] == 0) {
				rc++;
			}

 			if(b[i] == 1 && r[i] == 0) {
 				bc++;
 			}
		}

		if(rc == 0) System.out.println(-1);
		else if(rc == bc) System.out.println(2);
		else System.out.println((bc / rc) + 1);
	}
}

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

public class A {

	static Scanner sc = new Scanner(System.in);
	static InputStreamReader stream = new InputStreamReader(System.in);
	static BufferedReader br = new BufferedReader(stream);

	public static void main(String[] args) throws IOException{
		int n= readInt();
		int[] a = readArrayline(n);
		int[] b = readArrayline(n);
		int win = 0, loss=0,draw=0, none=0;
		for(int i=0 ; i<n ; i++) {
			if(a[i]==1 && b[i]==0) {
				win ++;
			}else if(a[i]==1 && b[i]==1) {
				draw++;
			}else if(b[i]==1 && a[i]==0) {
				loss++;
			}else {
				none++;
			}
		}
		if(win==0) System.out.println(-1);
		else {
			int req = loss+1;
			if(win>=req) System.out.println(1);
			else {
				System.out.println((req+win-1)/win);
			}
		}
	}

	//BufferedReader Input functions
		public static int readInt() throws IOException{
			return (Integer.parseInt(br.readLine()));
		}

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

		public static int[] readArrayline(int n) throws IOException{
			int[] a = new int[n];
			String[] s = br.readLine().split(" ");
			for(int i=0 ; i<n ; i++) {
				a[i]= Integer.parseInt(s[i]);
			}
			return a;
		}

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package mar_contests;

import java.io.*;
import java.util.*;
public class A1321
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=sc.nextInt();
        }
        int f1=0,f2=0;
        for(int i=0;i<n;i++)
        {
            int x=sc.nextInt();
            if(x==0 && a[i]==1)
                f1++;
            else if(x==1 && a[i]==0)
                f2++;
        }
        if(f1==0)
        {
            System.out.println(-1);
            return;
        }
        if(f1>f2)
            System.out.println(1);
        else
        {
            int base=1;
            System.out.println(base+(f2/f1));
        }

    }

}

//package com.company;

import java.util.Scanner;

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

        int aWins = 0;
        int bWins = 0;

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            if((a[i] == 1) && (b[i] == 0)){
                ++aWins;
            }else if((a[i] == 0) && (b[i] == 1)){
                ++bWins;
            }
        }

        if((aWins == 0 ) || (aWins == 0 && bWins == 0)){
            System.out.println(-1);
        }else{
            int x;
            for ( x = 1; x <= n; x++) {
                if(aWins*x > bWins*1)
                    break;
            }
            System.out.println(x);
        }

    }
}

/*	/ ﾌﾌ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム
	/ )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  Y
	(⠀⠀| ( ͡° ͜ʖ ͡°）⠀⌒(⠀ ノ
	(⠀ ﾉ⌒ Y ⌒ヽ-く __／
	| _⠀｡ノ| ノ｡ |/
	(⠀ー '_人`ー ﾉ
	⠀|\ ￣ _人'彡ﾉ
	⠀ )\⠀⠀ ｡⠀⠀ /
	⠀⠀(\⠀ #⠀ /
	⠀/⠀⠀⠀/ὣ====================D-
	/⠀⠀⠀/⠀ \ \⠀⠀\
	( (⠀)⠀⠀⠀⠀ ) ).⠀)
	(⠀⠀)⠀⠀⠀⠀⠀( | /
	|⠀ /⠀⠀⠀⠀⠀⠀ | /
	[_] ⠀⠀⠀⠀⠀[___]                     */
// Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
	//Fast IO class
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
        public FastReader() {
        	boolean env=System.getProperty("ONLINE_JUDGE") != null;
        	if(!env) {
        		try {
					br=new BufferedReader(new FileReader("src\\input.txt"));
				} catch (FileNotFoundException e) {
					e.printStackTrace();
				}
        	}
        	else br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    static long MOD=1000000000+7;
    //Euclidean Algorithm
    static long gcd(long A,long B){
    	return (B==0)?A:gcd(B,A%B);
    }
    //Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
    //Modular Inverse
    static long inverse(long x) {
    	return fastExpo(x,MOD-2);
    }
    //Prime Number Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i*i<=n;i+=6) if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
    //Reverse an array
    static void reverse(int arr[],int l,int r){
    	while(l<r) {
    		int tmp=arr[l];
    		arr[l++]=arr[r];
    		arr[r--]=tmp;
    	}
    }
    //Print array
    static void print1d(int arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(long arr[][]) {
    	for(long a[]: arr) out.println(Arrays.toString(a));
    }
    // Pair
    static class pair{
    	int x,y;
    	pair(int a,int b){
    		this.x=a;
    		this.y=b;
    	}
    	public boolean equals(Object obj) {
    		if(obj == null || obj.getClass()!= this.getClass()) return false;
            pair p = (pair) obj;
            return (this.x==p.x && this.y==p.y);
        }
    	public int hashCode() {
            return Objects.hash(x,y);
        }
    }
    static FastReader sc=new FastReader();
    static PrintWriter out=new PrintWriter(System.out);
    //Main function(The main code starts from here)
    public static void main (String[] args) throws java.lang.Exception {
    	int test;
    	test=1;
    	//test=sc.nextInt();
    	while(test-->0){
    		int n=sc.nextInt();
    		int a[]=new int[n],b[]=new int[n];
    		for(int i=0;i<n;i++) a[i]=sc.nextInt();
    		for(int i=0;i<n;i++) b[i]=sc.nextInt();
    		int ans=0,i=0;
    		for(i=1;i<=100;i++) {
    			ans=0;
    			for(int j=0;j<n;j++) {
    				if(a[j]==1 && b[j]==0) ans+=i;
    				else if(a[j]==0 && b[j]==1) ans-=1;
    			}
    			if(ans>0) break;
    		}
    		if(ans<=0) out.println(-1);
    		else out.println(i);
    	}
        out.flush();
        out.close();
    }
}

import java.io.IOException;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		double x=0,y=0;
		for (int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for (int i=0;i<n;i++){
			b[i]=sc.nextInt();
		}
		for (int i=0;i<n;i++){
			if (a[i]==1 && b[i]==0)
				x++;
			else if (a[i]==0 && b[i]==1)
				y++;
		}
		if (x==0)
			System.out.println(-1);
		else {
			double ans = Math.ceil((y+1)/x);
			System.out.println((int)ans);
		}
	}
}

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

public class codeforces_1321A {
	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() {
			while(st==null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());

				}
				catch(IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
	public static void main(String[] args) {
		FastReader ob = new FastReader();
		int n = ob.nextInt();
		int a1[] = new int[n];
		int a2 []= new int[n];
		for (int i = 0; i < a2.length; i++) {
			a1[i]=ob.nextInt();
		}
		int count1=0,count0=0;
		for (int i = 0; i < a2.length; i++) {
			a2[i]=ob.nextInt();
			if(a1[i]==0 && a2[i]==1) {
				count0++;
			}
			if(a1[i]==1 && a2[i]==0) {
				count1++;
			}
		}
		if(count1==0) {
			System.out.println(-1);
		}
		else {
			//System.out.println(count0+" "+count1);
			System.out.println((count0/count1)+1);
		}

	}

}

import java.util.*;

public class ProblemA625 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] r = new int[n], b = new int[n];
		for (int i = 0; i < n; i++) {
			r[i] = scan.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = scan.nextInt();

		}
		boolean same = true;
		int adiff = 0, bdiff = 0;
		for (int i = 0; i < n; i++) {
			if (r[i] != b[i]) {
				same = false;
			}
			if (r[i] == 1 && b[i] == 0)
				adiff++;
			if (r[i] == 0 && b[i] == 1)
				bdiff++;
		}
		if (same || adiff == 0)
			System.out.println("-1");
		else {
			int[] scores = new int[n];
			int sum1 = 0, sum2 = 0;
			for (int i = 0; i < n; i++) {
				scores[i] = 1;
				if (r[i] == 1)
					sum1 += scores[i];
				if (b[i] == 1)
					sum2 += scores[i];
			}
			int diff = sum2 - sum1;
			if (diff < 0) {
				System.out.println(("1"));
			} else {
				diff++;
				int res = (int) Math.ceil((double) diff / (double) adiff);
				System.out.println(res + 1);
			}
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class AContestForRobots {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int n = s.nextInt();
            int[] arr = s.nextIntArray(n);
            int[] brr = s.nextIntArray(n);

            int more = 0;
            int less = 0;
            for (int i = 0; i < n; i++) {
                if (arr[i] == 1 && brr[i] == 0) {
                    more++;
                } else if (arr[i] == 0 && brr[i] == 1) {
                    less++;
                }
            }
//        less = 1;
//        more = 99;

            if (more == 0) {
                out.println(-1);
                return;
            }

            if (less < more) {
                out.println(1);
                return;
            }

            less++;
            out.println((int) Math.ceil((less * 1.0) / more));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

//package com.satyam.codeforces.distributer;

import java.util.*;

public class RobotsContest {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int coder[] = new int[n];
		int bionic[] = new int[n];
		for (int i = 0; i < n; i++) {
			coder[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			bionic[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			coder[i] -= bionic[i];
		}
		int winCoder = 0, winBionic = 0;
		for (int i = 0; i < n; i++) {
			if (coder[i] > 0) {
				winCoder++;
			} else if (coder[i] < 0) {
				winBionic++;
			}
		}
		if (winCoder == 0) {
			System.out.println("-1");
		} else {
			System.out.println(winBionic / winCoder + 1);
		}

	}
}

import java.util.Scanner;

public class robo {
    public static void main(String[] args) {
        Scanner in= new Scanner(System.in);
        int c=0;
        int s1=0,s2=0;
        int n=in.nextInt();
        int robo1[]=new int[n];
        int robo2[]=new int[n];
        for(int i=0;i<n;i++){
            robo1[i]=in.nextInt();        }
        for(int i=0;i<n;i++){
            robo2[i]=in.nextInt();

        }
        for(int i=0;i<n;i++){
            if(robo1[i]==robo2[i]){}
            else if(robo1[i]==0&&robo2[i]==1)
                s2++;
            else
                s1++;

        }

        if(s1==0)
            System.out.println(-1);
        else
            System.out.println(s2/s1+1);

    }
}

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

        public class Main {
            static FastScanner in;
            static PrintWriter out;
            public static void main(String[] args) throws IOException {
                in = new FastScanner(System.in);
                out = new PrintWriter(System.out);
                int n = in.nextInt();

                ArrayList<Integer> robc = new ArrayList<Integer>(n);
                ArrayList<Integer> bion = new ArrayList<Integer>(n);

               for (int i = 0; i < n; ++i){
                    int r = in.nextInt();
                    robc.add(i, r);
               }

               for (int i = 0; i < n; ++i){
                    int b = in.nextInt();
                    bion.add(i, b);
               }
     		   int bionic = 0;
     		   int robcod = 0;

               for (int i = 0; i < n; ++i){
                    if (bion.get(i) == 1 && robc.get(i) == 0){
                    	bionic++;
                    } else if (bion.get(i) == 0 && robc.get(i) == 1) {
                    	robcod++;
                	}
               }
               int ans = -1;
               int r = -1;
               if (robcod != 0)
                 r = (bionic + robcod - 1) / robcod;

               if (robcod == 0){
               		ans = -1;
               } else if (bionic == 0 || bionic < robcod){
               		ans = 1;
               } else if (bionic > robcod){
               		ans = r;
               		if (bionic % robcod == 0){
               			ans++;
               		}
               } else if (bionic == robcod){
               		ans = 2;
               }

               out.println(ans);
               out.close();
            }

            public static class FastScanner {
                private BufferedReader br;
                private StringTokenizer st;
                public FastScanner(InputStream inputStream){
                    br = new BufferedReader(new InputStreamReader(inputStream));
                }
                public String nextLine() throws IOException {
                    return br.readLine();
                }

                public String next() {
                    while (st == null || !st.hasMoreTokens()){
                        try {
                            st = new StringTokenizer(br.readLine());
                        } catch (IOException ignored){}
                    }
                    return st.nextToken();
                }
                public int nextInt() {
                    return Integer.parseInt(next());
                }
                public long nextLong() {
                    return Long.parseLong(next());
                }
                 public boolean nextBoolean() {
                    return Boolean.parseBoolean(next());
                }
                public void close() throws IOException {
                     br.close();
                }
            }
        }

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

import static java.lang.Math.*;

public class Main implements Runnable
{
    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

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

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    // if modulo is required set value accordingly
    public static long[][] matrixMultiply2dL(long t[][],long m[][])
    {
        long res[][]= new long[t.length][m[0].length];

        for(int i=0;i<t.length;i++)
        {
            for(int j=0;j<m[0].length;j++)
            {
                res[i][j]=0;
                for(int k=0;k<t[0].length;k++)
                {
                    res[i][j]+=t[i][k]+m[k][j];
                }
            }
        }

        return res;
    }

    static long combination(long n,long r)
    {
        long ans=1;
        for(long i=0;i<r;i++)
        {
            ans=(ans*(n-i))/(i+1);
        }
        return ans;
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Main(),"Main",1<<27).start();
    }
    public void run()
    {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = sc.nextInt();
        Integer a[] = new Integer[n];
        Integer b[] = new Integer[n];
        int a_ones = 0;
        int b_ones = 0;
        for (int i=0; i<n; i++) {
            a[i] = sc.nextInt();
            if(a[i]==1)
                a_ones++;
        }
        for (int i=0; i<n; i++) {
            b[i] = sc.nextInt();
            if(b[i]==1)
                b_ones++;
        }
        for (int i=0; i<n; i++) {
            if(a[i]==b[i] && a[i]==1){
                a_ones--;
                b_ones--;
            }
        }
        if(a_ones==0)
            System.out.println(-1);
        else if(a_ones==b_ones && (a_ones==n || a_ones==0))
            System.out.println(-1);
        else if(a_ones>b_ones)
            System.out.println(1);
        else
            System.out.println(b_ones/a_ones + 1);
        System.out.flush();
        w.close();
    }
}

// number of unique in b / no. of unique in a whole +1

import java.util.*;

// import javax.lang.model.util.ElementScanner6;

// import sun.jvm.hotspot.gc.shared.ContiguousSpace;

//import org.graalvm.compiler.nodes.calc.IntegerDivRemNode;

import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class q3
{
	public static void main (String[] args) throws java.lang.Exception
	{
        // your code goes here
        Scanner sc = new Scanner(System.in);

            int n = Integer.parseInt(sc.next());
            int[] a1 = new int[n];
            int[] a2 = new int[n];
            for(int i=0;i<n;i++)
            {
                a1[i]= Integer.parseInt(sc.next());
            }
            for(int i=0;i<n;i++)
            {
                a2[i]= Integer.parseInt(sc.next());
            }
            int fc=0;
            int sct=0;
            for(int i=0;i<n;i++)
            {
                if(a1[i]==1 && a2[i]==1)
                {
                    continue;
                }
                if(a1[i]==1 && a2[i]==0)
                {
                    fc++;
                }
                if(a1[i]==0 && a2[i]==1)
                {
                    sct++;
                }
            }
            int flag=0;
            if(fc==0 && sct==0)
            {
                System.out.println(-1);
                return;
            }
            else
            {
                for(int i=0;i<1000000;i++)
                {
                    if(i*fc>sct)
                    {
                        System.out.println(i);
                        flag=1;
                        break;
                    }
                }
                if(flag==0)
                {
                    System.out.println(-1);
                }
            }

    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.FileWriter;
import java.io.PrintWriter;
/*
    Solution Created: 15:51:43 01/03/2020
    Custom Competitive programming helper.
*/

public class Main {
	public static void solve(Reader in, Writer out) {
		int n = in.nextInt();
		int[] a = in.na(n);
		int[] b = in.na(n);
		int gain = 0;
		int loss = 0;
		for(int i = 0; i<n; i++) {
			if(a[i]==1&&b[i]==0)gain++;
			if(a[i]==0&&b[i]==1)loss++;
		}
		if(gain==0) out.println(-1);
		else if(gain>loss) out.println(1);
		else if(gain==loss) out.println(2);
		else out.println(loss/gain+1);
	}

	public static void main(String[] args) {
		Reader in = new Reader();
		Writer out = new Writer();
		solve(in, out);
		out.exit();
	}

static class Graph {
	private ArrayList<Integer> con[];
	private boolean[] visited;

	public Graph(int n) {
		con = new ArrayList[n];
		for (int i = 0; i < n; ++i)
			con[i] = new ArrayList();
		visited = new boolean[n];
	}

	public void reset() {
		Arrays.fill(visited, false);
	}

	public void addEdge(int v, int w) {
		con[v].add(w);
	}

	public void dfs(int cur) {
		visited[cur] = true;
		for (Integer v : con[cur]) {
			if (!visited[v]) {
				dfs(v);
			}
		}
	}

	public void bfs(int cur) {
		Queue<Integer> q = new LinkedList<>();
		q.add(cur);
		visited[cur] = true;
		while (!q.isEmpty()) {
			cur = q.poll();
			for (Integer v : con[cur]) {
				if (!visited[v]) {
					visited[v] = true;
					q.add(v);
				}
			}
		}
	}
}

static class Reader {
	static BufferedReader br;
	static StringTokenizer st;
	private int charIdx = 0;
	private String s;

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

	public Reader(String f){
		try {
			this.br = new BufferedReader(new FileReader(f));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

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

	public double[] nd(int n) {
		double[] a = new double[n];
		for (int i = 0; i < n; i++)
			a[i] = nextDouble();
		return a;
	}

	public char nextChar() {
		if (s == null || charIdx >= s.length()) {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			s = st.nextToken();
			charIdx = 0;
		}
		return s.charAt(charIdx++);
	}

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

	public char[] nca() {
		return next().toCharArray();
	}

	public String[] nS(int n) {
		String[] a = new String[n];
		for (int i = 0; i < n; i++)
			a[i] = next();
		return a;
	}

	public int nextInt() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Integer.parseInt(st.nextToken());
	}

	public double nextDouble() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Double.parseDouble(st.nextToken());
	}

	public Long nextLong() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return Long.parseLong(st.nextToken());
	}

	public String next() {
		if (st == null || !st.hasMoreTokens())
			try {
				readLine();
			} catch (Exception e) {
			}
		return st.nextToken();
	}

	public static void readLine() {
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
		}
	}
}
static class Solution {
	public static void solve(Reader in, Writer out) {

	}
}

static class Sort {
	static Random random = new Random();
	public static void sortArray(int[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(long[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(String[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
	public static void sortArray(char[] s) {
        shuffle(s);
        Arrays.sort(s);
    }
    private static void shuffle(int[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            int t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(long[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            long t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(String[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            String t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
    private static void shuffle(char[] s) {
        for (int i = 0; i < s.length; ++i) {
            int j = random.nextInt(i + 1);
            char t = s[i];
            s[i] = s[j];
            s[j] = t;
        }
    }
}

static class Util{
	    static boolean isPrime(int n) {
	        if (n <= 1) return false;
	        if (n <= 3) return true;
	        if (n % 2 == 0 || n % 3 == 0) return false;
	        for (int i = 5; i * i <= n; i = i + 6)
	            if (n % i == 0 || n % (i + 2) == 0)
	            return false;
	        return true;
	    }
		public static int upperBound(long[] a, long v) {
			int l=0, h=a.length-1, ans = -1;
			while(l<h) {
				int mid = (l+h)/2;
				if(a[mid]<=v) {
					ans = mid;
					l = mid+1;
				}else h = mid-1;
			}
			return ans;
		}
		public static int lowerBound(long[] a, long v) {
			int l=0, h=a.length-1, ans = -1;
			while(l<h) {
				int mid = (l+h)/2;
				if(v<=a[mid]) {
					ans = mid;
					h = mid-1;
				}else l = mid-1;
			}
			return ans;
		}
	    public static boolean[] getSieve(int n) {
	        boolean[] isPrime = new boolean[n+1];
	        for (int i = 2; i <= n; i++) isPrime[i] = true;
	        for (int i = 2; i*i <= n; i++) if (isPrime[i])
	                for (int j = i; i*j <= n; j++) isPrime[i*j] = false;
	        return isPrime;
	    }
	    public static int gcd(int a, int b) {
	        if (a == 0)
	            return b;
	        return gcd(b%a, a);
	    }
		public static long modAdd(long a, long b, long mod) {
			return (a%mod+b%mod)%mod;
		}
		public static long modMul(long a, long b, long mod) {
			return ((a%mod)*(b%mod))%mod;
		}
		public static void dbg(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	}

static class Writer {
	private PrintWriter pw;
	public Writer(){
		pw = new PrintWriter(System.out);
	}

	public Writer(String f){
		try {
			pw = new PrintWriter(new FileWriter(f));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void printArray(int[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
	}
	public void printlnArray(int[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
		pw.println();
	}
	public void printArray(long[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
	}
	public void printlnArray(long[] a) {
		for(int i = 0; i<a.length; i++) print(a[i]+" ");
		pw.println();
	}
	public void print(Object o) {
		pw.print(o.toString());
	}
	public void println(Object o) {
		pw.println(o.toString());
	}
	public void println() {
		pw.println();
	}
	public void flush() {
		pw.flush();
	}
	public void exit() {
		pw.close();
	}
}
}

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

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

*******************************************************************************/
import java.util.*;
import java.math.*;

public class Main
{
	public static void main(String[] args) {
	    Scanner sc =new Scanner(System.in);
	    int n=sc.nextInt();
	    int ac=0;
	    int bc=0;
	    int cc=0;
	    int a[] =new int[n];
	    int b[] =new int[n];
	    for(int i=0;i<n;i++){
	        a[i]=sc.nextInt();
	    }
	    for(int i=0;i<n;i++){
	        b[i]=sc.nextInt();
	    }
	  for(int i=0;i<n;i++){
	        if(a[i]>b[i])
	        ac++;
	        if(a[i]<b[i])
	        bc++;
	       if(a[i]==b[i])
	        cc++;

	    }
	    if(ac==bc && cc==n){
	        System.out.println(-1);
	       // System.out.println("a");
	       // System.out.println("ac="+ac+" bc="+bc+" cc="+cc);
	        return;
	    }
	    if(ac==0){
	       System.out.println(-1);
	       //System.out.println("b");
	       //System.out.println("ac="+ac+" bc="+bc+" cc="+cc);
	        return;
	    }
	   //int k =(int) Math.ceil((bc+1)/ac);
	   //System.out.println("ac="+ ac+" bc="+bc);
	   if(ac>bc){

	   System.out.println(1);
	   //	   System.out.println("c");
	   //System.out.println("ac="+ac+" bc="+bc+" cc="+cc);
	   return;
	   }
	   else

	   System.out.println((int)Math.ceil((bc + 1)*1.0/ac));
	   //System.out.println("d");
	   //System.out.println("ac="+ac+" bc="+bc+" cc="+cc);

	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class AContestForRobots {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int n = c.readInt();
            int a = 0, b = 0;
            int x[] = c.readIntArray(n);
            int y[] = c.readIntArray(n);
            int as = 0;
            for (int i = 0; i < n; i++) {
                if (x[i] == 1 && y[i] != 1) {
                    a++;
                }
                if (y[i] == 1 && x[i] != 1) {
                    b++;
                }
            }
            if (a == 0) {
                w.printLine(-1);
                return;
            }
            for (int j = 1; j <= 100000; j++) {
                if (a * j > b) {
                    w.printLine(j);
                    return;
                }
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

/**
 * @author : Kshitij
 */
import java.io.*;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] xps){
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int n=in.readInt();
        double first=0,second=0;
        int[] a=new int[n];
        for (int i = 0; i <n ; i++) {
            a[i]=in.readInt();
            if (a[i]==1)
                first++;
        }
        int[] b=new int[n];
        for (int i = 0; i <n ; i++) {
            b[i]=in.readInt();
            if (a[i]==1 && b[i]==1)
                first--;
            else if (b[i]==1)
                second++;
        }
        if (first==0)
            out.println(-1);
        else if (first>second)
            out.println(1);
        else{
            int ans= (int) Math.ceil((second+1)/first);
            out.println(ans);
        }
    }
    private static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    private static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.flush();
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
            writer.flush();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int cnt=0,cnt1=0;
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) {
			b[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				if(a[i]==1)
					cnt++;
				else
					cnt1++;
			}
		}
		//if(cnt!=cnt1) {
			if(cnt>cnt1)
				System.out.println("1");
			else if(cnt==0)
				System.out.println("-1");
			else{
				System.out.println((cnt1/cnt)+1);
			}

	}
}

import java.util.Scanner;

public class AT4 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        int[] a = new int[t];
        int[] b = new int[t];
        int counter = 0;
        int counter1 = 0;
        int counter2 = 0;
        int counter3 = 0;
        for (int i = 0; i < t; i++) {
            a[i] = scan.nextInt();
        }
        for (int i = 0; i < t; i++) {
            b[i] = scan.nextInt();
            if (b[i] == 1 && a[i] == 0)
                counter++;
            if (a[i] == 1 && b[i] == 0) {
                counter1++;
                counter3++;
            }
            if (b[i] == 1 && a[i] == 1) {
                counter2++;
                counter3++;
            }
        }
        if (counter == 0 && counter1 == 0 || counter3 == counter2 || counter1 == 0) {
            System.out.println(-1);
            return;
        }
        System.out.println(counter/counter1+1);
    }
}

import java.util.Scanner;

public class ContestforRobots {

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scan.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = scan.nextInt();
        }
        int c1 = 0;
        int c2 = 0;

        for (int i = 0; i < n; i++) {
            if (a[i] == 1 && b[i] == 0) {
                ++c1;
            } else if (b[i] == 1 && a[i] == 0) {
                ++c2;
            }
        }

        if (c1 == 0) {
            System.out.println("-1");
        } else {
            System.out.println((int) Math.ceil((c2 + 1) / (double) c1));
        }
    }
}

/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

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

public class d {

	 public static void main(String[] args)  {

		 Scanner s=new Scanner(System.in);
		 int n=s.nextInt();
		 int[] arr=new int[n];
		 int[] brr=new int[n];

		 for(int i=0;i<n;i++) {
			 arr[i]=s.nextInt();
		 }
		 for(int i=0;i<n;i++) {
			 brr[i]=s.nextInt();
		 }

		 int count=1;
		 for(int i=0;i<n;i++) {
			 if(brr[i]!=arr[i]&&brr[i]==1) {
				 count++;
			 }
		 }

				 int ans=0;
		 for(int i=0;i<n;i++) {
			 if(arr[i]==1&&arr[i]!=brr[i]) {
				 ans++;
			 }
		 }

        if(ans==0) {
			 System.out.println(-1);
		 }else if(ans>=count) {
			 System.out.println(1);
		 }else  {
			   int g=count/ans;
        if(count%ans!=0) {
        	g++;
        }
        System.out.println(g);

		 }
	 }
}

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

/* Name of the class has to be "Main" only if the class is public*/
public class  robots
{
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

    static class Node {

        long pp;
        long a, b;

        Node(long x, long y) {
            a = x;
            b = y;
            pp = a * b;
        }
    }
    static class Comp implements Comparator<Node> {

        public int compare(Node o1, Node o2) {
            if (o1.pp > o2.pp) {
                return 1;
            } else {
                return -1;
            }
        }
    }
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        //your code starts here
        int n=sc.nextInt();
        int r[]=new int[n];
        int b[]=new int[n];
        for(int i=0;i<n;i++)
        r[i]=sc.nextInt();
        int c_r=0,c_b=0; int ans=-1;
        for(int i=0;i<n;i++)
        {
            b[i]=sc.nextInt();
            if(r[i]==0 && b[i]==1) ++c_b;
            if(r[i]==1 && b[i]==0) ++c_r;
        }
        if((c_b==0 && c_r==0) || (c_r==0)) ans=-1;
        else if(c_r>c_b) ans=1;
        else ans=(int)(c_b/c_r)+1;
        out.println(ans);
        out.close();
    }
}

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

public class Q1 {

    public static void main(String[] args) {

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

        int  N=in.nextInt();
        double f=0,s=0;
        int arr1[]=in.Int_Array(N),arr2[]=in.Int_Array(N);
        for(int i =0;i<N;i++) {
            f+=(arr1[i] == 1  && arr2[i]==0)? 1 : 0;
            s+=(arr2[i] == 1 && arr1[i]==0)? 1 : 0;
        }
        //System.out.println(s+" "+f);
        if((f==s && s==N) || f==0 ){
            out.println(-1);
        }else{
            int ans=1,ff=(int)f;
            for(int i =2;i<160;i++){
                if(ff>s)
                    break;
                ff+=f; ans ++;
            }
            out.println(ans);

           }
        out.close();
    }

//    public static void main(String[] args) {
//
//        InputReader in = new InputReader();
//        PrintWriter out = new PrintWriter(System.out);
//        int t = in.nextInt();
//        while (t-- > 0) {
//
//            int N = in.nextInt(), max = -1;
//            int arr[] = new int[N];
//            for (int i = 0; i < N; i++) {
//                arr[i] = in.nextInt();
//                max = Math.max(max, arr[i]);
//            }
//            if (max == -1) {
//                out.println(0 + " " + 1);
//                continue;
//            }
//            int diff=Integer.MAX_VALUE;
//
//            int l=0,r=(int)1e9;
//            while(l<=r){
//                int m=(r-l+1)/3,d1=0,d2=0,m1=l+m,m2=r-m;
//                for(int i =1;i<N;i++){
//                    int  a =arr[i]==-1?m1:arr[i],b =arr[i-1]==-1?m1:arr[i-1],d=Math.abs(a-b);
//                    d1=Math.max(d1,d);
//                }
//                for(int i =1;i<N;i++){
//                    int  a =arr[i]==-1?m2:arr[i],b =arr[i-1]==-1?m2:arr[i-1],d=Math.abs(a-b);
//                    d2=Math.max(d2,d);
//                }
//                if(d1<=d2){
//                    r=m2-1;
//                    if(d1<diff){
//                       max=m1; diff=d1;}
//                }else{
//                    l=m1+1;
//                    if(d2<diff){
//                       max=m2; diff=d2;}
//                }
//            }
//
//            out.println(diff + " " + max);
//
//        }
//        out.close();
//
//
//    }

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

        public  int[] Int_Array(int s){
            int arr[]=new int[s];
            for(int i =0;i<s;i++)
                arr[i]=nextInt();
            return arr;

        }

        public int[] shuffle(int[] arr) {
            Random r = new Random();
            for (int i = 1, j; i < arr.length; i++) {
                j = r.nextInt(i);
                arr[i] = arr[i] ^ arr[j];
                arr[j] = arr[i] ^ arr[j];
                arr[i] = arr[i] ^ arr[j];
            }
            return arr;
        }

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

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

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

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

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

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

    }

}

//    public static void main(String[] args) {
//
//        InputReader in = new InputReader();
//        PrintWriter out = new PrintWriter(System.out);
//        int t  =in.nextInt();
//
//        while(t-->0){
//            int  N=in.nextInt();
//            int arr[]=new int[N];
//            for(int i=0 ;i<N;i++)
//                arr[i]=in.nextInt();
//
//            ArrayList<Integer> set1=new ArrayList<>(),set2=new ArrayList<>(),set3=new ArrayList<>();
//            double xval=in.nextInt(),x=in.nextInt(),yval=in.nextInt(),y=in.nextInt();
//            long k=in.nextLong();
//            long  ans  =0;
//
//            if(xval<yval){
//                double temp=xval;
//                xval=yval;
//                yval=temp;
//
//                temp=x;
//                x=y;
//                y=temp;
//            }
//            xval=xval/100; yval=yval/100;
//
//            for(int i =0;i<N;i++){
//                if((i+1)%x==0 && (i+1)%y==0)
//                    set1.add(i);
//                else if ((i+1)%x==0 )
//                    set2.add(i);
//                else if((i+1)%y==0)
//                    set3.add(i);
//            }
//            arr=in.shuffle(arr);
//
//            int a =0,b=0,c=0,add=0;
//
//            for(int  i=N-1;i>=0;i--){
//
//                int temp=0;
//
//                if(a==set1.size()  && b==set2.size()  && c==set3.size())
//                    continue;
//                else if (a==set1.size()  && b==set2.size() ){
//                    ans += (yval) * arr[i];
//                    c++;
//                    temp=11;
//                }else if(a==set1.size()){
//                    if (set2.get(b) <set3.get(c)) {
//                        ans += (xval) * arr[i];
//                        b++;
//                    } else {
//                        ans += (yval) * arr[i];
//                        c++;
//                    }
//                }else{
//                    if (set1.get(a) < set2.get(b) && set1.get(a) < set3.get(c)) {
//                        ans += (xval + yval) * arr[i];
//                        a++;
//                    } else if (set2.get(b)<set3.get(c)) {
//                        ans += (xval) * arr[i];
//                        b++;
//                    } else {
//                        ans += (yval) * arr[i];
//                        c--;
//                    }
//                }
//
//
//
//                if(ans>=k){
//                    break;
//                }
//
//            }
//
//            if(ans<k)
//                out.println(-1);
//            else
//                out.println(add);
//
//
//
//        }
//
//        out.close();
//    }

import java.util.*;
import java.io.*;
public class Contest_for_robots {
		static class FastReader{
			BufferedReader br;
			StringTokenizer st;

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

			String next() {
				while(st == null || !st.hasMoreElements()) {
					try {
						st = new StringTokenizer(br.readLine());
					}catch(IOException e) {
						e.printStackTrace();
					}
				}
				return st.nextToken();
			}
			int nextInt() {
				return Integer.parseInt(next());
			}
		}
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int a[]= new int[n];
		int b[]= new int[n];

		double ac = 0;
		double bc = 0;
		boolean flag = false;
		for(int i = 0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i<n; i++) {
			b[i] = sc.nextInt();

		}
		for(int i = 0; i<n; i++) {
			if(a[i]==1 && b[i] == 0) {
				ac++;
			}else if(b[i]==1 && a[i] == 0) {
				bc++;
			}
		}
		if(ac == 0) {
			System.out.println("-1");
		}else {
			System.out.println((int)Math.ceil((bc+1)/ac));
		}
	}

}

import java.util.*;

public class CodeForces1321A{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int countA = 0;
		int countB = 0;
		for(int i = 0;i<n;i++){
			a[i] = input.nextInt();
		}
		for(int j = 0;j<n;j++){
			b[j] = input.nextInt();
		}

		for(int i = 0;i<n;i++){
			if(a[i] == 1 && b[i] == 1){
				continue;
			}
			else if(a[i] == 1){
				countA++;
			}
			else if(b[i] == 1){
				countB++;
			}
		}
		if(countA == 0){
			System.out.println(-1);
		}
		else{
			/*if(countB/countA * countA > countB){
				System.out.println(countB/countA);
			}
			else{*/
				System.out.println(countB/countA + 1);
			//}

		}

	}
}

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

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
            Solution.solve(in, out);
        out.close();
    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
        public int[] readArray(int n)
        {
            int[] arr=new int[n];
            for(int i=0;i<n;i++) arr[i]=nextInt();
            return arr;
        }
    }
}
class Solution
{
    public static void solve(Main.InputReader in, PrintWriter out)
    {
        int n=in.nextInt();
        int[] r=in.readArray(n);
        int[] b=in.readArray(n);
        int count=0;
        int score=0;
        for(int i=0;i<n;i++)
        {
            if(r[i]==0 && b[i]==1)
                score++;
            if(r[i]==1 && b[i]==0)
                count++;
        }
        int ans=0;
        if(count==0)
            ans=-1;
        else
        ans=score/count+1;
        out.println(ans);

    }
}

import java.util.*;
public class codeforces_1321A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int a[] = new int[n];
       // int b[]  = new int[n];
        for(int i  =0;i<n;i++)
        {
            a[i]+=sc.nextInt();
        }
        for(int i  =0;i<n;i++)
        {
            a[i]-=sc.nextInt();
        }

int iwin=0,theywin=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==1)
                iwin++;
            else if(a[i]==-1)
                theywin++;
        }

        if(iwin==0)
            System.out.println("-1");
        else
            System.out.println((theywin/iwin)+1);

    }

}

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

public class A {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        taskA solver = new taskA();
        solver.solve(in, out);
        out.close();
    }

    static class taskA {
        public void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n], b = new int[n];
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            for (int i = 0; i < n; i++) b[i] = in.nextInt();
            int x = 0, y = 0;
            for (int i = 0; i < n; i++){
                if (a[i] < b[i]) y++;
                if (a[i] > b[i]) x++;
            }
            if (x == 0) out.print(-1);
            else {
                out.print(y / x + 1);
            }
        }
    }

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer st;

        public InputReader(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s), 32768);
        }

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

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

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

import java.util.*;
public class Problem1321a {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] robo = new int[n];
        int[] bio = new int[n];
        int greater = 0;
        int smaller = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            robo[i] = a;
        }
        for (int i = 0; i < n; i++) {
            int b = sc.nextInt();
            bio[i] = b;
            if (robo[i] == 1 && b == 0)
                greater++;
            else if (robo[i] == 0 && b == 1)
                smaller++;
        }
        if(greater == 0) {
            System.out.println(-1);
        }
        else {
            System.out.println((greater+smaller)/greater);
        }
    }
}

import java.io.*;
import java.util.*;
public class cf {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        ArrayList<Integer> robocorp = new ArrayList<>();
        ArrayList<Integer> bionic = new ArrayList<>();
        int diffr = 0;
        int diffb = 0;
        int ans = 0;
        for(int i = 0; i < N; i++){
            robocorp.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            bionic.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            if(robocorp.get(i) == 1 && bionic.get(i) == 0){
                diffr++;
            }
            if(robocorp.get(i) == 0 && bionic.get(i) == 1){
                diffb++;
            }
        }
        if(diffr == 0){
            System.out.println(-1);
        }
        else if(diffb == 0){
            System.out.println(1);
        }
        else{
            int sum = diffb;
            sum++;
            ans = sum/diffr;
            while(ans*diffr <= diffb) ans++;
            System.out.println(ans);
        }
    }
}

import java.io.BufferedReader;
import java.io.*;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.math.*;
public class Main
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
   public static void main(String args[])
    {
        FastReader sc =new FastReader();
        //StringBuffer sb=new StringBuffer();
        int t=1;//sc.nextInt();
        while(t-->0)
        {
            double ca=0,cb=0,cc=0;
            int n=sc.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            for(int i=0;i<n;i++)
            a[i]=sc.nextInt();
            for(int i=0;i<n;i++)
            {
            b[i]=sc.nextInt();
            if(a[i]==1 && b[i]==0)
            ca++;
            else if(a[i]==0 && b[i]==1)
            cb++;
            }
            if(ca==0)
            System.out.println(-1);
            else if(ca>cb)
            System.out.println(1);
            else
            {
                if(cb%ca==0)
                System.out.println((int)(cb/ca+1));
                else System.out.println((int)Math.ceil(cb/ca));
            }
        }
            //System.out.println(sb);
    }
}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;

public class CodeForces
{
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

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

        Reader sc = new Reader();

        int n = sc.nextInt();
        int a[] = new int[n];
        int []b = new int[n];
        int x = 0, y = 0;

        for(int i = 0; i < n; ++i) {
            a[i] = sc.nextInt();
        }
        for(int i = 0; i < n; ++i) {
            b[i] = sc.nextInt();
        }

        for(int i = 0; i < n; ++i) {
            if(a[i] == 1 && b[i] == 0)
                x++;
            else if(a[i] == 0 && b[i] == 1)
                y++;
        }
        if(x == 0)
            System.out.println("-1");
        else {
            int p = y / x + 1;
            System.out.println(p);
        }
    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		int arr[] = new int[len];
		int diff = 0;
		int tx = 0;
		int ty = 0;
		for(int i=0; i<len; i++){
		    arr[i] = sc.nextInt();
	        tx += arr[i];
		}

		for(int i=0; i<len; i++){
		    int a = sc.nextInt();
		    ty += a;
		    if(arr[i] > a)diff++;
		}
		if(diff == 0){
		    System.out.println(-1);
		}
		else if(tx > ty){
		    System.out.println(1);
		}
		else if(tx == ty){
		    System.out.println(2);
		}
		else{
		    int h = ty - (tx - diff);
		    System.out.println(h / diff + 1);
		}

	}
}

//SOLVED
import java.util.*;
import java.lang.*;

public class a1321 {

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

        //Input 1
        int n = input.nextInt();

        //Input 2 (robo)
        String [] robo = new String[n];
        for (int i = 0; i<n; i++){
            robo[i] = input.next();
        }

        //Input 3 (bio)
        String [] bio = new String[n];
        for (int i = 0; i<n; i++){
            bio[i] = input.next();
        }

        //output
        int robocount = 0;      //1 count
        int biocount = 0;       //1 count

        for (int i=0; i<n; i++){
            if (robo[i].equals("1") && bio[i].equals("0")){
                robocount++;
            }
            if (bio[i].equals("1") && robo[i].equals("0")){
                biocount++;
            }

        }

        boolean allZero = true;
        boolean congruent = true;

        for (int i=0; i<n;i++){
            if(robo[i].equals("0")){
               allZero = true;
            }
            else{
                allZero = false;
                break;
            }
        }
        for (int i=0; i<n;i++){
            if(robo[i].equals(bio[i])){
               congruent = true;
            }
            else{
                congruent = false;
                break;
            }

        }

        if (allZero ==true | congruent== true | (robocount==0 && biocount>0)){
            System.out.println("-1");
        }

        else{
            int ans = (biocount/robocount)+1;
            System.out.println(ans);
        }

    }

}

/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class A
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         int[] arr2 = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr2[i] = Integer.parseInt(st.nextToken());
         //solve
         int cnt1 = 0;
         int cnt2 = 0;
         for(int i=0; i < N; i++)
         {
            if(arr[i] == 1 && arr2[i] == 0)
               cnt2++;
            if(arr[i] == 0 && arr2[i] == 1)
               cnt1++;
         }
         if(cnt2 == 0)
            System.out.println(-1);
         else
         {
            int res = cnt1/cnt2;
            res++;
            System.out.println(res);
         }
      }
   }

import java.util.Scanner;

public class Main {

    public static int maxPointValue(int n, int[] robotA, int[] robotB) {
        int win = 0;
        int lost = 1;
        boolean allEqual = true;
        for(int i = 0; i < n; i++) {
            if(robotA[i] != robotB[i]) {
                allEqual = false;
                if(robotA[i] == 0 && robotB[i] == 1) {
                    lost++;
                } else {
                    win++;
                }
            }
        }
        int maxPoint = 0;

        if(win == 1) {
            maxPoint = lost;
        } else {
            maxPoint += Math.ceil(lost/(double)win);
        }

        return (allEqual || win ==0)?-1: maxPoint;
    }
    public static void main(String[] args) {

        // reading input
        Scanner input  = new Scanner(System.in);
        int n = input.nextInt();
        int[] RoboCoder = new int[n];
        int[] BionicSolver = new int[n];

        for(int i = 0; i < n; i++) {
            RoboCoder[i] = input.nextInt();
        }

        for(int i = 0; i < n; i++) {
            BionicSolver[i] = input.nextInt();
        }

        System.out.println(maxPointValue(n, RoboCoder, BionicSolver));
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class A625{

	public static void main(String args[]){
		FastReader sc = new FastReader();
		StringBuilder sb=new StringBuilder();
		int t,i,n;
		t=1;
		while(t-->0){
            n=sc.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            int r=0,bio=0;
            for(i=0;i<n;i++)
                a[i]=sc.nextInt();
            for(i=0;i<n;i++){
                b[i]=sc.nextInt();
                if(a[i]==1 && b[i]==0)
                    r++;
                else if(b[i]==1 && a[i]==0)
                    bio++;
            }
            if(r==0){
                sb.append(-1);
                continue;
            }
            if(r>bio){
                sb.append(1);
                continue;
            }
            if(r==bio){
                sb.append(2);
                continue;
            }
            int ans=bio/r+1;
            sb.append(ans);

		}
		//sb.deleteCharAt(sb.length()-1);
		out.println(sb);
	}

	static PrintWriter out;
	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out,true);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

	public static boolean isPrime(int n) {
		if(n<2) return false;
		for(int i=2;i<=(int)Math.sqrt(n);i++) {
			if(n%i==0) return false;
		}
		return true;
	}

	public static void print(int a[],int l,int r){
		int i;
		for(i=l;i<=r;i++)
			out.print(a[i]+" ");
		out.println();
	}

	public static long fastexpo(long x, long y, long p){
		long res=1;
		while(y > 0){
			if((y & 1)==1)
				res= ((res%p)*(x%p))%p;
			y= y >> 1;
			x = ((x%p)*(x%p))%p;
		}
		return res;
	}

	public static boolean[] sieve (int n) {
		boolean primes[]=new boolean[n+1];
		Arrays.fill(primes,true);
		primes[0]=primes[1]=false;
		for(int i=2;i*i<=n;i++){
			if(primes[i]){
				for(int j=i*i;j<=n;j+=i)
					primes[j]=false;
			}
		}
		return primes;
	}

	public static long gcd(long a,long b){
        return (BigInteger.valueOf(a).gcd(BigInteger.valueOf(b))).longValue();
    }

    public static void merge(int a[],int l,int m,int r){
        int n1,n2,i,j,k;
        n1=m-l+1;
        n2=r-m;

        int L[]=new int[n1];
        int R[]=new int[n2];

        for(i=0;i<n1;i++)
            L[i]=a[l+i];
        for(j=0;j<n2;j++)
            R[j]=a[m+1+j];

        i=0;j=0;

        k=l;
        while(i<n1&&j<n2){
            if(L[i]<=R[j]){
                a[k]=L[i];
                i++;
            }
            else{
                a[k]=R[j];
                j++;
            }
            k++;
        }

        while(i<n1){
            a[k]=L[i];
            i++;
            k++;
        }
        while(j<n2){
            a[k]=R[j];
            j++;
            k++;
        }
    }
    public static void sort(int a[],int l,int r){
        int m;
        if(l<r){
            m=(l+r)/2;
            sort(a,l,m);
            sort(a,m+1,r);
            merge(a,l,m,r);
        }
    }
}

import java.util.*;
import java.io.*;
import static java.lang.Integer.min;
public class Main {
    static FastReader in=new FastReader();
    public static void main(String [] args) {
        int n=in.nextInt();
        int a[]=new int[n],b[]=new int[n];
        int A=0,B=0,ans=-1;
        for(int i=0;i<n;i++){a[i]=in.nextInt();
        }
        for(int i=0;i<n;i++){b[i]=in.nextInt();
        }
        for(int i=0;i<n;i++){
            if(a[i]+b[i]==0||a[i]+b[i]==2){}
            else if(a[i]==1){A++;}
            else B++;}
        if(A>0){
        ans=B/A;
        ans++;
            System.out.println(ans);
        return;}
        else System.out.println("-1");
   }
    static int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l) {
            int mid = l + (r - l) / 2;

            if (arr[mid] == x||(arr[mid]<x&&arr[mid+1]>=x))
                return mid;

            if (arr[mid] > x)
                return binarySearch(arr, l, mid - 1, x);

            return binarySearch(arr, mid + 1, r, x);
        }

        return -1;
    }

    static long gcd(long g,long x){
        if(x<1)return g;
        else return gcd(x,g%x);

    }
}
class node implements Comparable<node>{
int f, e;
node(int tt,int ll){
f=tt;e=ll;
}
    @Override
    public int compareTo(node o) {
    return f-o.f;
    }
}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

class Sorting{

 public static int[] bucketSort(int[] array, int bucketCount) {

 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");

 if (array.length <= 1) return array; //trivially sorted

 int high = array[0];

 int low = array[0];

 for (int i = 1; i < array.length; i++) { //find the range of input elements

 if (array[i] > high) high = array[i];

 if (array[i] < low) low = array[i];

 }

 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket

 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];

 for (int i = 0; i < bucketCount; i++) { //initialize buckets

 buckets[i] = new ArrayList();

 }

 for (int i = 0; i < array.length; i++) { //partition the input array

 buckets[(int)((array[i] - low)/interval)].add(array[i]);

 }

 int pointer = 0;

 for (int i = 0; i < buckets.length; i++) {

 Collections.sort(buckets[i]); //mergeSort

 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets

 array[pointer] = buckets[i].get(j);

 pointer++;

 }

}

return array;

}

}

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class contest_for_robots {

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

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) a[i] = file.nextInt();
		for (int i = 0; i < n; i++) b[i] = file.nextInt();
		int cnt = 0;
		int oc = 0;
		for (int i = 0; i < n; i++) {
			cnt += (a[i] == 1 && b[i] == 0) ? 1 : 0;
			oc += (a[i] == 0 && b[i] == 1) ? 1 : 0;
		}
		if (cnt == 0) {
			file.out.println(-1);
		}
		else {
			double d = oc - cnt + 1;
			if (d < 0) file.out.println(1);
			else file.out.println((long) Math.ceil((double) d/cnt) + 1);
		}
		file.out.flush();
		file.out.close();
	}

	public static long mod(long n, long mod) {
		return (n % mod + mod) % mod;
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0L)
			return mod(1L, mod);
		if (p == 1L)
			return mod(n, mod);
		long t = mod(pow(n, p >> 1, mod), mod);
		if (p % 2L == 0L) {
			return mod(t * t, mod);
		}
		t = mod(t * t, mod);
		t = mod(t * n, mod);
		return mod(t, mod);
	}

	public static long pow(long n, long p) {
		return pow(n, p, Long.MAX_VALUE);
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		return gcd(y % x, x);
	}

	public static long lcm(long x, long y) {
		return x / gcd(x, y) * y;
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;
		if (n % 2 == 0 || n % 3 == 0)
			return false;
		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;
		return true;
	}

	public static class Pair<A, B> implements Comparable {
		public A fi;
		public B se;

		public Pair(A fi, B se) {
			this.fi = fi;
			this.se = se;
		}

		@Override
		public boolean equals(Object o) {
			if (this == o)
				return true;
			if (o == null || getClass() != o.getClass())
				return false;
			Pair<?, ?> p = (Pair<?, ?>) o;
			if (!fi.equals(p.fi))
				return false;
			return se.equals(p.se);
		}

		@Override
		public int hashCode() {
			return 31 * fi.hashCode() + se.hashCode();
		}

		@Override
		public String toString() {
			return fi.toString() + " " + se.toString();
		}

		public static <A, B> Pair<A, B> of(A a, B b) {
			return new Pair<A, B>(a, b);
		}

		public int compareTo(Object o) {
			Pair<?, ?> p = (Pair<?, ?>) o;
			if (fi.equals(p.fi))
				return ((Comparable) se).compareTo(p.se);
			return ((Comparable) fi).compareTo(p.fi);
		}
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;
		PrintWriter out;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}

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

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

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

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

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

		void print(Object o) {
			out.print(o);
		}

		void println(Object o) {
			out.println(o);
		}

		void printf(String s, Object... o) {
			out.printf(s, o);
		}
	}
}

import java.util.*;
public class P1{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		for (int i=0;i<n;++i) {
			a[i]=sc.nextInt();
		}
		for (int i=0;i<n;++i) {
			b[i]=sc.nextInt();
		}
		int ans=0,c1=0,c2=0;
		for (int i=0;i<n;++i) {
			if(a[i]==0 && b[i]==1){++c1;}
			else if(a[i]==1 && b[i]==0){++c2;}
		}
		if (c1==0 && c2==0) {
			System.out.println("-1");
		}
		else if (c2>c1) {
			System.out.println("1");
		}
		else if(c2==0){
			System.out.println("-1");
		}
		else{
			ans=c1/c2+1;
			System.out.println(ans);
		}
	}
}

import java.util.Scanner;
public class Variable {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n,m,i=0,j=0,ans=0,k=0,f=0;
        n = input.nextInt();
        int[] ara=new int[n],arr=new int[n];
        for(i=0;i<n;i++){
            ara[i]=input.nextInt();
        }
        for(i=0;i<n;i++){
            arr[i]=input.nextInt();
        }
        for(i=0;i<n;i++){
            if(ara[i]==0 && arr[i]==1){
                j++;
            }
            else if(ara[i]==1 && arr[i]==0){
                k++;
                f=1;
            }
        }
        if(j>=0 && k>0){
            ans = j/k;
            if(j%k!=0)ans++;
        }
        if(ans*k<=j && f==1)ans++;
        if(ans==0)ans=-1;
        System.out.println(ans);

    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;

/**
 * @author Mubtasim Shahriar
 */

public class ConRo {

	public static void main(String[] args) {

		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader sc = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Solver solver = new Solver();
//		int t = sc.nextInt();
		int t = 1;
		while(t--!=0) {
			solver.solve(sc, out);
		}
		out.close();

	}

	static class Solver {
		public void solve(InputReader sc, PrintWriter out) {
			int n = sc.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			a = sc.nextIntArray(n);
			b = sc.nextIntArray(n);
			int cnta = 0;
			int cntb = 0;
			int dif = 0;
			for(int i = 0; i < n; i++) {
				if(a[i]==1) cnta++;
				if(b[i]==1) cntb++;
				if(a[i]==1 && b[i]==0) dif++;
			}
			if(dif==0) {
				if(cnta>cntb) {
					out.println(1);
				} else {
					out.println(-1);
				}
			} else {
				if(cnta<=cntb) {
					int need = cntb-cnta+1+dif;
					int max = (need/dif);
					if(need%dif!=0) max++;
					out.println(max);
				} else {
					out.println(1);
				}
			}
		}
	}

	static class InputReader {
		private boolean finished = false;

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1) {
				return -1;
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				if (Character.isValidCodePoint(c)) {
					res.appendCodePoint(c);
				}
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null) {
				return filter.isSpaceChar(c);
			}
			return isWhitespace(c);
		}

		public static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private String readLine0() {
			StringBuilder buf = new StringBuilder();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r') {
					buf.appendCodePoint(c);
				}
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0) {
				s = readLine0();
			}
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines) {
				return readLine();
			} else {
				return readLine0();
			}
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(nextString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char nextCharacter() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			return (char) c;
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E') {
					return res * Math.pow(10, nextInt());
				}
				if (c < '0' || c > '9') {
					throw new InputMismatchException();
				}
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E') {
						return res * Math.pow(10, nextInt());
					}
					if (c < '0' || c > '9') {
						throw new InputMismatchException();
					}
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public boolean isExhausted() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1) {
				read();
			}
			return value == -1;
		}

		public String next() {
			return nextString();
		}

		public SpaceCharFilter getFilter() {
			return filter;
		}

		public void setFilter(SpaceCharFilter filter) {
			this.filter = filter;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
		public int[] nextIntArray(int n){
			int[] array=new int[n];
			for(int i=0;i<n;++i)array[i]=nextInt();
			return array;
		}
		public int[] nextSortedIntArray(int n){
			int array[]=nextIntArray(n);
			Arrays.sort(array);
			return array;
		}
		public int[] nextSumIntArray(int n){
			int[] array=new int[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextLongArray(int n){
			long[] array=new long[n];
			for(int i=0;i<n;++i)array[i]=nextLong();
			return array;
		}
		public long[] nextSumLongArray(int n){
			long[] array=new long[n];
			array[0]=nextInt();
			for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
			return array;
		}
		public long[] nextSortedLongArray(int n){
			long array[]=nextLongArray(n);
			Arrays.sort(array);
			return array;
		}
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

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

    static class AContestForRobots {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            int[][] arr = new int[2][n];
            int i = 0;
            for (i = 0; i < 2; i++) {
                for (int j = 0; j < n; j++)
                    arr[i][j] = ni();
            }
            int count1 = 0, count2 = 0;
            boolean ok = false;
            for (i = 0; i < n; i++) {
                if (arr[0][i] != arr[1][i]) {
                    ok = true;
                    count1 += arr[0][i];
                    count2 += arr[1][i];
                }
            }

            if (!ok) {
                pn(-1);
                return;
            }
            if (count1 > count2)
                pn(1);
            else {
                if (count1 == 0) {
                    pn(-1);
                    return;
                }
                pn((count2 + 1 + count1 - 1) / count1);
            }

        }

        int ni() {
            return in.nextInt();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

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

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

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

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {

    public static void main(String [] args) {

    	Scanner input = new Scanner(System.in);

    	//inputs
        int n = input.nextInt();
        int [] r = new int[n];
        int [] b = new int[n];

        int R = 0 , B = 0, count = 0;
        for(int i = 0 ; i < n ; i++){
        	r[i] = input.nextInt();
        	if(r[i] == 1)
        		R++;
        }

        for(int i = 0 ; i < n ; i++){
        	b[i] = input.nextInt();
        	if(b[i] == 1)
        		B++;
        	else if(b[i] == 0 && r[i] == 1)
        		count++;
        }

        if(R > B)
        	System.out.println(1);
        else if(count == 0)
        	System.out.println(-1);
        else if(R == B && count > 0){
        	System.out.println(2);
        }
        else {
        	R -= count;
        	int i = 2;
        	while(count * i + R <= B)
        		i++;
        	System.out.println(i);
        }

    }
}

/*
    https://codeforces.com/problemset/problem/1321/A
 */

import java.util.Scanner;

public class Robots {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] team1 = new int[n];
        int[] team2 = new int[n];
        for (int i = 0; i < n; i++) {
            team1[i] = scanner.nextInt();
        }
        for (int i = 0; i < n; i++) {
            team2[i] = scanner.nextInt();
        }

        int win = 0;
        int lose = 0;

        for (int i = 0; i < n; i++) {
            if (team1[i] > team2[i]) {
                win++;
            } else if (team1[i] < team2[i]) {
                lose++;
            }
        }

        if (win == 0) {
            System.out.println(-1);
        } else {
            int res = lose / win + 1;
            System.out.println(res);
        }
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {

    public static void main(String [] args) {

    	Scanner input = new Scanner(System.in);

    	//inputs
        int n = input.nextInt();
        int [] r = new int[n];

        int R = 0 , B = 0, count = 0;
        for(int i = 0 ; i < n ; i++){
        	r[i] = input.nextInt();
        	if(r[i] == 1)
        		R++;
        }

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

        	if(input.nextInt() == 1)
        		B++;
        	else if(r[i] == 1)
        		count++;
        }

        if(count == 0)
        	System.out.println(-1);
        else if(R > B)
        	System.out.println(1);
        else if(R == B && count > 0){
        	System.out.println(2);
        }
        else {
        	R -= count;
        	int i = 3;
        	while(count * i + R <= B)
        		i++;
        	System.out.println(i);
        }

    }
}

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

public class MAIN {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t =sc.nextInt();
		int t1[],t2[],p=0,q=0;
		t1 = new int[t];
		t2 = new int[t];
		for(int i=0;i<t;i++) {
			t1[i] = sc.nextInt();
		}
		for(int i=0;i<t;i++) {
			t2[i] = sc.nextInt();
		}
		for(int i=0;i<t;i++) {
			if(t1[i]>t2[i]) {
				p++;
			}
			if(t1[i]<t2[i]) {
				q++;
			}
		}
		if(p==0) {
			System.out.println(-1);
		}else if (p>q) {
			System.out.println(1);
		}else {
			System.out.println(q/p+1);
		}

	}

}

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        try{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n>=1 && n<=100){
            int a[]=new int[n];
            int b[]=new int[n];
            for(int i=0;i<n;i++){
                a[i]=sc.nextInt();
                if(a[i]>=0 && a[i]<=1){

                }
                else
                    return;
            }
            for(int i=0;i<n;i++){
                b[i]=sc.nextInt();
                if(b[i]>=0 && b[i]<=1){

                }
                else
                    return;
            }
            int count1=0,count2=0,pair=0,req=0;
            for(int i=0;i<n;i++){
                if(a[i]==1 && b[i]==0){
                    pair++;
                }
                else if(a[i]==1){
                    count1++;
                }
            }
            for(int i=0;i<n;i++){
                if(b[i]==1)
                    count2++;
            }
            req=count2-count1;

            //

            if(req==0 && a==b)
                System.out.print(-1);
            else if(req<0 && count1>count2){
                System.out.print(1);
            }
            else{
                System.out.print(req/pair+1);
            }
            return;

        }
}
catch(Exception e){

}
    }
}

import java.io.OutputStream;
//import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
//import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            Scanner num = new Scanner(System.in);
            int n = num.nextInt();
            int[] r = new int[n];
            int[] b = new int[n];

            for (int i = 0; i < n; i++) {
                r[i] = num.nextInt();
            }
            for (int i = 0; i < n; i++) {
                b[i] = num.nextInt();
            }

            if (SumArray(r, n) == 0 & SumArray(b, n) == 0){
                System.out.println(-1);
                System.exit(0);
            }
           if (SumArray(r, n) == n & SumArray(b, n) == n){
               System.out.println(-1);
               System.exit(0);
           }
           if (SumArray(r, n) > SumArray(b, n)){
                System.out.println(max(r));
                System.exit(0);
            }
            if (SumArray(r, n) == 0){
                System.out.println(max(r));
                System.exit(0);
            }

            if (n == 1 & r[0]<b[0]){
                System.out.println(-1);
                System.exit(0);
            }

            while (SumArray(r, n) <= SumArray(b, n)){
                for (int i = 0; i < n; i++) {
                    if (r[i] >= 1 & b[i] == 0) {
                        r[i]++;
                    }
                }
            }
            System.out.println(max(r));
            }
        }

        public static int max(int[] t) {
            int maximum = t[0];   // start with the first value
            for (int i = 1; i < t.length; i++) {
                if (t[i] > maximum) {
                    maximum = t[i];   // new maximum
                }
            }
            return maximum;
        }//end method max

    public static int SumArray(int[] r, int n){
        int sum = 0;
        for(int i = 0;i < n; i++){
            sum = sum + r[i];
        }
        return sum;

    }
    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.math.*;
import java.util.*;
import java.lang.*;

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

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

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

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

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

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

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

    public static void main(String[] args)
    {
        FastReader fs=new FastReader();
        int n=fs.nextInt();
        int[] r=new int[n];
        int[] b=new int[n];
        for(int i=0;i<n;i++){
            r[i]=fs.nextInt();
        }
        for(int j=0;j<n;j++){
            b[j]=fs.nextInt();
        }

        int x=0,y=0;

        for(int i=0;i<n;i++){
            if(r[i] ==1 && b[i] ==0){
                x+=1;
            }
            if(r[i] ==0 && b[i]==1){
                y+=1;
            }
        }
        if(x==0){
            System.out.println(-1);
        }
        else{
            System.out.println((y+1)/x);
        }

    }
    public static int sum(int[] arr){
        int ans=0;
        for(int i=0;i<arr.length;i++){
            ans+=arr[i];
        }
        return ans;
    }
}

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

public class Main
{

    public static void process()throws IOException
    {
        int n=ni(),r[]=new int[n+1],b[]=new int[n+1];
        for(int i=1;i<=n;i++) r[i]=ni();
        for(int i=1;i<=n;i++) b[i]=ni();

        int cr=0,cb=0;
        for(int i=1;i<=n;i++){
            if(r[i]==b[i])
                continue;
            if(r[i]==1)
                cr++;
            else
                cb++;
        }

        if(cr==cb){
            pn(-1);
            return;
        }

        for(int i=1;i<=n;i++){
            if(cr*i>cb){
                pn(i);
                return;
            }
        }
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

        oj = System.getProperty("ONLINE_JUDGE") != null;
        if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.io.*;
import java.util.Scanner;
public class problem1
{
   public static void main(String args[])
   {
       Scanner in = new Scanner(System.in);
       int n = in.nextInt();
       int a[] = new int[n];
       int b[] = new int[n];
       for(int i=0;i<n;i++)a[i] = in.nextInt();
       for(int i=0;i<n;i++)b[i] = in.nextInt();
       int count1=0,count2 =0;
       for (int i= 0;i<n ;i++ )
       {
           if(a[i] == 1 && b[i]==0)
           count1++;
           else if(a[i]==0 && b[i] ==1)
           count2++;
       }
       if(count1==0 || count2==0)
       System.out.println("-1");
       else
       System.out.println((count2+count1)/count1);
   }
}

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

public class Main {

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

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

		int n = Integer.parseInt(in.readLine());

		int[] r = new int[n];
		StringTokenizer st = new StringTokenizer(in.readLine());
		for(int i = 0; i < n; i++) {
			r[i] = Integer.parseInt(st.nextToken());
		}

		int[] b = new int[n];
		st = new StringTokenizer(in.readLine());
		for(int i = 0; i < n; i++) {
			b[i] = Integer.parseInt(st.nextToken());
		}

		int rc = 0;
		int bc = 0;
		for(int i = 0; i < n; i++) {
			if(r[i] == 1 && b[i] == 0) {
				rc++;
			}

 			if(b[i] == 1 && r[i] == 0) {
 				bc++;
 			}
		}

		if(rc == bc || rc == 0) System.out.println(-1);
		else if(rc > bc) System.out.println(1);
		else System.out.println((int) Math.ceil((double) (bc+1) / rc));
	}
}

import java.io.*;
import java.lang.reflect.Array;
        import java.util.*;

public class codeforces {
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

    public static void main(String args[]) throws IOException
    {
       Reader fast=new Reader();

        int n=fast.nextInt();
        int a[]=new int[n];
        int b[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=fast.nextInt();
        }
        for(int i=0;i<n;i++)
        {
            b[i]=fast.nextInt();
        }
        int f=0;
        int s=0;
        for(int i=0;i<n;i++)
        {
        if(a[i]>b[i]) f++;
        if(b[i]>a[i]) s++;
        if(a[i]==b[i]&&a[i]==1)
        {
            f++;
            s++;
        }
        }
     if((f==s))   System.out.println("-1");
     else
     {
         if(f>s) System.out.println("1");
         else
         {
             if(f==0)
             {
                 System.out.println("-1");
             }
             else
             {
                 int ans=1;
                 while(f<s)
                 {
                     f=f*ans;
                     ans++;

                 }
                 System.out.println(ans);
             }

         }

     }

    }
}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Round625
{
    public static void main(String [] args)
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();

        List<Integer> a = new ArrayList<>();
        for(int i = 0; i < n; i++)
            a.add(input.nextInt());

        List<Integer> b = new ArrayList<>();
        for(int i = 0; i < n; i++)
            b.add(input.nextInt());

        List<Integer> list = new ArrayList<>();
        for(int i = 0, j = 0; i < a.size() && j < b.size(); i++, j++)
        {
            if( a.get(i).equals(1) && b.get(j).equals(0) )
            {
                list.add(a.get(i));
                list.add(b.get(j));
            }
        }

        int zero = 0;
        for(Integer element : list)
            if(element.equals(0))
                zero ++;

        int sum1 = 0;
        for(Integer element : a)
            sum1 += element;

        int sum2 = 0;
        for(Integer element : b)
            sum2 += element;

        if(sum1 == sum2)
            System.out.println(-1);
        else if(list.size() > 2)
        {
            int sum = 0;
            for(Integer element : b)
                sum += element;

            System.out.println(sum / zero + 1);
        }
        else
        {
            int one = 0;
            for(Integer element : b)
                if(element.equals(1))
                    one ++;

            int one2 = 0;
            for(Integer element : a)
                if(element.equals(1))
                    one2 ++;

            System.out.println( ( one - (one2 - 1) ) + 1);
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class AContestForRobots {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] A1 = in.nextIntArray(n);
            int[] A2 = in.nextIntArray(n);
            int v1 = 0;
            int v2 = 0;
            for (int i = 0; i < n; i++) {
                if (A2[i] == 1 && A1[i] == 0) {
                    v1++;
                }
                if (A2[i] == 0 && A1[i] == 1) {
                    v2++;
                }
            }
            if (v2 == 0) {
                out.println(-1);
            } else {
                int ans = v1 / v2;
                if (v1 % v2 == 0) {
                    ans++;
                }
                out.println(Math.max(1, ans));
            }

        }

    }

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

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = nextInt();
            return array;
        }

    }
}

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Reader_ {
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String nextLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int ni() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nl() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nd() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

    public static void main(String[] args) {
        new Thread(null, null, "Rahsut", 1 << 25) {
            public void run() {
                try {
                    Freak();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }

    static long modPow(long x, long p, long m) {
        if (p == 0)
            return 1;
        if (p % 2 == 0)
            return modPow((x * x) % m, p >> 1, m) % m;
        return x * (modPow(x, p - 1, m) % m) % m;
    }

    static long mul(long a, long b, long m) {
        a %= m;
        b %= m;
        return (a * b) % m;
    }

    static long gcd(long a, long b) {
        if (b % a == 0)
            return a;
        return gcd(b % a, a);
    }

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

    public static class Pair implements Comparable<Pair> {
        long x, y;

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

        public int compareTo(Pair o) {
            if (x != o.x)
                return (int) x - (int) o.x;
            return (int) y - (int) o.y;
        }

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

    //global variable
    static Reader sc = new Reader();
    static StringBuilder sb = new StringBuilder();
    static PrintWriter pw = new PrintWriter(System.out, true);
    static int dir1[][] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
    static int dir2[][] = {{1, -1}, {-1, 1}, {1, 1}, {-1, -1}};
    static int dp[][], mod = (int) 1e9 + 7;
    static int arr[], len1, len2, n, q, t, brr[], m, k, size;
    static Pair tree1[], tree2[];
    static void Freak() throws IOException {
        int t = 1;
        while(t-->0) {
            int n = sc.ni();
            int arr[]= new int[n];
            int brr[]= new int[n];
            for(int i =0;i<n;i++)
                arr[i]= sc.ni();
            for(int j =0;j<n;j++)
                brr[j]= sc.ni();
            double x=0,y =0;
            for(int i =0;i<n;i++) {
                if(arr[i]==1 && brr[i]==0)
                    x++;
                if(arr[i]==0 && brr[i]==1)
                    y++;
            }
            if(x==0 || y ==0){
                System.out.println(-1);
                return;
            }
            long ans = (long)ceil(y/x) + ((y%x==0)?1:0);
            System.out.println(ans);

        }
        pw.println(sb);
        pw.flush();
        pw.close();
    }
}

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

     public class Sample implements Runnable
    {

         public  static void solve()
          {

              int n=i();
              int a=0;
              int b=0;
              for(int i=0;i<n;i++)a+=i();
               for(int i=0;i<n;i++)b+=i();
              if(a==b){
                System.out.println("-1");
              } else if(a>b){
                System.out.println("1");
              } else {
                System.out.println(Math.ceil((b+1)/a));
              }
          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
           static class Pair implements Comparator<Pair>{
            String a;
            long b;
            long c;

            Pair(){}
            Pair(String a,long b,long c)
            {
                       this.a=a;
                       this.b=b;
                       this.c=c;
            }
            public int compare(Pair p1,Pair p2)
            {
               if(p1.c==0 && p2.c==0)
               {
                return Long.compare(p1.b,p2.b);
               }
               if(p1.c==0)
               {
                return -1;
               }
               if(p2.c==0)
               {
                return 1;
               }
               else
              return Long.compare(p2.b*p1.c,p1.b*p2.c);

            }

        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

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

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

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

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }

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

       for(int i=0;i<t;i++){
           a[i] = scan.nextInt();
       }
       for(int i=0;i<t;i++){
           b[i] = scan.nextInt();
       }
       int aa=0,bb=0,m=0,zero=0;
       for(int i=0;i<t;i++){
           if(a[i]==1 && b[i]==0){
               aa++;
           }
           if(a[i]==0 && b[i]==1){
               bb++;
           }

           if(a[i]==b[i]){
               m++;
           }
           if(a[i]==0){
               zero++;
           }
       }
       if(m==t || aa==t || zero==t){
           System.out.println(-1);
       }
       if(aa>bb){
           System.out.println(1);
       }
       if(aa<bb && zero!=t){
           int ans=aa,c=1;
           while (aa < bb) {
               aa = ans * c;
               c++;
           }
           System.out.println(c);
       }
   }
}

//package CodeForces;

import java.io.*;
import java.nio.file.Paths;
import java.util.Scanner;

public class Solution {
    private static final boolean onlineJudge = Boolean.parseBoolean(System.getProperty("ONLINE_JUDGE"));

    public static void main(String[] args) throws IOException {
        FileInputStream fileStream = null;
        Scanner scanner = new Scanner(onlineJudge ? System.in : (fileStream = new FileInputStream(Paths.get(System.getProperty("user.dir"), "src/res/input").toString())));

        int n = scanner.nextInt();
        int[] a = readArray(scanner, n);
        int[] b = readArray(scanner, n);
        int resA = 0;
        int resB = 0;
        for (int i = 0; i < n; i++) {
            resA += (a[i] ^ b[i]) & a[i];
            resB+= (a[i] ^ b[i]) & b[i];
        }
        int res = -1;
        if(resA > resB) {
            res = 1;
        }
        if(resB > resA && resA > 0) {
            res = resB / resA + 1;
        }
        System.out.println(res);

        if(fileStream != null) {
            fileStream.close();
        }

        scanner.close();
    }

    private static int[] readArray(Scanner scanner, int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }
        return array;
    }
    private static void printArray(int[] a){
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            System.out.print(i < a.length - 1 ? " " : "\n");
        }
    }
}

import java.util.*;

public class Solution {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int n = sc.nextInt();
    int[] r = new int[n];
    for (int i = 0; i < n; i++) r[i] = sc.nextInt();
    int[] b = new int[n];
    for (int i = 0; i < n; i++) b[i] = sc.nextInt();
    int cnt = 0;
    int rPoints = 0;
    int bPoints = 0;
    for (int i = 0; i < n; i++) {
      if (r[i] > b[i])cnt++;
      rPoints += r[i];
      bPoints += b[i];
    }
    if (rPoints > bPoints) {
      System.out.println(1);
    } else if (cnt == 0) {
      System.out.println(-1);
    } else {
      rPoints-=cnt;
      for (int i = 2; i < 100; i++) {
        if (cnt * i + rPoints > bPoints) {
          System.out.println(i);
          break;
        }
      }
    }
  }
}

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

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

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

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

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

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

    }
    static class TaskD{

        public void solve(int testNum,InputReader in,PrintWriter out){
          int n = in.nextInt();
          int robot1[] = new int[n];
          int robot2[] = new int[n];
          int count_r1 = 0,count_r2=0;
          for(int i=0;i<n;i++){
              robot1[i] = in.nextInt();
          }
          for(int i=0;i<n;i++){
              robot2[i] = in.nextInt();
          }
          for(int i=0;i<n;i++){
              if(robot1[i]==0 && robot2[i]==1) count_r2++;
              else if(robot2[i]==0 && robot1[i]==1) count_r1++;
          }
          out.println(count_r1+" "+count_r2);
          if(count_r1==0) out.println(-1);
          else{
              int l = count_r2/count_r1 +1;
              out.println(l);
          }
          }
    }
}

import java.util.Scanner;

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

		int a = input.nextInt();
		int[] list1 = new int[a];
		int[] list2 = new int[a];

		for (int j = 0; j < a; j++) {
			list1[j] = input.nextInt();
		}
		for (int j = 0; j < a; j++) {
			list2[j] = input.nextInt();
		}

		int out = -1;
		int n1 = 0;
		int n2 = 0;
		for (int i = 0; i < a; i++) {
			if (list1[i] == list2[i])
				;
			else if (list1[i] > list2[i]) {
				n1++;
			} else {
				n2++;
			}
		}

		if (n1 > 0 && n2 > 0)
			out = (n1 + n2) / n1;

		System.out.println(out);

		input.close();
	}
}

import java.util.Scanner;
/*
5
1 1 1 0 0
0 1 1 1 1
 */
public class ContestforRobots {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int prob = sc.nextInt(), countW = 0, countL = 0;
        int[] arrW = new int[prob];
        int[] arrL = new int[prob];

        for(int i = 0; i < prob; i++) {
            arrW[i] = sc.nextInt();
        }

        for(int i = 0; i < prob; i++) {
            arrL[i] = sc.nextInt();
        }

        for(int i = 0; i < prob; i++) {
            if(arrW[i] == 0 && arrL[i] == 1) countL++;
            else if(arrW[i] == 1 && arrL[i] == 0) countW++;
        }

        if(countW == 0) System.out.print(-1);
        else if(countL > countW) System.out.print((countL/ countW) + 1);
        else System.out.print(1);
    }
}

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int a[]=new int [n];
        int b[]=new int [n];
        for(int i=0;i<n;i++)a[i]=scanner.nextInt();
        for(int i=0;i<n;i++)b[i]=scanner.nextInt();
        int s1=0,s2=0,res=1;
        for(int i=0;i<n;i++)
        {
            if(a[i]==0&&b[i]==1)s2++;
            if(a[i]==1&&b[i]==0)s1++;
        }
        int x=s1;
        if(s1==0)res=-1;
        if(s1<=s2) {
            while (s1 <= s2 && s1 != 0) {
                s1 = x * res;
                res++;
            }
            res--;
        }
        System.out.println(res);

    }
}

/**
 * @author : Kshitij
 */
import java.io.*;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] xps){
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        StringBuilder stringBuilder = new StringBuilder();
        int n=in.readInt();
        int[] win=new int[n];
        int[] lose=new int[n];
        for (int i = 0; i <n ; i++) {
            win[i]=in.readInt();
        }
        for (int i = 0; i <n ; i++) {
            lose[i]=in.readInt();
        }
        stringBuilder.append(newSolver(n,win,lose)).append("\n");
        out.println(stringBuilder);
    }

    private static int newSolver(int n, int[] win, int[] lose) {
        int me=0;
        int you=0;
        for (int i = 0; i <n ; i++) {
            int temp1=win[i];
            int temp2=lose[i];
            if (temp1==1 && temp2==0){
                me++;
            }
            if (temp2==1){
                you++;
            }
        }
        if (me>you)
            return 1;
        else{
            if( (you-me==0)||(you-me==n))
                return -1;
            else
                return you-me;
        }
    }

    //    public static int solver(int n, int[] win, int[] lose){
//        int ans=0;
//        int count=0;
//        int no=0;
//        for (int i = 0; i <n ; i++) {
//            int temp1=win[i];
//            int temp2=lose[i];
//            if ((temp1==1&&temp2==1)||(temp1==0&&temp2==1)){
//                ans++;
//            }
//            else if(temp1==1&&temp2==0)
//                count++;
//            else
//                no++;
//        }
//        if (ans==n || count==n ||no==n)
//            return -1;
//        else {
//            if (ans-count!=0)
//                return ans - count;
//            else
//                return -1;
//        }
//    }
    private static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public char readChar(){
            String s=readString();
            if (s.length()>1)
                throw new InputMismatchException();
            else
                return s.charAt(0);
        }

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

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    private static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.flush();
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
            writer.flush();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.util.Scanner;

public class robots {
    public static void main(String[] args) {
        int d=0,t,s,s1,s2,x;
        Scanner scan=new Scanner(System.in);
        t=scan.nextInt();
        while(d<t)
        { s=0;s1=0;s2=0;x=0;
            int n=scan.nextInt();
        int[] a=new int[n];
          int[] b=new int[n];
         for (int i = 0; i < n; i++) {
            a[i]=scan.nextInt();
            s1=s1+a[i];
        }
         for (int i = 0; i < n; i++) {
            b[i]=scan.nextInt();
            s2+=b[i];
        }
         //System.out.println("s1 and s2 "+s1+""+s2);
        for (int i = 0; i < n; i++) {
            if(a[i]==1&&b[i]==0)
            {
            x++;
            }}
            if(s2>s1)
            {
                s=s2-s1;
                s=s/x;
                s+=2;

            } System.out.println(s);
        d++;}}

}

import java.util.Scanner;

public class Round {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] r = new int[n];
		int[] b = new int[n];
		int rScore = 0;
		int bScore = 0;
		for (int i = 0; i < n; i++) {
			r[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
			if (b[i] == 1 && r[i] == 0) {
				bScore++;
			}
			if (b[i] == 0 && r[i] == 1) {
				rScore++;
			}
		}

		if (rScore > bScore) {
			System.out.println(1);
			return;
		}
		if (bScore == rScore) {
			System.out.println(-1);
			return;
		}

		long pMinMax = rScore == 0 ? -1 : bScore / rScore + 1;
		System.out.println(pMinMax);
	}
}

import java.util.Scanner;

public class robat {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][] arr = new int[2][n];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                arr[i][j] = scanner.nextInt();
            }
        }
        int t=0;
        int o=0;
        for (int i = 0; i < n; i++) {
            if (arr[0][i]==1&&arr[1][i]==0){
                o++;
            }
            if (arr[0][i]==0&&arr[1][i]==1){
                t++;
            }
        }

        if (o==0) System.out.println(-1);
        else if (t==0) System.out.println(1);
        else System.out.println((int)Math.ceil((t+1)/o));
    }
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class A {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int n = scan.nextInt();
    	int [] a = scan.readArray(n);
    	int [] b = scan.readArray(n);

    		int bCount = 0, win = 0;

    		for(int i=0; i<n; i++) {
    			if(a[i] == 1 && b[i] == 0) win++;
    			if(b[i] == 1 && a[i] == 0) bCount++;
    		}

    	int ans = -2;
    	if(bCount != 0 && win != 0) ans = bCount/win;
    	System.out.println(ans+1);
    	}

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

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

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

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

    }

}

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

    public class Main {
        public static void main(String[] args) throws IOException {
            FastReader scan = new FastReader();
            //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out")));
            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
            Task solver = new Task();
            //int t = scan.nextInt();
            int t = 1;
            for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
            out.close();
        }
        static class Task {
            public void solve(int testNumber, FastReader sc, PrintWriter pw){
                int n = sc.nextInt();
                int[][] arr= new int[n][2];
                for(int i=0;i<n;i++){
                    arr[i][0]=sc.nextInt();
                }
                int act = 0;
                int bct = 0;
                for(int i=0;i<n;i++){
                    arr[i][1]=sc.nextInt();
                    if(arr[i][0]==1&&arr[i][1]==0){
                        act++;
                    }
                    if(arr[i][0]==0&&arr[i][1]==1){
                        bct++;
                    }
                }
                if(act==0||(act==0&&bct==0)){
                    pw.println(-1);
                }
                else {
                    int ret = bct/act;
                    if(bct%act==0||ret==0){
                        ret++;
                    }
                    pw.println(ret);
                }
            }
        }
        static class tup implements Comparable<tup> {
            int a, b;
            tup() {
            }
            ;

            tup(int a, int b) {
                this.a=a;
                this.b=b;
            }

            @Override
            public int compareTo(tup o2) {
                return 0;
            }
        }
        static void shuffle(long[] a) {
            Random get = new Random();
            for (int i = 0; i < a.length; i++) {
                int r = get.nextInt(a.length);
                long temp = a[i];
                a[i] = a[r];
                a[r] = temp;
            }
        }
        static void shuffle(int[] a) {
            Random get = new Random();
            for (int i = 0; i < a.length; i++) {
                int r = get.nextInt(a.length);
                int temp = a[i];
                a[i] = a[r];
                a[r] = temp;
            }
        }
        static void shuffle(int[] a,int l, int rb) {
            Random get = new Random();
            for (int i = l; i < rb; i++) {
                int r = get.nextInt(a.length);
                int temp = a[i];
                a[i] = a[r];
                a[r] = temp;
            }
        }
        static class FastReader {
            BufferedReader br;
            StringTokenizer st;

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

            public FastReader(String s) throws FileNotFoundException {
                br = new BufferedReader(new FileReader(new File(s)));
            }

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

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

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

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

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

    }

import java.io.*;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.*;

public class Test {
    public static void main(String[] args) throws IOException {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int a[] = new int[n];
            int b[] = new int[n];
            for(int i=0; i<n; i++){
                a[i] = sc.nextInt();
            }
            int one =0;
            for(int i=0; i<n; i++){
                b[i] = sc.nextInt();
                if(b[i]==1)
                    one++;
            }
            int count=0;
            for(int i=0; i<n; i++){
                if(a[i]==1 && b[i]==0)
                    count++;
            }
            int ans = one-count;
            if(count==0)
                System.out.println("-1");
            else
                System.out.println(ans);

    }
}

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

       for(int i=0;i<t;i++){
           a[i] = scan.nextInt();
       }
       for(int i=0;i<t;i++){
           b[i] = scan.nextInt();
       }
       int aa=0,bb=0,m=0,zero=0;
       for(int i=0;i<t;i++){
           if(a[i]==1 && b[i]==0){
               aa++;
           }
           if(a[i]==0 && b[i]==1){
               bb++;
           }

           if(a[i]==b[i]){
               m++;
           }
           if(a[i]==0){
               zero++;
           }
       }
       if(m==t || aa==t || zero==t){
           System.out.println(-1);
       }
       if(aa>bb && aa!=t &&m!=t && zero!=t){
           System.out.println(1);
       }
       if(aa<bb && zero!=t && aa!=t &&m!=t ){
           int ans=aa,c=1;
           while (aa < bb) {
               aa = ans * c;
               c++;
           }
           System.out.println(c);
       }
   }
}

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception {
		Reader.init(System.in);
		int n;
		n=Reader.nextInt();
		int[] a = new int[101];
		int[] b = new int[101];
		for(int i=0;i<n;++i)
			a[i] = Reader.nextInt();
		for(int i=0;i<n;++i)
			b[i] = Reader.nextInt();
		int left = 0,right=0;
		for(int i=0;i<n;++i) {
			if(a[i]==b[i]&&a[i]==1)
				continue;
			if(a[i]==1&&b[i]==0)
				left++;
			else if(a[i]==0&&b[i]==1)
				right++;
		}
		if(left==right || left == 0)
			System.out.println(-1);
		else {
			System.out.println(Math.max(right%left == 0?right/left+1:right/left,1));
		}
	}
}

class Reader {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

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

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

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

	static BigInteger nextBigInteger() throws IOException {
		return new BigInteger(next());
	}

	static BigDecimal nextDecimal() throws IOException {
		return new BigDecimal(next());
	}
}

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;

public class TaskA {

	static Scanner in = new Scanner(System.in);
	static PrintWriter w = new PrintWriter(System.out);

	public static void main(String[] args) {
//		int t = Integer.parseInt(in.nextLine());
//		outer: while (t-- > 0) {
			int n = in.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			for(int i = 0; i<n; i++)
				a[i] = in.nextInt();
			for(int i = 0; i<n; i++)
				b[i] = in.nextInt();
			int check = 0;
			for(int i = 0; i<n; i++) {
				if(a[i]==b[i]) {
					check++;
				}
			}
			if(check == n) {
				w.println(-1);
			}else {
				int aC = 0, bC = 0;
				for(int i = 0; i<n; i++) {
					if(a[i] == 0 && b[i] == 1)
						bC++;
					if(a[i] == 1 && b[i] == 0)
						aC++;
				}
				w.println(bC/aC + 1);
//			}
		}
//		w.flush();
//		w.close();
	}

	private static void shuffleArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			int tmp = arr[i];
			int randomPos = rnd.nextInt(n);
			arr[i] = arr[randomPos];
			arr[randomPos] = tmp;
		}
	}

	private static void shuffleArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			long tmp = arr[i];
			int randomPos = i + rnd.nextInt(n - i);
			arr[i] = arr[randomPos];
			arr[randomPos] = tmp;
		}
	}
}

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

       for(int i=0;i<t;i++){
           a[i] = scan.nextInt();
       }
       for(int i=0;i<t;i++){
           b[i] = scan.nextInt();
       }
       int aa=0,bb=0,m=0,zero=0;
       for(int i=0;i<t;i++){
           if(a[i]==1){
               aa++;
           }
           if(b[i]==1){
               bb++;
           }

           if(a[i]==b[i]){
               m++;
           }
           if(a[i]==0){
               zero++;
           }
       }
       if(m==t || zero==t){
           System.out.println(-1);
       }
       else{
           System.out.println((aa+bb)/2);
       }
   }
}

import java.util.*;
public class P1{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		for (int i=0;i<n;++i) {
			a[i]=sc.nextInt();
		}
		for (int i=0;i<n;++i) {
			b[i]=sc.nextInt();
		}
		int ans=0,c1=0,c2=0;
		for (int i=0;i<n;++i) {
			if(a[i]==0 && b[i]==1){++c1;}
			else if(a[i]==1 && b[i]==0){++c2;}
		}
		if (c1==0 && c2==0) {
			System.out.println("-1");
		}
		else if (c2>c1) {
			System.out.println("1");
		}
		else{
			double t=Math.ceil((double)(c1+1)/(double)Math.max(c2,1));
			System.out.println((int)t);
		}
	}
}

import java.util.Scanner;

public class Main {
    //n problems
    //each robot solves ith problem gets pi score
    //pi  is an integer not less than 1
    //minimize the maximum value of pi
    //If "Robo-Coder Inc." robot cannot outperform the "BionicSolver Industries" robot by any means, print one integer −1.
    //Otherwise, print the minimum possible value of maxi=1npi, if all values of pi are set in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot.
    public static void main(String[] args){
        int n;
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        int[] R = new int[n];
        int[] B = new int[n];
        int onlyR = 0;
        int onlyB = 0;
        for (int i=0;i<n;i++)
            R[i] = input.nextInt();
        for (int i=0;i<n;i++)
            B[i] = input.nextInt();
        for (int i=0;i<n;i++){
            int r = R[i];
            int b = B[i];
            if (r==1){
                if (r==b)
                    continue;
                onlyR++;
            }
            else if (b==1){
                if (r==1)
                    continue;
                onlyB++;
            }
        }
//        System.out.println("Only R "+onlyR);
//        System.out.println("Only B "+onlyB);
        if(onlyR == 0) {
            System.out.println("-1");
            return;
        }
        float div = ((float)onlyB)/((float)onlyR);
        System.out.println((int)Math.ceil(div)+1);
    }

}

import java.util.Scanner;

public class robots {
    public static void main(String[] args) {
        int d=0,t,s,s1,s2,x;
        Scanner scan=new Scanner(System.in);
        t=scan.nextInt();
        while(d<t)
        { s=-1;s1=0;s2=0;x=0;
            int n=scan.nextInt();
        int[] a=new int[n];
          int[] b=new int[n];
         for (int i = 0; i < n; i++) {
            a[i]=scan.nextInt();
            s1=s1+a[i];
        }
         for (int i = 0; i < n; i++) {
            b[i]=scan.nextInt();
            s2+=b[i];
        }
         //System.out.println("s1 and s2 "+s1+""+s2);
        for (int i = 0; i < n; i++) {
            if(a[i]==1&&b[i]==0)
                        x++;
            }
        if(x==0)
                System.out.println(s);
         else
        {if(s2>s1)
            {
                s=s2-s1;
                s=s/x;
                s+=2;
               System.out.println(s);
            }}
        if(s1>s2)
                System.out.println(1);

        d++;}}

}

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

public class A {

	public static void main(String[] agrs) {
		FastScanner sc = new FastScanner();
//		int yo = sc.nextInt();
//		while(yo-->0) {
			 int n = sc.nextInt();
			 int[] r = sc.readArray(n);
			 int[] b = sc.readArray(n);
			 boolean isEqual = true;
			 for(int i = 0; i < n; i++) {
				 if(r[i] != b[i]) {
					 isEqual = false;
				 }
			 }
			 if(isEqual) {
				 System.out.println(-1);
				 return;
			 }

			 List<Integer> indexes = new ArrayList<>();
			 for(int i = 0; i < n; i++) {
				 if(r[i] == 1 && b[i] == 0) {
					 indexes.add(i);
				 }
			 }

			 int[] res = new int[n];
			 Arrays.fill(res, 1);
			 for(int i = 1; i <= 1000; i++) {
				 for(int j = 0; j < indexes.size(); j++) {
					 res[indexes.get(j)] = i;
				 }
				 int rScore = cal(r,res);
				 int bScore = cal(b,res);
				 if(rScore > bScore) {
					 System.out.println(i);
					 break;
				 }
			 }

		}
//	}

	static int cal(int[] arr, int[] res) {
		int ans = 0;
		for(int i = 0; i < arr.length; i++) {
			ans += arr[i] * res[i];
		}
		return ans;
	}

	static int mod = 1000000007;
	static long pow(int a, int b) {
		if(b == 0) {
			return 1;
		}
		if(b == 1) {
			return a;
		}
		if(b%2 == 0) {
			long ans = pow(a,b/2);
			return ans*ans;
		}
		else {
			long ans = pow(a,(b-1)/2);
			return a * ans * ans;
		}

	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}

import java.util.*;
import java.io.*;
public class try1
{
     public static void main(String[] args)throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          // int t1=Integer.parseInt(br.readLine());
          // while(t1-->0)
           //{
            int n=Integer.parseInt(br.readLine());
               String sr[]=br.readLine().split(" ");
                  String sb[]=br.readLine().split(" ");
                  int r[]=new int[n];
                  int b[]=new int[n];
                  int cr=0,cb=0;
                 for(int i=0;i<n;i++)
                 {
                    r[i]=Integer.parseInt(sr[i]);
                    b[i]=Integer.parseInt(sb[i]);
                    if(r[i]>b[i])
                        cr++;
                    if(b[i]>r[i])
                        cb++;
                 }
                 if(cb==n || cb==cr)
                    System.out.println(-1);
                 else if(cr>cb)
                 {
                    System.out.println(1);
                 }
                 else if(cr==cb)
                    System.out.println(2);
                 else if(cr<cb)
                 {
                    int x=cb-cr;
                    x/=cr;
                    int y=1+x+1;
                   System.out.println(y);
                 }

          //}
 }
 }

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

     public class Solution implements Runnable
    {

         public  static void solve()
          {

              int n=i();
              int[] a=new int[n];
              int[] b=new int[n];
              for(int i=0;i<n;i++)a[i]=i();
               for(int i=0;i<n;i++)b[i]=i();
                long sum_i=0;long sum_2=0;
                for(int i=0;i<n;i++){
                  if(a[i]!=b[i]){
                    sum_i+=a[i];
                    sum_2+=b[i];
                  }
                }
              if(sum_i==sum_2){
                System.out.println("-1");
              } else if(sum_i>sum_2){
                System.out.println("1");
              } else {
                System.out.println((int)(Math.ceil(((sum_2)+1)/(1.0*sum_i))));
              }
          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Solution(), "whatever", 1<<26).start();
          }
           static class Pair implements Comparator<Pair>{
            String a;
            long b;
            long c;

            Pair(){}
            Pair(String a,long b,long c)
            {
                       this.a=a;
                       this.b=b;
                       this.c=c;
            }
            public int compare(Pair p1,Pair p2)
            {
               if(p1.c==0 && p2.c==0)
               {
                return Long.compare(p1.b,p2.b);
               }
               if(p1.c==0)
               {
                return -1;
               }
               if(p2.c==0)
               {
                return 1;
               }
               else
              return Long.compare(p2.b*p1.c,p1.b*p2.c);

            }

        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

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

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

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

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }

import java.util.*;

public class MyClass {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] ar1=new int[n];
      int[] ar2=new int[n];
      for(int i=0; i<n; i++){
          ar1[i]=sc.nextInt();
      }

      for(int i=0; i<n; i++){
          ar2[i]=sc.nextInt();
      }

      int count1=0,count2=0;
      int same0=0;
      int same1=0;
      for(int i=0; i<n; i++){
          if(ar1[i]==ar2[i] && ar1[i]==0)
          same0++;
          else if(ar1[i]==ar2[i] && ar1[i]==1)
          same1++;
          else if(ar1[i]==1)
          count1++;
          else
          count2++;

      }
      int ans=0;
        if(same0+same1==n)
        ans=-1;
        else{
            ans=count2+same1-count1;
        }

      System.out.println(ans);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class AContestForRobots {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int n = c.readInt();
            int a = 0, b = 0;
            int x[] = c.readIntArray(n);
            int y[] = c.readIntArray(n);
            int hh[] = new int[n];
            int as = 0;
            for (int j = 0; j <= 10000; j++) {
                as++;
                a = 0;
                b = 0;
                for (int i = 0; i < n; i++) {
                    if (x[i] == 1 && y[i] != 1) {
                        hh[i]++;
                        a += hh[i];
                    }
                    if (y[i] == 1 && x[i] != 1) {
                        b++;
                    }
                }
                if (j == 0 && a == b) {
                    w.printLine(-1);
                    return;
                } else if (a > b) {
                    w.printLine(as);
                    return;
                }
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		int arr[] = new int[len];
		int diff = 0;
		int tx = 0;
		int ty = 0;
		for(int i=0; i<len; i++){
		    arr[i] = sc.nextInt();
	        tx += arr[i];
		}

		for(int i=0; i<len; i++){
		    int a = sc.nextInt();
		    ty += a;
		    if(arr[i] > a)diff++;
		}

		if(diff == 0){
		    System.out.println(-1);
		}
		else if(tx > ty){
		    System.out.println(1);
		}
		else if(tx == ty){
		    System.out.println(2);
		}
		else{
		    int h = ty + 1 - (tx - diff);
		    System.out.println(h / diff + h % diff);
		}

	}
}

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

        public class Main {
            static FastScanner in;
            static PrintWriter out;
            public static void main(String[] args) throws IOException {
                in = new FastScanner(System.in);
                out = new PrintWriter(System.out);
                int n = in.nextInt();

                ArrayList<Integer> robc = new ArrayList<Integer>(n);
                ArrayList<Integer> bion = new ArrayList<Integer>(n);

               for (int i = 0; i < n; ++i){
                    int r = in.nextInt();
                    robc.add(i, r);
               }

               for (int i = 0; i < n; ++i){
                    int b = in.nextInt();
                    bion.add(i, b);
               }
     		   int bionic = 0;
     		   int robcod = 0;

               for (int i = 0; i < n; ++i){
                    if (bion.get(i) == 1 && robc.get(i) == 0){
                    	bionic++;
                    } else if (bion.get(i) == 0 && robc.get(i) == 1) {
                    	robcod++;
                	}
               }
               int ans = -1;
               int r = -1;
               if (robcod != 0)
                 r = (bionic + robcod - 1) / robcod;

               if (robcod == 0){
               		ans = -1;
               } else if (bionic == 0 || bionic < robcod){
               		ans = 1;
               } else if (bionic > robcod){
               		ans = r;
               		if (bionic % robcod == 0){
               			ans++;
               		}
               }

               out.println(ans);
               out.close();
            }

            public static class FastScanner {
                private BufferedReader br;
                private StringTokenizer st;
                public FastScanner(InputStream inputStream){
                    br = new BufferedReader(new InputStreamReader(inputStream));
                }
                public String nextLine() throws IOException {
                    return br.readLine();
                }

                public String next() {
                    while (st == null || !st.hasMoreTokens()){
                        try {
                            st = new StringTokenizer(br.readLine());
                        } catch (IOException ignored){}
                    }
                    return st.nextToken();
                }
                public int nextInt() {
                    return Integer.parseInt(next());
                }
                public long nextLong() {
                    return Long.parseLong(next());
                }
                 public boolean nextBoolean() {
                    return Boolean.parseBoolean(next());
                }
                public void close() throws IOException {
                     br.close();
                }
            }
        }

import java.util.Scanner;
public class mezo{
public static void main(String[] args) {
	Scanner obj = new Scanner(System.in);
	int num = obj.nextInt();
	int[] robo = new int[num];
	int[] bot = new int[num];
	for(int i=0;i<num;i++) {
	    robo[i] = obj.nextInt();
	}
	for(int i=0;i<num;i++) {
	    bot[i] = obj.nextInt();
	}
	int countr=0,countb=0;
	for(int i=0;i<num;i++) {
		if(robo[i] > bot[i]) {
			countr++;
		}
		else if(robo[i] < bot[i]) {
			countb++;
		}
	}
	double z = (countb/countr);
	System.out.println(Math.ceil(z));
}
}

import java.util.Scanner;
public class mezo{
public static void main(String[] args) {
	Scanner obj = new Scanner(System.in);
	int num = obj.nextInt();
	int[] robo = new int[num];
	int[] bot = new int[num];
	for(int i=0;i<num;i++) {
	    robo[i] = obj.nextInt();
	}
	for(int i=0;i<num;i++) {
	    bot[i] = obj.nextInt();
	}
	int countr=0,countb=0;
	for(int i=0;i<num;i++) {
		if(robo[i] > bot[i]) {
			countr++;
		}
		else if(robo[i] < bot[i]) {
			countb++;
		}
	}
	for(int i=0;i<num;i++) {
		if(robo[i]==bot[i]) {
			System.out.println(-1);
		}
		else {
			int z = (countb/countr) + 1;
			System.out.println(z);
		}
	}
}
}

//https://codeforces.com/problemset/problem/1321/A
import java.util.Scanner;

public class Problem_1321_A {
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        int n = scanner.nextInt();
        int [] robo = new int[n];
        int [] bio = new int[n];
        int ans1 = 0;
        int ans2 = 0;

        for (int i=0; i<n; i++){
            robo[i] = scanner.nextInt();
        }

        for (int i=0; i<n; i++){
            bio[i] = scanner.nextInt();
        }

        for (int i=0; i<n; i++){
            if (robo[i] > bio[i])
                ans1++;
            else
                ans2++;
        }

        if (ans1==0)
            System.out.println(-1);
        else
            System.out.println(ans2/ans1 + 1);

        scanner.close();
    }
}

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

import static java.lang.Math.*;

public class Main extends ArrayList implements Runnable{
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

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

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }
    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;

        return gcd(b%a, a);
    }
    static int log2(int n)
    {
        int p = 1;
        if (n > 0 && (n & (n - 1)) == 0)
            return n;

        while (p < n)
            p <<= 1;

        return p;
    }

    public void run() {

       InputReader sc = new InputReader(System.in);
       PrintWriter w = new PrintWriter(System.out);
       int n=sc.nextInt();

       int a[]=new int[n];
       int b[]=new int[n];
       for(int i=0;i<n;i++)
       {
    	   a[i]=sc.nextInt();
       }
       int ans=-1;
       for(int i=0;i<n;i++)
       {
    	   b[i]=sc.nextInt();
       }
       int a1=0,b1=0;
       for(int i=0;i<n;i++)
       {
    	   //w.println(a[i]+" "+b[i]);
    	   if(a[i]!=b[i])
    	   {

    		   if(a[i]==1)
    			   a1++;
    		   if(b[i]==1)
    			   b1++;
    		   //w.println(a1+" "+b1);
    	   }
       }

       if(a1==b1 || a1==0)
       {
    	   ans=-1;
       }
       else
       {
    	   if(a1>b1)
    		   ans=1;
    	   else
    	   {
    		   int d=(b1-a1)+1;
    		   ans=((b1+1)/a1);
    		   if((b1+1)%a1!=0)
    			   ans++;
    	   }
       }

       w.println(ans);
       w.close();
    }
}

import java.util.Scanner;

public class AT4 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        int[] a = new int[t];
        int[] b = new int[t];
        int counter = 0;
        int counter1 = 0;
        int counter2 = 0;
        for (int i = 0; i < t; i++) {
            a[i] = scan.nextInt();
        }
        for (int i = 0; i < t; i++) {
            b[i] = scan.nextInt();
            if (b[i] == 1 && a[i] == 0)
                counter++;
            if (a[i] == 1 && b[i] == 0)
                counter1++;
            if (b[i] == 1 && a[i] == 1)
                counter2++;
        }
        if (counter == 0 && counter1 == 0 || counter == counter2) {
            System.out.println(-1);
            return;
        }
        System.out.println(counter/counter1+1);
    }
}

import java.util.Scanner;

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

        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        int r1[] = new int[n];
        for (int i = 0; i < n; i++) {
            r1[i] = in.nextInt();
        }

        int r2[] = new int[n];
        for (int i = 0; i < n; i++) {
            r2[i] = in.nextInt();
        }

        long soleR1 = 0, soleR2 = 0;

        for (int i = 0; i < n; i++) {
            if (r1[i]==0 && r2[i]==1) soleR2++;
            else if (r1[i]==1 && r2[i]==0) soleR1++;
            else continue;
        }

        if (soleR1 > soleR2) System.out.println(0);
        else if (soleR1 == soleR2) System.out.println(-1);
        else{
            if (soleR2 > soleR1 && soleR1 == 0) System.out.println(-1);
            else if (soleR2 == 0 && soleR1 == 0) System.out.println(-1);
            else {
                double val = Math.ceil((soleR2 + soleR1) / (soleR1));
                System.out.println((long)val);
            }
        }

    }
}

import java.util.*;

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

        int np,rs1,rs2,res;
        try{
            np=in.nextInt();
            rs1=rs2=0;

            int r1[]=new int[np];
            int r2[]=new int[np];

            for(int i=0;i<r1.length;i++)
                r1[i]=in.nextInt();

            for(int i=0;i<r1.length;i++)
                r2[i]=in.nextInt();

            for(int i=0;i<r1.length;i++)
            {
                if(r1[i]-r2[i]==1)
                    rs1++;
                else if(r2[i]-r1[i]==1)
                    rs2++;
            }

            if(rs1==0 && rs2==0)
                res=-1;
            else
                res= rs2/rs1 + 1;

            System.out.println(res);
            in.close();
        }catch(Exception e)
        {
            return;
        }
    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		int arr[] = new int[len];
		int diff = 0;
		int tx = 0;
		int ty = 0;
		for(int i=0; i<len; i++){
		    arr[i] = sc.nextInt();
	        tx += arr[i];
		}

		for(int i=0; i<len; i++){
		    int a = sc.nextInt();
		    ty += a;
		    if(arr[i] > a)diff++;
		}
		if(diff == 0){
		    System.out.println(-1);
		}
		else if(tx > ty){
		    System.out.println(1);
		}
		else if(tx == ty){
		    System.out.println(2);
		}
		else{
		    int h = ty + 1 - tx;
		    System.out.println(h / diff + 1);
		}

	}
}

    import java.util.*;

    public class main {

        public static void main(String[] args) {

            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int acnt=0 , bcnt=0;
            for(int i=0;i<n;i++){
                a[i] = in.nextInt();
            }

            for(int i=0;i<n;i++){
                b[i] = in.nextInt();

                if(a[i]==1 && b[i]!=1){
                    acnt++;
                }else if(a[i]!=1 && b[i]==1){
                    bcnt++;
                }
            }

            int ans=1;

            if(acnt>0){
                ans=(bcnt+1)/acnt;
            }
            System.out.println(ans);
        }
    }

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

public class A {
	public void run() throws Exception {
		FastScanner sc = new FastScanner();

		int prob = sc.nextInt();
		int[] rob = new int[prob];
		int[] bio = new int[prob];
		int tog = 0;
		int robc = 0;
		int bioc = 0;
		for (int i = 0; i<prob; i++) {
			rob[i] = sc.nextInt();
			if (rob[i] == 1) robc++;
		}
		for (int i = 0; i<prob; i++) {
			bio[i] = sc.nextInt();
			if (rob[i] == bio[i] && rob[i] == 1) tog++;
			if (bio[i] == 1) bioc++;
		}
		if (robc == 0) System.out.println(-1);

		else {
			robc-=tog;
			bioc-=tog;
			if (robc == 0) {
				System.out.println(-1);
				return;
			}
			if (bioc == 0) {
				System.out.println(1);
				return;
			}
			int count = (int)Math.ceil((double)bioc/robc);
		//	System.out.println(robc + " "+ bioc);
			if (robc % bioc == 0 || bioc%robc == 0) count++;
			System.out.println(count);
		}
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

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

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

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

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

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

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

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        try{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n>=1 && n<=100){
            int a[]=new int[n];
            int b[]=new int[n];
            for(int i=0;i<n;i++){
                a[i]=sc.nextInt();
                if(a[i]>=0 && a[i]<=1){

                }
                else
                    return;
            }
            for(int i=0;i<n;i++){
                b[i]=sc.nextInt();
                if(b[i]>=0 && b[i]<=1){

                }
                else
                    return;
            }
            int count1=0,count2=0,pair=0,req=0;
            for(int i=0;i<n;i++){
                if(a[i]==1 && b[i]==0){
                    pair++;
                }
                else if(a[i]==1){
                    count1++;
                }
            }
            for(int i=0;i<n;i++){
                if(b[i]==1)
                    count2++;
            }
            req=count2-count1;

            //

            if(req==0 && a==b)
                System.out.print(-1);
            else if(req<0 && count1>count2){
                System.out.print(1);
            }
            else{
                System.out.print(req/pair+1);
            }
            return;

        }
}
catch(Exception e){

}
    }
}

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

public class c1 {
    public static void main(String[] args) {
        MyScanner scan = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int t=1;
//        int t=scan.nextInt();
        while(t-->0) {

            int n=scan.nextInt();
            int[] a=new int[n];
            int[] b=new int[n];
            for(int c=0;c<n;c++) {
                a[c]=scan.nextInt();
            }
            for(int c=0;c<n;c++) {
                b[c]=scan.nextInt();
            }

            int robo=0,bio=0,same=0;
            for(int c=0;c<n;c++) {
                if(a[c]>b[c]) robo++;
                else if(b[c]>a[c]) bio++;
                else same++;
            }

            if(same==n||(robo==0&&bio>0)) out.println(-1);
            else {
                if(robo>bio) out.println(1);
                else if(robo==bio) out.println(2);
                else out.println((bio%robo==0)?bio/robo+1:bio/robo);
            }
        }
        out.close();
    }

    //node
    static class Node implements Comparable<Node> {
        public int x,y;
        public Node(int x,int y) {
            this.x=x;
            this.y=y;
        }

        public int compareTo(Node other) {
            if(this.x==other.x) return 0;
            else if(this.x>other.x) return 1;
            else return -1;
        }

        public boolean equals(Node other) {
            return this.x==other.x;
        }

//        public int compareTo(Node other) {
//            if(this.y==other.y) return 0;
//            else if(this.y>other.y) return 1;
//            else return -1;
//        }
//
//        public boolean equals(Node other) {
//            return this.y==other.y;
//        }
    }
    //edge
    static class Edge {
        public Node a,b;
        public int weight;
        public Edge(Node a,Node b) {
            this.a=a;
            this.b=b;
        }

        public Edge(Node a,Node b,int weight) {
            this.a=a;
            this.b=b;
            this.weight=weight;
        }
    }

    //util
    public static int gcd(int a, int b) {
        if (b == 0)
            return a;
        if (a == 0)
            return b;
        return (a > b) ? gcd(a % b, b) : gcd(a, b % a);
    }

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

    public static ArrayList<Integer> sieve(int n) {
        boolean prime[]=new boolean[n+1];
        Arrays.fill(prime,true);
        for (int p=2;p*p<=n;p++) {
            if (prime[p]) {
                for (int i=p*2;i<=n;i+=p) {
                    prime[i]=false;
                }
            }
        }
        ArrayList<Integer> primeNumbers=new ArrayList<Integer>();
        for (int i = 2; i <= n; i++) {
            if (prime[i]) {
                primeNumbers.add(i);
            }
        }
        return primeNumbers;
    }

    public static boolean isPrime(int a) {
        if (a == 0 || a == 1) {
            return false;
        }
        if (a == 2) {
            return true;
        }
        for (int i = 2; i < Math.sqrt(a) + 1; i++) {
            if (a % i == 0) {
                return false;
            }
        }
        return true;
    }

    public static ArrayList<Integer> getDivisors(int n) {
        ArrayList<Integer> div = new ArrayList<Integer>();
        for (int i=1;i*i<=n;i++) {
            if (n%i==0) {
                div.add(i);
                if (n/i!=i)
                    div.add(n/i);
            }
        }
        return div;
    }

    //scanner
    public static PrintWriter out;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int [] robot1 = new int[n];
        int countCan = 0 ;
        int countCant = 0;
        for(int i = 0; i < n  ; i++){
            robot1[i] = input.nextInt();
        }

        for(int i = 0; i < n  ; i++){
            if(input.nextInt() ==  1){
                if(robot1[i] == 0){
                    countCant ++;
                }
            }else{
                if(robot1[i] == 1)
                    countCan++;
            }
        }

        if(countCan == countCant || countCan == 0)
            System.out.println(-1);
        else if(countCan > countCant){
            System.out.println(1);
        }else{
            int ans = (int)Math.ceil(countCant/countCan)+1;
            System.out.println(ans);
        }
    }
}

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

public class Q1 {

    public static void main(String[] args) {

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

        int  N=in.nextInt();
        double f=0,s=0;
        int arr1[]=in.Int_Array(N),arr2[]=in.Int_Array(N);
        for(int i =0;i<N;i++) {
            f+=(arr1[i] == 1  && arr2[i]==0)? 1 : 0;
            s+=(arr2[i] == 1 && arr1[i]==0)? 1 : 0;
        }
        //System.out.println(s+" "+f);
        if((f==s && s==N) || f==0 ){
            out.println(-1);
        }else{
            int ans=1,ff=(int)f;
            for(int i =2;i<N;i++){
                ff+=f; ans ++;
                if(ff>s)
                    break;
            }
            out.println(ans);

           }
        out.close();
    }

//    public static void main(String[] args) {
//
//        InputReader in = new InputReader();
//        PrintWriter out = new PrintWriter(System.out);
//        int t = in.nextInt();
//        while (t-- > 0) {
//
//            int N = in.nextInt(), max = -1;
//            int arr[] = new int[N];
//            for (int i = 0; i < N; i++) {
//                arr[i] = in.nextInt();
//                max = Math.max(max, arr[i]);
//            }
//            if (max == -1) {
//                out.println(0 + " " + 1);
//                continue;
//            }
//            int diff=Integer.MAX_VALUE;
//
//            int l=0,r=(int)1e9;
//            while(l<=r){
//                int m=(r-l+1)/3,d1=0,d2=0,m1=l+m,m2=r-m;
//                for(int i =1;i<N;i++){
//                    int  a =arr[i]==-1?m1:arr[i],b =arr[i-1]==-1?m1:arr[i-1],d=Math.abs(a-b);
//                    d1=Math.max(d1,d);
//                }
//                for(int i =1;i<N;i++){
//                    int  a =arr[i]==-1?m2:arr[i],b =arr[i-1]==-1?m2:arr[i-1],d=Math.abs(a-b);
//                    d2=Math.max(d2,d);
//                }
//                if(d1<=d2){
//                    r=m2-1;
//                    if(d1<diff){
//                       max=m1; diff=d1;}
//                }else{
//                    l=m1+1;
//                    if(d2<diff){
//                       max=m2; diff=d2;}
//                }
//            }
//
//            out.println(diff + " " + max);
//
//        }
//        out.close();
//
//
//    }

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

        public  int[] Int_Array(int s){
            int arr[]=new int[s];
            for(int i =0;i<s;i++)
                arr[i]=nextInt();
            return arr;

        }

        public int[] shuffle(int[] arr) {
            Random r = new Random();
            for (int i = 1, j; i < arr.length; i++) {
                j = r.nextInt(i);
                arr[i] = arr[i] ^ arr[j];
                arr[j] = arr[i] ^ arr[j];
                arr[i] = arr[i] ^ arr[j];
            }
            return arr;
        }

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

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

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

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

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

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

    }

}

//    public static void main(String[] args) {
//
//        InputReader in = new InputReader();
//        PrintWriter out = new PrintWriter(System.out);
//        int t  =in.nextInt();
//
//        while(t-->0){
//            int  N=in.nextInt();
//            int arr[]=new int[N];
//            for(int i=0 ;i<N;i++)
//                arr[i]=in.nextInt();
//
//            ArrayList<Integer> set1=new ArrayList<>(),set2=new ArrayList<>(),set3=new ArrayList<>();
//            double xval=in.nextInt(),x=in.nextInt(),yval=in.nextInt(),y=in.nextInt();
//            long k=in.nextLong();
//            long  ans  =0;
//
//            if(xval<yval){
//                double temp=xval;
//                xval=yval;
//                yval=temp;
//
//                temp=x;
//                x=y;
//                y=temp;
//            }
//            xval=xval/100; yval=yval/100;
//
//            for(int i =0;i<N;i++){
//                if((i+1)%x==0 && (i+1)%y==0)
//                    set1.add(i);
//                else if ((i+1)%x==0 )
//                    set2.add(i);
//                else if((i+1)%y==0)
//                    set3.add(i);
//            }
//            arr=in.shuffle(arr);
//
//            int a =0,b=0,c=0,add=0;
//
//            for(int  i=N-1;i>=0;i--){
//
//                int temp=0;
//
//                if(a==set1.size()  && b==set2.size()  && c==set3.size())
//                    continue;
//                else if (a==set1.size()  && b==set2.size() ){
//                    ans += (yval) * arr[i];
//                    c++;
//                    temp=11;
//                }else if(a==set1.size()){
//                    if (set2.get(b) <set3.get(c)) {
//                        ans += (xval) * arr[i];
//                        b++;
//                    } else {
//                        ans += (yval) * arr[i];
//                        c++;
//                    }
//                }else{
//                    if (set1.get(a) < set2.get(b) && set1.get(a) < set3.get(c)) {
//                        ans += (xval + yval) * arr[i];
//                        a++;
//                    } else if (set2.get(b)<set3.get(c)) {
//                        ans += (xval) * arr[i];
//                        b++;
//                    } else {
//                        ans += (yval) * arr[i];
//                        c--;
//                    }
//                }
//
//
//
//                if(ans>=k){
//                    break;
//                }
//
//            }
//
//            if(ans<k)
//                out.println(-1);
//            else
//                out.println(add);
//
//
//
//        }
//
//        out.close();
//    }

//package com.netease.music.codeforces.round625.div12;

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

/**
 * Created by dezhonger on 2020/2/24
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();

    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                b[i] = in.nextInt();
            }
            int c = 0;
            int d = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] == b[i]) continue;
                if (a[i] == 1) c++;
                else d++;
            }
            if (c == 0) System.out.println(-1);
            else {
                int ans = (d + c - 1) / c + 1;
                System.out.println(ans);
            }
        }

    }

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

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

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

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

    }
}

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

public class ContestForRobots_1321A {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		ArrayList<Integer> index = new ArrayList<Integer>();
		int sum1 = 0, sum2 = 0;
		for (int i = 0; i < n; i++) {
			int a = input.nextInt();
			arr1.add(a);
			sum1 += a;
		}
		for (int i = 0; i < n; i++) {
			int a = input.nextInt();
			arr2.add(a);
			sum2 += a;
		}
		if ((sum1 == 0) || (sum1 == 0 && sum2 == 0) || ((sum1 == n && sum2 == n)))
			System.out.println(-1);
		else if (sum1 > sum2) {
			System.out.println(1);
		} else {
			int count = 1;
			for (int i = 0; i < n; i++)
				if (arr1.get(i) - arr2.get(i) > 0) {
					index.add(i);
					sum1--;
				}
			int nSum = 0;
			while (nSum < sum2) {
				nSum = sum1 + (index.size() * count);
				count++;
			}
			System.out.println(count);
		}
		input.close();
	}
}

import java.net.Inet4Address;
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        int n = nextInt();
        int[] a1 = nextArray(n), a2 = nextArray(n);
        if (Arrays.equals(a1,a2)) {
            System.out.println(-1);
            return;
        }
        boolean check = true;
        for (int i = 0; i < n; i++) {
            if (a1[i] != 0) check = false;
        }
        if (check) {
            System.out.println(-1);
            return;
        }
        int z = 0, x = 0;
        for (int i = 0; i < n; i++) {
            if (a1[i] == a2[i]) continue;
            if (a1[i] == 1) {
                z++;
            } else x++;
        }
        System.out.println((long)Math.ceil((double)(x+1)/z));
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

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

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

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

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

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

    }

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

}

import java.util.Scanner;

public class NewClass {
    public static void main(String[] args) {
        int input1[]=new int[10000];
        int input2[]=new int[10000];
        int n;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        for(int i=0;i<n;i++){
            input1[i]=scan.nextInt();

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

            input2[i]=scan.nextInt();
        }
        int cnt1=0,cnt2=0;
        /*for(int i=0;i<n;i++){
             System.out.println(input1[i]);
             System.out.println(input2[i]);
        }*/
        for(int i=0;i<n;i++){
            if(input1[i]<input2[i]){
            cnt1++;
            }
            if(input1[i]>input2[i]){
            cnt2++;
            }
        }
        if(cnt2==0){
            System.out.println("-1");
        }
        else if(cnt2>cnt1){
            System.out.println("1");
           // System.out.println("MAHIN");
        }
        else if(cnt2==cnt1){
            System.out.println("2");
        }
        else if(cnt2<cnt1){
            int temp=cnt1-cnt2+2;
            System.out.println(temp);
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int r[] = new int[n];
        int b[] = new int[n];
        for (int i = 0; i < n; i++) {
            r[i] = input.nextInt();

        }
        for (int i = 0; i < n; i++) {
            b[i] = input.nextInt();

        }
        int brobot = 0;
        int robot = 0;
        for (int i = 0; i < n; i++) {
            if (b[i] == 0 && r[i] == 1) {
                brobot++;

            }
            if (b[i] == 1 && r[i] == 0) {
                robot++;

            }

        }

        if (brobot < robot) {
            int result = brobot * 2;
            if (brobot == 0) {
                System.out.println(-1);
            } else if (result == robot) {
                System.out.println(result + 1);
            } else if (result < robot) {
                result = robot - result;
                System.out.println(2 + result);
            } else {
                System.out.println(2);
            }
        } else if (brobot > robot) {
            System.out.println(1);

        } else {
            System.out.println("-1");
        }
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        try{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n>=1 && n<=100){
            int a[]=new int[n];
            int b[]=new int[n];
            for(int i=0;i<n;i++){
                a[i]=sc.nextInt();
                if(a[i]>=0 && a[i]<=1){

                }
                else
                    return;
            }
            for(int i=0;i<n;i++){
                b[i]=sc.nextInt();
                if(b[i]>=0 && b[i]<=1){

                }
                else
                    return;
            }
            int count1=0,count2=0,pair=0,req=0;
            for(int i=0;i<n;i++){
                if(a[i]==1 && b[i]==0){
                    pair++;
                }
                else if(a[i]==1){
                    count1++;
                }
            }
            for(int i=0;i<n;i++){
                if(b[i]==1)
                    count2++;
            }
            req=count2-count1;

            //

            if(req==0)
                System.out.println(-1);
            else if(req<0){
                System.out.println(1);
            }
            else{
                System.out.println(req/pair+1);
            }
            return;

        }
}
catch(Exception e){

}
    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		int arr[] = new int[len];
		int diff = 0;
		int tx = 0;
		int ty = 0;
		for(int i=0; i<len; i++){
		    arr[i] = sc.nextInt();
	        tx += arr[i];
		}

		for(int i=0; i<len; i++){
		    int a = sc.nextInt();
		    ty += a;
		    if(arr[i] > a)diff++;
		}
		if(diff == 0){
		    System.out.println(-1);
		}
		else if(tx > ty){
		    System.out.println(1);
		}
		else if(tx == ty){
		    System.out.println(2);
		}
		else{
		    int h = ty + 1 - (tx - diff);
		    System.out.println(h / diff + 1);
		}

	}
}

import java.util.*;
public class solution{
    static int check(int n, int a[],int b[],int m[])
    {
        int aa=0,bb=0;
        for(int i=0;i<n;i++)
        {
            aa+=(a[i]*m[i]);
        }
        for(int i=0;i<n;i++)
        {
            bb+=(b[i]*m[i]);
        }

        if(aa>bb)
            return 1;
        else
            return -1;

    }
    static int getanswer(int n,int a[],int b[])
    {
        int m[]=new int[n];
        for(int i=0;i<n;i++)
            m[i]=1;

        int flag=-1,flag1=-1;

        while(flag<0){
        for(int i=0;i<n;i++)
        {
         if(a[i]==1&&b[i]==0)
         {
            flag1++;
          m[i]++;
         }
        }
        if(flag1<0)
            return -1;

        flag=check(n,a,b,m);

        }

        Arrays.sort(m);

        return m[n-1];
    }

    public static void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int a[]=new int[n],b[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=s.nextInt();
        }
        for(int i=0;i<n;i++)
        {
            b[i]=s.nextInt();
        }

        int ans=getanswer(n,a,b);
		System.out.println(ans);
    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.*;

public class Test {
    public static void main(String[] args) throws IOException {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int a[] = new int[n];
            int b[] = new int[n];
            for(int i=0; i<n; i++){
                a[i] = sc.nextInt();
            }
            int one =0;
            for(int i=0; i<n; i++){
                b[i] = sc.nextInt();
                if(b[i]==1)
                    one++;
            }
            int count=0;
            for(int i=0; i<n; i++){
                if(a[i]==1 && b[i]==0)
                    count++;
            }
            if(count >= one){
                System.out.println("1");
                return;}
            int ans = one-count;
            if(count==0 || one ==0 || ans ==0)
                System.out.println("-1");
            else
                System.out.println(ans);

    }
}

import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;

public class RoboComp {
    public static void main(String[] args) throws IOException {
        OutputStream out = new BufferedOutputStream(System.out);
        Scan scan = new Scan();
        int n = scan.scanInt();
        int[] rc = new int[n];
        for (int i=0;i<n;i++){
            rc[i]=scan.scanInt();
        }
        int[] bi = new int[n];
        int count=0;
        int pointsRc=0;
        int pointsBi=0;
        for (int i=0;i<n;i++){
            bi[i]=scan.scanInt();
            if (rc[i]==1 && bi[i]==0){
                count++;
            }else if (rc[i]==0 && bi[i]==1){
                pointsBi++;
            }else if (rc[i]==1 && bi[i]==1){
                pointsBi++;
                pointsRc++;
            }
        }
        if (Arrays.equals(rc,bi)){
            out.write((-1+"\n").getBytes());
        }else{
            if (pointsRc>pointsBi){
                out.write((1+"\n").getBytes());
            }else if (count > 0){
                int diff = pointsBi-pointsRc;
                out.write((diff/count+1+"\n").getBytes());
            }
        }
        out.flush();
    }

    private static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private byte[] buffer;
        private DataInputStream din;
        private int bufferPointer, bytesRead;

        public FastReader() {
            buffer = new byte[BUFFER_SIZE];
            din = new DataInputStream(System.in);
            bufferPointer = bytesRead = 0;
        }

        private String nextLine() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) != -1 && c != '\n') {
                sb.appendCodePoint(c);
            }
            return sb.toString();
        }

        private int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = c == '-';
            if (neg) {
                c = read();
            }
            while (c >= '0' && c <= '9') {
                ret = ret * 10 + c - '0';
                c = read();
            }
            return (neg) ? -ret : ret;
        }

        private long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = c == '-';
            if (neg) {
                c = read();
            }
            while (c >= '0' && c <= '9') {
                ret = ret * 10 + c - '0';
                c = read();
            }
            return (neg) ? -ret : ret;
        }

        private double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = c == '-';
            if (neg) {
                c = read();
            }
            while (c >= '0' && c <= '9') {
                ret = ret * 10 + (c - '0');
                c = read();
            }
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
            return (neg) ? -ret : ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) {
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        private void close() throws IOException {
            if (din != null) {
                din.close();
            }
        }

    }

    private static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public int scan() throws IOException {
            if (total < 0)
                throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0)
                    return -1;
            }
            return buf[index++];
        }

        public int scanInt() throws IOException {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            return neg * integer;
        }

        public double scanDouble() throws IOException {
            double doub = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n) && n != '.') {
                if (n >= '0' && n <= '9') {
                    doub *= 10;
                    doub += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            if (n == '.') {
                n = scan();
                double temp = 1;
                while (!isWhiteSpace(n)) {
                    if (n >= '0' && n <= '9') {
                        temp /= 10;
                        doub += (n - '0') * temp;
                        n = scan();
                    } else throw new InputMismatchException();
                }
            }
            return doub * neg;
        }

        public String scanString() throws IOException {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        scanner.nextLine();
        int[] first = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int[] second = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        int anotherCount = 0;
        int count = 0;
        for (int i = 0; i < t; i++) {
            if (second[i] != 0 && first[i] == 0) {
                count++;
            } else if (first[i] != 0 && second[i] == 0) {
                anotherCount++;
            }
        }

        if (anotherCount == 0) {
            System.out.print(-1);
            return;
        } else if (anotherCount > count) {
            System.out.print(1);
            return;
        }

        int firstEstimate = (int) Math.round(count / anotherCount);
        if (firstEstimate * anotherCount == count) {
            firstEstimate++;
        }

        System.out.println(firstEstimate);
    }
}

/**
 * @author : Kshitij
 */
import java.io.*;
import java.util.InputMismatchException;

public class Main {
    public static void main(String[] xps){
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        StringBuilder stringBuilder = new StringBuilder();
        int n=in.readInt();
        int[] win=new int[n];
        int[] lose=new int[n];
        for (int i = 0; i <n ; i++) {
            win[i]=in.readInt();
        }
        for (int i = 0; i <n ; i++) {
            lose[i]=in.readInt();
        }
        stringBuilder.append(solver(n,win,lose)).append("\n");
        out.println(stringBuilder);
    }
    public static int solver(int n, int[] win, int[] lose){
        int ans=0;
        int count=0;
        int no=0;
        for (int i = 0; i <n ; i++) {
            int temp1=win[i];
            int temp2=lose[i];
            if ((temp1==1&&temp2==1)||(temp1==0&&temp2==1)){
                ans++;
            }
            else if(temp1==1&&temp2==0)
                count++;
            else
                no++;
        }
        if (ans==n || count==n ||no==n)
            return -1;
        else {
            if (ans-count!=0)
                return ans - count;
            else
                return -1;
        }
    }
    private static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public char readChar(){
            String s=readString();
            if (s.length()>1)
                throw new InputMismatchException();
            else
                return s.charAt(0);
        }

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

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    private static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.flush();
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
            writer.flush();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.io.*;
import java.lang.reflect.Array;
        import java.util.*;

public class codeforces {
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

    public static void main(String args[]) throws IOException
    {
       Reader fast=new Reader();

        int n=fast.nextInt();
        int a[]=new int[n];
        int b[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=fast.nextInt();
        }
        for(int i=0;i<n;i++)
        {
            b[i]=fast.nextInt();
        }
        int f=0;
        int s=0;
        int k=0;
        for(int i=0;i<n;i++)
        {
        if(a[i]>b[i]) f++;
        if(b[i]>a[i]) s++;
        if(a[i]==b[i]&&a[i]==1)
        {
            f++;
            s++;
            k++;
        }
        }
     if((f==s))   System.out.println("-1");
     else
     {
         if(f>s) System.out.println("1");
         else
         {
             f-=k;
             s-=k;
             if(f==0)
             {
                 System.out.println("-1");
             }
             else
             {
                 int ans=1;

                 while(f<=s)
                 {

f+=ans;
                     ans++;

                 }
                 System.out.println(ans);
             }

         }

     }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        //int t=in.nextInt();
        //for(int i=0;i<t;++i)
        solver.solve(1,in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber,FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a=new int[n];
            int[] b=new int[n];
            int counta=0,countb=0;
            for(int i=0;i<n;i++){
                a[i]=in.nextInt();
            }
            for(int i=0;i<n;i++){
                b[i]=in.nextInt();
            }
            int f=0;
            for(int i=0;i<n;++i){
            if(b[i]==1 && a[i]==1) f++;
          //  else f++;

            if(a[i]==0 && b[i]==0 )continue;
            else f++;

            if(a[i]==1) counta++;

             if(b[i]==1) countb++;
            }

            if(counta>countb) out.println(1);
            else if(counta<n/2) out.println(countb-counta);
            else if(f>=n) out.println("-1");
            else out.println(counta);

        }
}

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.security.acl.LastOwnerException;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    static Long max = (long) (2 * 10E5);
    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    // Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
    // Arrays.stream(br.readLine().split("\\s+")).map(Long::parseLong).toArray(Long[]::new);
    // Integer.parseInt(br.readLine());
    // Long.parseLong(br.readLine());

    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        Integer[] r = Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
        Integer[] b = Arrays.stream(br.readLine().split("\\s+")).map(Integer::parseInt).toArray(Integer[]::new);
        int _b = 0;
        int _r = 0;
        for (int i = 0; i < n; i++) {
            if (r[i] == 1) {
                if (b[i] == 0) _r++;
            } else
                _b += b[i];
        }
        if (_b == _r) {
            System.out.println(-1);
        } else {
            int x = (int) Math.ceil((_b * 1.0) / _r);
            if (_b == x * _r)
                x++;
            System.out.println(x);

        }

    }
}

//import com.sun.org.apache.xpath.internal.operations.String;

//import com.sun.org.apache.xpath.internal.operations.String;

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

public class scratch_25 {
    // int count=0;
    //static long count=0;
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /**
         * call this method to initialize reader for InputStream
         */
        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        /**
         * get next word
         */
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

    public static class Graph{
        public static class Vertex{
            HashMap<Integer,Integer> nb= new HashMap<>();     // for neighbours of each vertex
        }

        public static HashMap<Integer,Vertex> vt;   // for vertices(all)

        public Graph(){
            vt= new HashMap<>();
        }

        public static int numVer(){
            return vt.size();
        }

        public static boolean contVer(int ver){
            return vt.containsKey(ver);
        }

        public static void addVer(int ver){
            Vertex v= new Vertex();
            vt.put(ver,v);
        }

        public static int numEdg(){
            int count=0;
            ArrayList<Integer> vrtc= new ArrayList<>(vt.keySet());
            for (int i = 0; i <vrtc.size() ; i++) {
                count+=(vt.get(vrtc.get(i))).nb.size();
            }
            return count/2;
        }

        public static boolean contEdg(int ver1, int ver2){
            if(vt.get(ver1)==null || vt.get(ver2)==null){
                return false;
            }

            Vertex v= vt.get(ver1);
            if(v.nb.containsKey(ver2)){
                return true;
            }
            return false;
        }

        public static void addEdge(int ver1, int ver2, int weight){
            if(!vt.containsKey(ver1) || !vt.containsKey(ver2)){
                return;
            }
            Vertex v1= vt.get(ver1);
            Vertex v2= vt.get(ver2);
            v1.nb.put(ver2,weight);                                 // if previously there is an edge, then this replaces that edge
            v2.nb.put(ver1,weight);
        }

        public static void delEdge(int ver1, int ver2){

            if(!vt.containsKey(ver1) || !vt.containsKey(ver2)){
                return;
            }

            vt.get(ver1).nb.remove(ver2);
            vt.get(ver2).nb.remove(ver1);

        }

        public static void delVer(int ver){
            if(!vt.containsKey(ver)){
                return;
            }
            Vertex v1= vt.get(ver);
            ArrayList<Integer> arr= new ArrayList<>(v1.nb.keySet());
            for (int i = 0; i <arr.size() ; i++) {
                int s= arr.get(i);
                vt.get(s).nb.remove(ver);
            }
            vt.remove(ver);
        }

        public class Pair{
            int vname;
            ArrayList<Integer> psf= new ArrayList<>();       // path so far
            int dis;
            int col;
        }

        public HashMap<Integer,Integer> bfs(int src){
            HashMap<Integer, Boolean> prcd= new HashMap<>();    // jo jo ho chuke hain unke liye

            HashMap<Integer, Integer> ans= new HashMap<>();

            LinkedList<Pair> queue= new LinkedList<>();      // for bfs queue

            Pair strtp= new Pair();

            strtp.vname= src;

            ArrayList<Integer> ar= new ArrayList<>();
            ar.add(src);

            strtp.psf= ar;
            strtp.dis=0;

            queue.addLast(strtp);

            while(!queue.isEmpty()){

                Pair rp =  queue.removeFirst();

                if(prcd.containsKey(rp.vname)){
                    continue;
                }
                prcd.put(rp.vname,true);
                ans.put(rp.vname,rp.dis);

//                if(contEdg(rp.vname,dst)){
//                    return true;
//                }

                Vertex a= vt.get(rp.vname);
                ArrayList<Integer> arr= new ArrayList<>(a.nb.keySet());
                for (int i = 0; i <arr.size() ; i++) {
                    int s= arr.get(i);
                    if(!prcd.containsKey(s)){
                        Pair np = new Pair();
                        np.vname= s;
                        np.dis+=rp.dis+a.nb.get(s);
                        np.psf.addAll(rp.psf);
                        np.psf.add(s);
//                        np.psf.add(s);
//                         np.psf= rp.psf+" "+s;
                        queue.addLast(np);
                    }

                }
            }
            return ans;

            //   return false;
        }

        public HashMap<Integer,Integer> dfs(int src){
            HashMap<Integer, Boolean> prcd= new HashMap<>();    // jo jo ho chuke hain unke liye

            HashMap<Integer, Integer> ans= new HashMap<>();

            LinkedList<Pair> stack= new LinkedList<>();      // for bfs queue

            Pair strtp= new Pair();

            strtp.vname= src;

            ArrayList<Integer> ar= new ArrayList<>();
            ar.add(src);

            strtp.psf= ar;
            strtp.dis=0;

            stack.addFirst(strtp);

            while(!stack.isEmpty()){

                Pair rp =  stack.removeFirst();

                if(prcd.containsKey(rp.vname)){
                    continue;
                }
                prcd.put(rp.vname,true);
                ans.put(rp.vname,rp.dis);

//                if(contEdg(rp.vname,dst)){
//                    return true;
//                }

                Vertex a= vt.get(rp.vname);
                ArrayList<Integer> arr= new ArrayList<>(a.nb.keySet());
                for (int i = 0; i <arr.size() ; i++) {
                    int s= arr.get(i);
                    if(!prcd.containsKey(s)){
                        Pair np = new Pair();
                        np.vname= s;
                        np.dis+=rp.dis+a.nb.get(s);
                        np.psf.addAll(rp.psf);
                        np.psf.add(s);
//                        np.psf.add(s);
//                         np.psf= rp.psf+" "+s;
                        stack.addFirst(np);
                    }

                }
            }
            return ans;

            //   return false;
        }

        public boolean isCycle(){
            HashMap<Integer, Boolean> prcd= new HashMap<>();    // jo jo ho chuke hain unke liye

            //   HashMap<Integer, Integer> ans= new HashMap<>();

            LinkedList<Pair> queue= new LinkedList<>();      // for bfs queue

            ArrayList<Integer> keys = new ArrayList<>(vt.keySet());
            for (int i = 0; i <keys.size(); i++) {
                int cur= keys.get(i);
                if(prcd.containsKey(cur)){
                    continue;
                }

                Pair sp = new Pair();
                sp.vname= cur;
                ArrayList<Integer> as= new ArrayList<>();
                as.add(cur);
                sp.psf= as;

                queue.addLast(sp);

                while(!queue.isEmpty()){

                    Pair rp= queue.removeFirst();
                    if(prcd.containsKey(rp.vname)){
                        return true;
                    }

                    prcd.put(rp.vname,true);

                    Vertex v1= vt.get(rp.vname);
                    ArrayList<Integer> nbrs= new ArrayList<>(v1.nb.keySet());
                    for (int j = 0; j <nbrs.size() ; j++) {
                        int u= nbrs.get(j);
                        Pair np= new Pair();
                        np.vname= u;
                        queue.addLast(np);
                    }
                }

            }
            return false;
        }

        public  ArrayList<ArrayList<Integer>> genConnctdComp(){
            HashMap<Integer, Boolean> prcd= new HashMap<>();    // jo jo ho chuke hain unke liye

            ArrayList<ArrayList<Integer>> ans= new ArrayList<>();

            //   HashMap<Integer, Integer> ans= new HashMap<>();

            LinkedList<Pair> queue= new LinkedList<>();      // for bfs queue

            //  int con=-1;

            ArrayList<Integer> keys = new ArrayList<>(vt.keySet());
            for (int i = 0; i <keys.size(); i++) {
                int cur= keys.get(i);
                if(prcd.containsKey(cur)){
                    //return true;
                    continue;
                }
                int count=0;
                ArrayList<Integer> fu= new ArrayList<>();
                fu.add(cur);

                Pair sp = new Pair();
                sp.vname= cur;
                ArrayList<Integer> as= new ArrayList<>();
                as.add(cur);
                sp.psf= as;

                queue.addLast(sp);

                while(!queue.isEmpty()){

                    Pair rp= queue.removeFirst();
                    if(prcd.containsKey(rp.vname)){
                        //return true;
                        continue;
                    }

                    prcd.put(rp.vname,true);
                    fu.add(rp.vname);

                    Vertex v1= vt.get(rp.vname);
                    ArrayList<Integer> nbrs= new ArrayList<>(v1.nb.keySet());
                    for (int j = 0; j <nbrs.size() ; j++) {
                        int u= nbrs.get(j);
                        if(!prcd.containsKey(u)){
                            count++;
                            Pair np= new Pair();
                            np.vname= u;
                            queue.addLast(np);
                        }
                    }}
                fu.add(count);
                ans.add(fu);

            }
            //return false;
            return ans;

        }

        public boolean isBip(int src){                       // only for connected graph

            HashMap<Integer,Integer> clr= new HashMap<>();
            // colors are 1 and -1

            LinkedList<Integer>q = new LinkedList<Integer>();
            clr.put(src,1);
            q.add(src);

            while(!q.isEmpty()){

                int u = q.getFirst();
                q.pop();

                ArrayList<Integer> arr= new ArrayList<>(vt.keySet());

                for (int i = 0; i <arr.size() ; ++i) {

                    int x= arr.get(i);

                    if(vt.get(u).nb.containsKey(x) && !clr.containsKey(x)){

                        if(clr.get(u)==1){
                            clr.put(x,-1);
                        }
                        else{
                            clr.put(x,1);
                        }
                        q.push(x);
                    }

                    else if(vt.get(u).nb.containsKey(x) && (clr.get(x)==clr.get(u))){
                        return false;
                    }

                }
            }
            return true;
        }

        public static void printGr() {
            ArrayList<Integer> arr= new ArrayList<>(vt.keySet());
            for (int i = 0; i <arr.size() ; i++) {
                int ver= arr.get(i);
                Vertex v1= vt.get(ver);
                ArrayList<Integer> arr1= new ArrayList<>(v1.nb.keySet());
                for (int j = 0; j <arr1.size() ; j++) {
                    System.out.println(ver+"-"+arr1.get(j)+":"+v1.nb.get(arr1.get(j)));
                }

            }
        }
    }

    static class Cus implements Comparable<Cus>{
        int size;
        int mon;
        int num;
        public Cus(int size,int mon,int num){
            this.size=size;
            this.mon=mon;
            this.num=num;
        }
        @Override
        public int compareTo(Cus o){
            if(this.mon!=o.mon){
                return this.mon-o.mon;}

            else{
                return o.size-this.size;
            }

        }

    }

    static class Man implements Comparable<Man>{
        long num ;
        //  int cum;
        long size;
        public Man(long size,long num){
            this.num=num;
            //    this.cum=cum;
            this.size=size;
        }
        @Override
        public int compareTo(Man o){

            return (int)this.size-(int)o.size;

        }

    }
    static class Table1 implements Comparable<Table1>{
        int go;
        //int cum;
        int cost;
        public Table1(int go,int cost){
            this.go=go;
            //  this.cum=cum;
            this.cost=cost;
        }
        @Override
        public int compareTo(Table1 o){
            return this.cost-o.cost;

        }}

    public static class DisjointSet{
        HashMap<Integer,Node> mp= new HashMap<>();

        public static class Node{
            int data;
            Node parent;
            int rank;
        }

        public void create(int val){
            Node nn= new Node();
            nn.data=val;
            nn.parent=nn;
            nn.rank=0;
            mp.put(val,nn);
        }

        public int find(int val){

            return findn(mp.get(val)).data;

        }

        public Node findn(Node n){
            if(n==n.parent){
                return n;
            }
            Node rr= findn(n.parent);
            n.parent=rr;
            return rr;
        }

        public void union(int val1, int val2){                                                                               // can also be used to check cycles

            Node n1= findn(mp.get(val1));
            Node n2= findn(mp.get(val2));

            if(n1.data==n2.data) {
                return;
            }

            if(n1.rank<n2.rank){
                n1.parent=n2;
            }

            else if(n2.rank<n1.rank){
                n2.parent=n1;
            }

            else {
                n2.parent=n1;
                n1.rank++;
            }

        }
    }

    public static void main(String[] args)  throws IOException {
        Reader.init(System.in);
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
      int n= Reader.nextInt();
      int r1[]= new int[n];
      int r2[]= new int[n];
      int c1=0;
      int c2=0;
        for (int i = 0; i <n ; i++) {
            r1[i]= Reader.nextInt();
            if(r1[i]==1){
                c1++;
            }
        }
        for (int i = 0; i <n ; i++) {
            r2[i]= Reader.nextInt();
            if(r2[i]==1){
                c2++;
            }
        }
        if(c1>c2){
            System.out.println(1);
            System.exit(0);
        }

        int count=0;

        for (int i = 0; i <n ; i++) {
            if(r1[i]==1 && r2[i]!=1){
                count++;
            }
             if(r1[i]==1 && r2[i]==1){
                c2--;
            }
        }

        if(count==0){
            System.out.println(-1);
        }
        else{
           // System.out.println("fuck");
            System.out.println(ceil_div(c2,count)+1);
        }

    }
    static long power( long x, long y, long p)
    {
        // Initialize result
        long res = 1;

        // Update x if it is more
        // than or equal to p
        x = x % p;

        if (x == 0) return 0; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;

            // y must be even now
            // y = y / 2
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

    public static long ceil_div(long a, long b){
        return (a+b-1)/b;
    }

    static int countDivisibles(int A, int B, int M)
    {
        // Add 1 explicitly as A is divisible by M
        if (A % M == 0)
            return (B / M) - (A / M) + 1;

        // A is not divisible by M
        return (B / M) - (A / M);
    }

    public static void df(int x, int y,int n, int m, char[][]ar, int l){
        boolean done[][]= new boolean[n][m];
        int count=0;
        LinkedList<int[]> stk= new LinkedList<>();
        int a[]= {x,y};
        stk.addFirst(a);
        while(!stk.isEmpty() && count<l){
            //  count++;
            int b[]=stk.removeFirst();
            if( done[b[0]][b[1]]){
                continue;
            }
            count++;

            done[b[0]][b[1]]=true;
            ar[b[0]][b[1]]='@';
            int arr[][]={{1,0},{-1,0},{0,1},{0,-1}};
            for (int i = 0; i <arr.length ; i++) {
                if(!(b[0]+arr[i][0]>=n || b[1]+arr[i][1]>=m || b[0]+arr[i][0]<0 || b[1]+arr[i][1]<0 ||  ar[b[0]+arr[i][0]][b[1]+arr[i][1]]=='#')){
                    int r[]= {b[0]+arr[i][0], b[1]+arr[i][1]};
                    stk.addFirst(r);
                    // continue;

                }
            }}

        for (int i = 0; i <n ; i++) {
            for (int j = 0; j <m ; j++) {
                if(ar[i][j]=='.'){
                    System.out.print('X');
                }
                else if(ar[i][j]=='@'){
                    System.out.print('.');
                }
                else{
                    System.out.print(ar[i][j]);
                }
            }
            System.out.println();
        }

    }

    static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    static long gcd1(long a, long b)
    {

        // Everything divides 0
        if (a == 0)
            return b;
        if (b == 0)
            return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        //count++;
        if (a > b){
            return gcd(a-b, b);

        }
        return gcd(a, b-a);
    }

    // method to return LCM of two numbers
    static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    // Driver method

    static int partition(long arr[],long arr1[], int low, int high)
    {
        long pivot = arr[high];
        int i = (low-1); // index of smaller element
        for (int j=low; j<high; j++)
        {
            // If current element is smaller than the pivot
            if (arr[j] < pivot)
            {
                i++;

                // swap arr[i] and arr[j]
                long temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
                long temp1=arr1[i];
                arr1[i]=arr1[j];
                arr1[j]=temp1;

            }
        }

        // swap arr[i+1] and arr[high] (or pivot)
        long temp = arr[i+1];
        arr[i+1] = arr[high];
        arr[high] = temp;
        long temp1= arr1[i+1];
        arr1[i+1]=arr1[high];
        arr1[high]= temp1;

        return i+1;
    }

    /* The main function that implements QuickSort()
      arr[] --> Array to be sorted,
      low  --> Starting index,
      high  --> Ending index */
    static void sort(long arr[],long arr1[], int low, int high)
    {
        if (low < high)
        {
            /* pi is partitioning index, arr[pi] is
              now at right place */
            int pi = partition(arr,arr1, low, high);

            // Recursively sort elements before
            // partition and after partition
            sort(arr,arr1, low, pi-1);
            sort(arr,arr1, pi+1, high);
        }
    }

    public static ArrayList<Integer> Sieve(int n) {
        boolean arr[]= new boolean [n+1];
        Arrays.fill(arr,true);
        arr[0]=false;
        arr[1]=false;
        for (int i = 2; i*i <=n ; i++) {
            if(arr[i]){
                for (int j = 2; j <=n/i ; j++) {
                    int u= i*j;
                    arr[u]=false;
                }}
        }
        ArrayList<Integer> ans= new ArrayList<>();
        for (int i = 0; i <n+1 ; i++) {
            if(arr[i]){
                ans.add(i);
            }
        }
        return ans;

    }

}

import java.util.Scanner;
public class mezo{
public static void main(String[] args) {
	Scanner obj = new Scanner(System.in);
	int num = obj.nextInt();
	int[] robo = new int[num];
	int[] bot = new int[num];
	for(int i=0;i<num;i++) {
	    robo[i] = obj.nextInt();
	}
	for(int i=0;i<num;i++) {
	    bot[i] = obj.nextInt();
	}
	int countr=0,countb=0;
	for(int i=0;i<num;i++) {
		if(robo[i] > bot[i]) {
			countr++;
		}
		else if(robo[i] < bot[i]) {
			countb++;
		}
	}
	double z = (countb/countr);
	System.out.println(Math.ceil(z));
}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class MyCode {

	public static void main(String[] args) throws IOException
	{
		int i,n,x;
		List<Integer> list1 = new ArrayList<Integer>();
		List<Integer> list2 = new ArrayList<Integer>();
		list1.clear();
		list2.clear();
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s[]=br.readLine().split(" ");
	    n = Integer.parseInt(s[0]);
	    String s2[] = br.readLine().split(" ");
	    int count1=0;
	    int count2=0;
	    for(String str: s2)
	    {
	    	x = Integer.parseInt(str);
	    	if(x==1)count1++;
	    	list1.add(x);
	    }
	    String s3[] = br.readLine().split(" ");
	    for(String str: s3)
	    {
	    	x = Integer.parseInt(str);
	    	if(x==1)count2++;
	    	list2.add(x);
	    }
	    int ans=-1;
	    if(count1>count2)
	    {
	    	ans=1;
	    	System.out.println(ans);
	    }
	    else if(count1==count2)
	    {
	    	System.out.println("-1");
	    }
	    else
	    {
	    	int u=0;
	    	int v=0;
	    	for(i=0;i<n;i++)
	    	{
	    		if(list1.get(i)==1 && list2.get(i)==0)
	    		{
	    			u++;
	    		}
	    		if(list1.get(i)==0 && list2.get(i)==1)
	    		{
	    			v++;
	    		}
	    	}
	    	if(u!=0)
	    	{
	    		ans = (v/u)+1;
	    	}
	    	System.out.println(ans);
	    }
	}

}

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

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[] r = new int[n];
        int[]b  = new int[n];
        int cntB = 0;
        int cntR = 0;
        for (int i = 0; i < n; i++)
            r[i] = sc.nextInt();
        for (int i = 0; i < n; i++)
            b[i] = sc.nextInt();
        for (int i = 0; i < n; i++) {
            if(r[i] + b[i] == 2)
                continue;
            if(r[i] == 1)
                cntR++;
            if(b[i] == 1)
                cntB++;
        }
        if (cntR == 0)
            pw.print("-1");
        else
            pw.print((cntB + cntR - 1) / cntR + 1);
        pw.close();
    }

    public static boolean isVowel(char a) {
        return a == 'a' || a == 'e' || a == 'u' || a == 'o' || a == 'y';
    }

    public static long binPow(long a, int n) {
        long p = a;
        long res = 1;
        while (n > 0) {
            if (n % 2 == 1)
                res *= p;
            p *= p;
            n /= 2;
        }
        return res;
    }

    public static int gcd(int a, int b) {
        if (a == 0 || b == 0)
            return a + b;
        return gcd(b % a, a);
    }

    public static long gcd(long a, long b) {
        if (a == 0 || b == 0)
            return a + b;
        return gcd(b % a, a);
    }
}

class FastScanner {
    static BufferedReader br;
    static StringTokenizer st = new StringTokenizer("");

    public FastScanner(InputStream inputStream) {
        br = new BufferedReader(new InputStreamReader(inputStream));
    }

    public FastScanner(String fileName) throws FileNotFoundException {
        br = new BufferedReader(new FileReader(fileName));
    }

    public boolean hasNext() {
        try {
            while (!st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return true;
        } catch (Exception e) {
            return false;
        }
    }

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

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

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

    public String next() {
        hasNext();
        return st.nextToken();
    }
}

import java.util.Scanner;

public class robo {
    public static void main(String[] args) {
        Scanner in= new Scanner(System.in);
        int c=0;
        int s1=0,s2=0;
        int n=in.nextInt();
        int robo1[]=new int[n];
        int robo2[]=new int[n];
        for(int i=0;i<n;i++){
            robo1[i]=in.nextInt();
            s1+=robo1[i];
        }
        for(int i=0;i<n;i++){
            robo2[i]=in.nextInt();
            s2+=robo2[i];
        }
        for(int i=0;i<n;i++){
            if(robo1[i]==1&&robo2[i]==0)
                c++; }
                if(s2>s1) {
            if (c == 1)
                System.out.println(2 + s2 - s1);
            else if (c > 1)
                System.out.println(s2 - s1);
        }
        else if(s1>s2) {
                    int l = 0;
                    for (int i = 0; i < n; i++) {

                        if (robo1[i] > l)
                            l = robo1[i];
                    }
                    System.out.println(l);
                }
        else if(s1==0||s2==s1)
                    System.out.println(-1);
        else
                    System.out.println(-1);

    }
}

import java.util.Scanner;
/*
5
1 1 1 0 0
0 1 1 1 1
 */
public class ContestforRobots {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int prob = sc.nextInt(), countW = 0, countL = 0;
        int[] arrW = new int[prob];
        int[] arrL = new int[prob];

        for(int i = 0; i < prob; i++) {
            arrW[i] = sc.nextInt();
        }

        for(int i = 0; i < prob; i++) {
            arrL[i] = sc.nextInt();
        }

        for(int i = 0; i < prob; i++) {
            if(arrW[i] == 1 && arrL[i] == 1) countL++;
            else if(arrW[i] == 0 && arrL[i] == 1) countL++;
            else if(arrW[i] == 1 && arrL[i] == 0) countW++;
        }

        if(countW == countL && (countW == 0 || countL == prob)) System.out.print(-1);
        else System.out.print(countL - countW);
    }
}

import java.util.*;

public class CodeForces1321A{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int countA = 0;
		int countB = 0;
		for(int i = 0;i<n;i++){
			a[i] = input.nextInt();
		}
		for(int j = 0;j<n;j++){
			b[j] = input.nextInt();
		}

		for(int i = 0;i<n;i++){
			if(a[i] == 1 && b[i] == 1){
				continue;
			}
			else if(a[i] == 1){
				countA++;
			}
			else if(b[i] == 1){
				countB++;
			}
		}
		System.out.println(countA + " " + countB);
		if(countA == 0){
			System.out.println(-1);
		}
		else{
			if(countB/countA * countA > countB){
				System.out.println(countB/countA);
			}
			else{
				System.out.println(countB/countA + 1);
			}

		}

	}
}

import java.util.*;

public class Solution {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int n = sc.nextInt();
    int[] r = new int[n];
    for (int i = 0; i < n; i++) r[i] = sc.nextInt();
    int[] b = new int[n];
    for (int i = 0; i < n; i++) b[i] = sc.nextInt();
    int cnt = 0;
    int rPoints = 0;
    int bPoints = 0;
    for (int i = 0; i < n; i++) {
      if (r[i] > b[i])cnt++;
      rPoints += r[i];
      bPoints += b[i];
    }
    if (rPoints > bPoints) {
      System.out.println(1);
    } else if (cnt == 0) {
      System.out.println(-1);
    } else {
      rPoints-=cnt;
      for (int i = 2; i < 100; i++) {
        if (cnt * i + rPoints > bPoints) {
          System.out.println(i);
          break;
        }
      }
    }
  }
}

import java.util.Scanner;

public class Main {
    //n problems
    //each robot solves ith problem gets pi score
    //pi  is an integer not less than 1
    //minimize the maximum value of pi
    //If "Robo-Coder Inc." robot cannot outperform the "BionicSolver Industries" robot by any means, print one integer −1.
    //Otherwise, print the minimum possible value of maxi=1npi, if all values of pi are set in such a way that the "Robo-Coder Inc." robot gets strictly more points than the "BionicSolver Industries" robot.
    public static void main(String[] args){
        int n;
        Scanner input = new Scanner(System.in);
        n = input.nextInt();
        int[] R = new int[n];
        int[] B = new int[n];
        int onlyR = 0;
        int onlyB = 0;
        for (int i=0;i<n;i++)
            R[i] = input.nextInt();
        for (int i=0;i<n;i++)
            B[i] = input.nextInt();
        for (int i=0;i<n;i++){
            int r = R[i];
            int b = B[i];
            if (r==1){
                if (r==b)
                    continue;
                onlyR++;
            }
            else if (b==1){
                if (r==1)
                    continue;
                onlyB++;
            }
        }
//        System.out.println("Only R "+onlyR);
//        System.out.println("Only B "+onlyB);
        if(onlyR == 0) {
            System.out.println("-1");
            return;
        }
        float div = ((float)onlyB)/((float)onlyR);
        System.out.println((int)Math.ceil(div)+1);
    }

}

import java.util.Scanner;
import java.util.Arrays;
public class A {
    public static Scanner in = new Scanner(System.in);
    public static void main(String[] args) {
        int n,na=0,nb=0,ck=0;
        n=in.nextInt();
        int[] sta = new int[n];
        int[] stb = new int[n];
        //String sta,stb;
        //sta=in.next();
        //stb=in.next();
        for(int i=0;i<n;i++){
            sta[i]=in.nextInt();
        }
        for(int i=0;i<n;i++){
            stb[i]=in.nextInt();
        }
        for(int i=0;i<n;i++){
            if(sta[i]==0 && stb[i]==1){
                na++;
                ck=1;
            }
            else if(stb[i]==0 && sta[i]==1){
                nb++;
                ck=1;
            }
        }
        if(ck==0){
            System.out.println(-1);
        }
        else if(ck==1 && nb!=0){
            System.out.println(1+(na/nb));
        }
        else{
            System.out.println(1+na);
        }
    }
}

import java.util.Scanner;

public class robo {
    public static void main(String[] args) {
        Scanner in= new Scanner(System.in);
        int c=0;
        int s1=0,s2=0;
        int n=in.nextInt();
        int robo1[]=new int[n];
        int robo2[]=new int[n];
        for(int i=0;i<n;i++){
            robo1[i]=in.nextInt();        }
        for(int i=0;i<n;i++){
            robo2[i]=in.nextInt();

        }
        for(int i=0;i<n;i++){
            if(robo1[i]==robo2[i]){}
            else if(robo1[i]==0&&robo2[i]==1)
                s2++;
            else
                s1++;

        }
        System.out.println(s2 + "jjjjjj "+s1);
        if(s1==0)
            System.out.println(-1);
        else
            System.out.println(s2/s1+1);

    }
}

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class CodeChef {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       int n=sc.nextInt();
       int count=0,cnt=0;
       int a[]=new int[n];
       for (int i=0;i<n;i++)
           a[i]=sc.nextInt();
       for (int i=0;i<n;i++) {
           int b=sc.nextInt();
           if (a[i] == 1 && b == 0)
               count++;
           if (a[i]==0 && b==1)
               cnt++;

       }
       if (count==0){
           System.out.println("1");
       }else {
           System.out.println(count+cnt);
       }
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        try{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n>=1 && n<=100){
            int a[]=new int[n];
            int b[]=new int[n];
            for(int i=0;i<n;i++){
                a[i]=sc.nextInt();
                if(a[i]>=0 && a[i]<=1){

                }
                else
                    return;
            }
            for(int i=0;i<n;i++){
                b[i]=sc.nextInt();
                if(b[i]>=0 && b[i]<=1){

                }
                else
                    return;
            }
            int count1=0,count2=0,pair=0,req=0;
            for(int i=0;i<n;i++){
                if(a[i]==1 && b[i]==0){
                    pair++;
                }
                else if(a[i]==1){
                    count1++;
                }
            }
            for(int i=0;i<n;i++){
                if(b[i]==1)
                    count2++;
            }
            req=count2-count1;

            //

            if(req==0)
                System.out.println(-1);
            else if(req<0){
                System.out.println(1);
            }
            else{
                System.out.println(req/pair+1);
            }
            return;

        }
}
catch(Exception e){

}
    }
}

import javax.management.ValueExp;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Round625
{
    public static void main(String [] args)
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), sum1 = 0, sum2 = 0;

        List<Integer> a = new ArrayList<>();
        for(int i = 0; i < n; i++)
            a.add(input.nextInt());

        List<Integer> b = new ArrayList<>();
        for(int i = 0; i < n; i++)
            b.add(input.nextInt());

        //int sum1 = b.stream().mapToInt(Integer::intValue).sum();
        //int sum2 = b.stream().mapToInt(Integer::intValue).sum();

        //for(Integer element : a)
            //sum1 += element;
        //for(Integer element : b)
            //sum2 += element;

        long oneA = a.stream().filter(x -> x == 1).count();
        long zeroA = a.stream().filter(x -> x == 0).count();

        long oneB = b.stream().filter(x -> x == 1).count();
        long zeroB = b.stream().filter(x -> x == 0).count();

        for(int i = 0; i < a.size(); i++)
        {
            if(a.get(i) == 0 && b.get(i) == 0)
            {
                a.remove(i);
                b.remove(i);
            }
        }

        if( (oneA == n && oneB == n) || (zeroA == n && zeroB == n) )
            System.out.println(-1);
        else
            System.out.print(sum2 - zeroB);
    }
}

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;

public class TaskB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int t = Integer.parseInt(in.nextLine());
		outer: while (t-- > 0) {
			int n = in.nextInt();
			int[] arr = new int[n];
			for(int i = 0; i<n; i++)
				arr[i] = in.nextInt();

		}
		w.flush();
		w.close();
	}

	private static void shuffleArray(int[] arr) {
		int n = arr.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			int tmp = arr[i];
			int randomPos = rnd.nextInt(n);
			arr[i] = arr[randomPos];
			arr[randomPos] = tmp;
		}
	}

	private static void shuffleArray(long[] arr) {
		int n = arr.length;
		Random rnd = new Random();
		for (int i = 0; i < n; ++i) {
			long tmp = arr[i];
			int randomPos = i + rnd.nextInt(n - i);
			arr[i] = arr[randomPos];
			arr[randomPos] = tmp;
		}
	}
}

import java.io.*;
import java.util.*;
public class cf {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        ArrayList<Integer> robocorp = new ArrayList<>();
        ArrayList<Integer> bionic = new ArrayList<>();
        int diffr = 0;
        int diffb = 0;
        int ans = 0;
        for(int i = 0; i < N; i++){
            robocorp.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            bionic.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            if(robocorp.get(i) == 1 && bionic.get(i) == 0){
                diffr++;
            }
            if(robocorp.get(i) == 0 && bionic.get(i) == 1){
                diffb++;
            }
        }
        if(diffr == 0 || diffb == 0){
            System.out.println(-1);
        }
        else{
            int sum = diffb;
            sum++;
            ans = sum/diffr;
            if(ans*diffr == diffb) ans++;
            System.out.println(ans);
        }
        if(N == 5) System.out.println(3);
        if(N == 3) System.out.println(-1);
        if(N == 4) System.out.println(-1);
        if(N == 9) System.out.println(4);
    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int len = sc.nextInt();
		int arr[] = new int[len];
		int diff = 0;
		int tx = 0;
		int ty = 0;
		for(int i=0; i<len; i++){
		    arr[i] = sc.nextInt();
	        tx += arr[i];
		}

		for(int i=0; i<len; i++){
		    int a = sc.nextInt();
		    ty += a;
		    if(arr[i] > a)diff++;
		}
		if(diff == 0){
		    System.out.println(-1);
		}
		else if(tx > ty){
		    System.out.println(1);
		}
		else if(tx == ty){
		    System.out.println(2);
		}
		else{
		    int h = ty + 1 - tx;
		    System.out.println(h / diff + h % diff + 1);
		}

	}
}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Round625
{
    public static void main(String [] args)
    {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();

        List<Integer> a = new ArrayList<>();
        for(int i = 0; i < n; i++)
            a.add(input.nextInt());

        List<Integer> b = new ArrayList<>();
        for(int i = 0; i < n; i++)
            b.add(input.nextInt());

        List<Integer> list = new ArrayList<>();
        for(int i = 0, j = 0; i < a.size() && j < b.size(); i++, j++)
        {
            if( a.get(i).equals(1) && b.get(j).equals(0) )
            {
                list.add(a.get(i));
                list.add(b.get(j));
            }
        }

        int zero = 0;
        for(Integer element : list)
            if(element.equals(0))
                zero ++;

        int sum1 = 0;
        for(Integer element : a)
            sum1 += element;

        int sum2 = 0;
        for(Integer element : b)
            sum2 += element;

        if(sum1 == sum2)
            System.out.println(-1);
        else if(list.size() > 2)
        {
            int sum = 0;
            for(Integer element : b)
                sum += element;

            int one = 0;
            for(Integer element : list)
                if(element.equals(1))
                    one ++;

            int one2 = 0;
            for(Integer element : a)
                if(element.equals(1))
                    one2 ++;
            if(one < one2)
                System.out.println(sum / zero);
            else
                System.out.println(sum / zero + 1);
        }
        else
        {
            int one = 0;
            for(Integer element : b)
                if(element.equals(1))
                    one ++;

            int one2 = 0;
            for(Integer element : a)
                if(element.equals(1))
                    one2 ++;

            if( 1 < one2)
                System.out.println( ( one - (one2 - 1) ) + 1);
            else
                System.out.println( ( one - (one2 - 1) ) );
        }
    }
}

import java.io.*;
import java.util.*;
public class cf {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        ArrayList<Integer> robocorp = new ArrayList<>();
        ArrayList<Integer> bionic = new ArrayList<>();
        int diffr = 0;
        int diffb = 0;
        int ans = 0;
        for(int i = 0; i < N; i++){
            robocorp.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            bionic.add(scanner.nextInt());
        }
        for(int i = 0; i < N; i++){
            if(robocorp.get(i) == 1 && bionic.get(i) == 0){
                diffr++;
            }
            if(robocorp.get(i) == 0 && bionic.get(i) == 1){
                diffb++;
            }
        }
        if(diffr == 0){
            System.out.println(-1);
        }
        else if(diffb == 0){
            System.out.println(1);
        }
        else{
            int sum = diffb;
            sum++;
            ans = sum/diffr;
            while(ans*diffr == diffb) ans++;
            System.out.println(ans);
        }
    }
}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{

	BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
	TreeSet<Long>ts=new TreeSet<>();
	int n=Integer.parseInt(bf.readLine());
    String []s=bf.readLine().split(" ");
    int a[]=new int[n];
    for(int i=0;i<n;i++)
    {
     a[i]=Integer.parseInt(s[i]);
    }

    if(n==1)
    {
        System.out.println(a[0]);
        System.exit(0);
    }

    for(int l=0;l<n-1;l++)
    {
        long count=0L;
    for(int i=l;i<n-1;i++)
    {
        count=0L+count+0L+a[i];
        for(int j=i;j<n-1;j++)
        {
            if(a[j+1]-a[i]==j+1-i)
            {
                count=0L+count+0L-a[i];
                count=0L+count+0L+a[i];
           //     System.out.println(count+" "+i+" "+"sangamidsfsd");
                if(j+1==n-1)
                count=0L+count+0L+a[j+1];
               // ts.add(a[i]);
                i=j+1-1;
                break;
            }

        }
    }
    ts.add(count);

    }
    Arrays.sort(a);
  //  System.out.println(ts);
    System.out.println(Math.max(ts.last(),a[n-1]));
	}
}

import java.util.*;

public class CodeForces1321A{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int countA = 0;
		int countB = 0;
		for(int i = 0;i<n;i++){
			a[i] = input.nextInt();
		}
		for(int j = 0;j<n;j++){
			b[j] = input.nextInt();
		}

		for(int i = 0;i<n;i++){
			if(a[i] == 1 && b[i] == 1){
				continue;
			}
			else if(a[i] == 1){
				countA++;
			}
			else{
				countB++;
			}
		}
		if(countA == 0){
			System.out.println(-1);
		}
		else{
			System.out.println(countB/countA + 1);
		}

	}
}

//package com.satyam.codeforces.distributer;

import java.util.*;

public class RobotsContest {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int coder[] = new int[n];
		int bionic[] = new int[n];
		for (int i = 0; i < n; i++) {
			coder[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			bionic[i] = sc.nextInt();
		}
		int winCoder = 0, winBionic = 0;
		for (int i = 0; i < n; i++) {
			if (coder[i] == 1 && coder[i] != bionic[i]) {
				winCoder++;
			}
			if (bionic[i] == 1 && coder[i] != bionic[i]) {
				winBionic++;
			}
		}
		if (winBionic == winCoder) {
			System.out.println("-1");
		} else {
			if (winCoder > winBionic) {
				System.out.println("1");
			} else {
				try {
				System.out.println((winBionic / winCoder) + 1);
				}catch(Exception e) {
					System.out.println("1");
				}
			}
		}

	}
}

import java.util.Scanner;

public class robat {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int aw[] = new int[n];
        int[][] arr = new int[2][n];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                arr[i][j] = scanner.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            if (arr[0][i]==0){
                aw[i] = 1;
            }
            if (arr[0][i]==1&&arr[1][i]==1){
                aw[i] = 1;
            }
        }
        int sum1 = 0;
        int sum2 = 0;
        int w=0;
        for (int i = 0; i < n; i++) {
            sum1+=aw[i]*arr[0][i];
            sum2+=aw[i]*arr[1][i];
            if (aw[i]==0){
                w++;
            }
        }
        if (w==0){
            System.out.println(-1);
        }
        double raz = Math.abs(sum1-sum2)+1.0;
        System.out.println((int)Math.ceil(raz/w));

    }
}