/*	/ ﾌﾌ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム
	/ )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  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(char arr[],int l,int r){
    	while(l<r) {
    		char 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(int arr[][]) {
    	for(int 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=1;
    	//test=sc.nextInt();
    	while(test-->0){
    		long n=sc.nextLong();
    		if(n%2==0) {
    			out.println("white");
    			out.println("1 2");
    		}
    		else out.println("black");
    	}
        out.flush();
        out.close();
    }
}


import java.util.Scanner;
public class TheatreSquare {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a=sc.nextLong();
        long b=sc.nextLong();
        long c=sc.nextLong();
        if(a%c==0){a=a/c;}else{a=a/c+1;}
        if(b%c==0){b=b/c;}else{b=b/c+1;}
        System.out.println(a*b);
    }
}


import java.util.Scanner;

public class F {
  static Scanner sc = new Scanner(System.in);
  static final double logE = Math.log(Math.E);

  public static void main(String[] args) {
    int V = sc.nextInt();
    double[] factLog = new double[1500001];
    for (int i = 1; i < factLog.length; i++) {
      factLog[i] = Math.log(i) + factLog[i - 1];
    }
    for (int i = 0; i < V; i++) {
      int[] K = new int[250];
      int min = 0;
      int max = 0;
      long sum = 0;
      long sum2 = 0;
      for (int j = 0; j < K.length; j++) {
        K[j] = sc.nextInt();
        min = Math.min(min, K[j]);
        max = Math.max(max, K[j]);
        sum += K[j];
        sum2 += K[j] * K[j];
      }
      double ave = 1.0 * sum / K.length;
      double ave2 = 1.0 * sum2 / K.length;
      double var = ave2 - ave * ave;
      System.err.println("var:" + var);
      double uniform = -Math.log(2 * Math.max(1, Math.max(-min, max)) + 1) * K.length;
      double poisson = -Double.MAX_VALUE;
      for (int j = Math.max(1, Math.max(-min, (int) var - 100)); j <= Math.min(2000, (int) var + 300); j++) {
        double likelyhood = 0;
        for (int k = 0; k < K.length; k++) {
          likelyhood += (K[k] + j) * Math.log(j) - j * logE - factLog[K[k] + j];
        }
        if (likelyhood > poisson) {
          poisson = likelyhood;
        }
      }
      System.err.println(uniform + " " + poisson);
      System.out.println(uniform < poisson ? "poisson" : "uniform");
    }
  }

}


//package practice;

import java.util.Scanner;

/**
 * Created by yi on 2015/10/29.
 */
public class Coloring {
    public static int mod = 1000000007;
    static long fac[];
    static long rev[];
    static long dp[];

    static long pow_mod(long a, int i, long n) {
        if (i == 0) return 1 % n;
        long temp = pow_mod(a, i >> 1, n);
        temp = temp * temp % n;
        if ((i & 1) == 1) temp = temp * a % n;
        return temp;

    }

    static void init() {
        fac = new long[1000005];
        rev = new long[1000005];
        dp = new long[1005];
        fac[0] = 1;
        fac[1] = 1;
        rev[0] = 1;
        for (int i = 1; i <= 1000000; i++) {
            fac[i] = fac[i - 1] * i % mod;
        rev[i] = pow_mod(fac[i], mod - 2, mod);
        }
    }

    static long C(int n, int m) {
        return (fac[n] * rev[m] % mod) * rev[n - m] % mod;
    }

    public static void main(String[] args) {
        init();
        int n, m, k;
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        m = scanner.nextInt();
        k = scanner.nextInt();
        if (m == 1) {
            System.out.println(pow_mod(k, n, mod));
            return;
        }

        for (int i = 1; i <= n && i <= k; i++) {
            dp[i] = pow_mod(i, n, mod);
            for (int j = 1; j < i; j++) {
                dp[i] = (dp[i] - C(i, j) * dp[j] % mod) + mod;
                dp[i] %= mod;
            }
        }

        long ans = 0;
        if (m == 2) {
            for (int i = 1; i <= n && i <= k; i++) {
                ans = (ans + (((dp[i] * dp[i] % mod) * C(k, i) % mod) * C(k, i)) % mod) % mod;
            }
            System.out.println(ans);
        } else {
            for (int i = 1; i <= n && i <= k; i++) {
                for (int j = 0; 2 * j + i <= k && i + j <= n; j++) {
                    long tmp = dp[i + j] * dp[i + j] % mod;
                    tmp = ((tmp * C(k, i) % mod) * C(k - i, j) % mod) * C(k - i - j, j) % mod;
//                    System.out.println(""+k+" "+i+" "+C(k,i));
                    tmp = (tmp * pow_mod(i, n * (m - 2), mod)) % mod;
                    ans = (ans + tmp) % mod;
                }
            }
            System.out.println(ans);
        }
    }

}


import java.lang.Math;
import java.util.Scanner;
public class Java_codeforce_A_Forgetting_Things {
    private static final Scanner SCANNER=new Scanner(System.in);
    public static void main(String[]args){

        int da=SCANNER.nextInt();
        int db=SCANNER.nextInt();

        check(da,db);

        calculate(da,db);

        SCANNER.close();
    }
    private static void check(int da,int db)
    {
        if((da<1||da>9||(db<1||db>9)))
        {
            System.exit(-1);
        }
    }
    private static void calculate(int da,int db)
    {
        int a=0,b;
        b=a+1;

        if(db-da==1)
        {
            b=(int)(db*100);
            a=b-1;
            System.out.println(a+" "+b);
        }
        else if((da-db>1||da-db<-1)&&(da!=9||db!=1))
        {
            System.out.println("-1");
        }
        else if(da-db==1)
        {
            System.out.println("-1");
        }
        else if(da-db==-1)
        {
            System.out.println(da+" "+db);
        }
        else if(da==9&&db==1)
        {
            System.out.println(da+" "+db*10);
        }
        else if(da==db)
            {
                a=da*100;
                b=a+1;
                System.out.println(a+" "+b);
            }
    }

}


import java.util.Scanner;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scanner=new Scanner(System.in);
        int lemon = scanner.nextInt();
        int apple = scanner.nextInt();
        int pear = scanner.nextInt();

         int result=0;

        for(int i=lemon;i>0;i--){
             if(2*i<=apple&&4*i<=pear){
                result=i+(2*i)+(4*i);
                System.out.println(result+"");
                return;
            }else if(i==1){
                 System.out.println(result+"");
            }

        }

    }

}


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

public class Pangram520A {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int length = Integer.parseInt(br.readLine());
		String thisLine = br.readLine();
		thisLine=thisLine.toLowerCase();
		String check="";
		if (length >= 26)
			for (int i = 0; i < length; i++) {
				if (!check.contains(thisLine.charAt(i) + "")) {
					check += thisLine.charAt(i);
				}
			}
		if (check.length() < 26)
			System.out.println("NO");
		else
			System.out.println("YES");
	}
}


import java.util.Scanner;

public class StonesOnTheTable {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        in.nextLine(); // skip the \n character
        String s = in.nextLine();
        int result = 0;
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i) == s.charAt(i-1)) result++;
        }
        System.out.println(result);
    }

}


import java.util.Scanner;

public class P3 {
	public static void calcula(int limite, int[] lista) {

	    int n = 2;

	    while (n < limite) {
	        int num = n*2;
	        while (num < limite) {
	            lista[num] = n;
	            num += n;
	        }
	        num = n + 1;
	        while (num<limite) {
	            if(lista[num] != 0){
	               num++;
	            }
	            else{
	                break;
	            }

	        }
	        n = num;
	    }
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int xi, xm, xf;
		int limite = 1000006;
		int[] lista = new int[limite];

		calcula(limite,lista);

		xm = in.nextInt();
		int a = 0, b = 0;
        b = lista[xm];
        xi = 99999999;
        for (int i= xm-b+1;i<=xm;i++) {
            a = lista[i];
            xi = Math.min(i-a+1, xi);
        }
        System.out.println(xi);

	}

	}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Hehe {
	int H, W, K;
	IO io = new IO();

	void begin() {
		H = io.nextInt();
		W = io.nextInt();
		K = io.nextInt();

		long result = 0;
		for(int i=0; i<K; i++) {
			result += 2*(H+W)-4;
			H-=4;
			W-=4;
		}

		io.out("%d\n", result);
		io.done();
	}

	public static void main(String[] args) {
		(new Hehe()).begin();
	}

	static class IO {
		BufferedReader reader;
		StringTokenizer tokenizer;
		BufferedWriter writer;
		boolean isAutoFlush;

		public IO() {
			this(false, null, null);
		}

		public IO(boolean isAutoFlush, String fileFrom, String fileTo) {
			if(fileFrom == null) {
				reader = new BufferedReader(new InputStreamReader(System.in));
			} else {
				try {
					reader = new BufferedReader(new FileReader(new File(fileFrom)));
				} catch(IOException e) {
					throw new RuntimeException(e);
				}
			}

			if(fileTo == null) {
				writer = new BufferedWriter(new OutputStreamWriter(System.out));
			} else {
				try {
					writer = new BufferedWriter(new FileWriter(new File(fileTo)));
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}

			tokenizer = new StringTokenizer("");
		}

		private String next() {
			while (!tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) { //EOF
					e.printStackTrace();
				}
			}
			return tokenizer.nextToken();
		}

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

		public void out(String format, Object... args) {
			try {
				String string = String.format(format, args);
				writer.write(string);
				if(isAutoFlush) writer.flush();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

		public void done() {
			try {
				writer.flush();
				reader.close();
				writer.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}


//package cf195;

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

public class D {
	FastScanner in;
	PrintWriter out;

	long[] fact;
	final long mod = (long) (1e9 + 7);

	public void solve() throws IOException {
		int n = in.nextInt();
		int m = in.nextInt();
		int g = in.nextInt();
		fact = new long[n + m + 1];
		fact[0] = 1;
		for (int i = 1; i <= n + m; i++) {
			fact[i] = (fact[i - 1] * i) % mod ;
		}
		System.out.println(getAns(n, m, g));
	}

	public long getAns(int n, int m, int req) {
		if (n == 0) {
			if (m == 0) {
				if (req == 0) {
					return 0;
				} else {
					return 1;
				}

			}
			if (m == 1) {
				if (req == 1) {
					return 1;
				} else {
					return 0;
				}
			}

			if (m > 1) {
				if (req == 0) {
					return 1;
				} else {
					return 0;
				}
			}
		}
 		if (req == 0) {
			long ans = getAns(n - 1, m, 1);
			if (m > 0) {
				ans = (ans + cnk(n + m - 1, m - 1)) % mod;
			}
			return ans;
		} else {
			return getAns(n - 1, m, 0);
		}
	}

	public long cnk(int n, int k) {
		return (((fact[n] * inverse(fact[k])) % mod) * inverse(fact[n - k])) % mod;
	}

	public long inverse(long x) {
		return power(x, mod - 2, mod);
	}

	public long power(long x, long pow, long mod) {
		if (pow == 0) {
			return 1;
		}
		if ((pow % 2) == 0) {
			return power(((x * x) % mod), pow / 2, mod);
		} else {
			return (power(x, pow - 1, mod) * x) % mod;
		}
	}

	public void run() {
		try {
			in = new FastScanner(System.in);
			out = new PrintWriter(System.out);

			solve();

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

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				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[] arg) {
		new D().run();
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class D {
    static int n;

    public static  void dfs(int i, int n, int[] a, int[] res, boolean[] v) {
        if (i == n) {
            if (check(res)) {
                print(res);
                System.exit(0);
            }
        } else {
            for (int j = 0; j < n; j++) if (!v[j]) {
                v[j] = true;
                res[i] = a[j];
                dfs(i + 1, n, a, res, v);
                v[j] = false;
            }
        }
    }
    private static void print(int[] a) {
        int sum = 0;
        for (int i = 0; i < n; i++)
            sum += a[i];
        System.out.println(sum);
        int c = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(a[c++] + " ");
            }
            System.out.println();
        }
    }
    private static boolean check(int[] a) {
        int[][] c = new int[n][n];
        int cc = 0;
        for (int i = 0; i < c.length; i++) {
            for (int j = 0; j < c.length; j++) {
                c[i][j] = a[cc++];
            }
        }
        int sum = 0;
        for (int i = 0; i < c.length; i++) {
            sum += c[0][i];
        }
        int s = 0;
        for (int i = 1; i < c.length; i++) {
            s = 0;
            for (int j = 0; j < c.length; j++) {
                s += c[i][j];
            }
            if (s != sum) return false;
        }

        for (int i = 0; i < c.length; i++) {
            s = 0;
            for (int j = 0; j < c.length; j++) {
                s += c[j][i];
            }
            if (s != sum) return false;
        }

        int row = 0;
        int col = 0;
        s = 0;
        while (row < n && col < n) {
            s += c[row++][col++];
        }
        if (s != sum)
            return false;

        row = 0;
        col = n - 1;
        s = 0;
        while (col >= 0 && row < n) {
            s += c[row++][col--];
        }
        if (s != sum) return false;

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

        n = r.nextInt();
        int[] a = new int[n * n];

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

        dfs(0, n * n, a, new int[n * n], new boolean[n * n]);
    }
}


import java.util.*;
public class aa {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int n = input.nextInt(), m = input.nextInt();
    Point[] data = new Point[n];
    for(int i = 0; i<n; i++) data[i] = new Point(i, input.nextInt());
    Arrays.sort(data);
    for(int i = 0; i<m; i++)
    {
        input.nextInt();
        input.nextInt();
    }
    int[] out = new int[n];
    for(int i = 0; i<n; i++) out[data[i].i] = i%2;
    for(int i = 0; i<n; i++) System.out.print(out[i]+" ");
}
static class Point implements Comparable<Point>
{
    int i, x;
    public Point(int ii, int xx)
    {
        i = ii; x = xx;
    }
    @Override
    public int compareTo(Point o) {
        // TODO Auto-generated method stub
        return x - o.x;
    }
}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.util.Random;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            GXMouseInTheCampus solver = new GXMouseInTheCampus();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class GXMouseInTheCampus {
        LongHashMap mu = new LongHashMap(100000, false);
        LongHashMap euler = new LongHashMap(100000, false);
        long[] primes;

        {
            mu.put(1, 1);
            euler.put(1, 1);
        }

        public long oneOfPrimeFactor(long x) {
            for (long p : primes) {
                if (x % p == 0) {
                    return p;
                }
            }
            return x;
        }

        public void populate(long x) {
            long factor = oneOfPrimeFactor(x);
            long cnt = 0;
            long y = x;
            while (y % factor == 0) {
                cnt++;
                y /= factor;
            }
            if (cnt > 1) {
                mu.put(x, 0);
            } else {
                mu.put(x, -mu(y));
            }
            euler.put(x, euler(y) * (x / y - x / y / factor));
        }

        public long mu(long x) {
            long ans = mu.getOrDefault(x, -1);
            if (ans == -1) {
                populate(x);
                ans = mu.get(x);
            }
            return ans;
        }

        public long euler(long x) {
            long ans = euler.getOrDefault(x, -1);
            if (ans == -1) {
                populate(x);
                ans = euler.get(x);
            }
            return ans;
        }

        public void solve(int testNumber, FastInput in, FastOutput out) {
            long m = in.readLong();
            long x = in.readLong();

            primes = Factorization.factorizeNumberPrime(m).toArray();
            LongList allFactorOfM = new LongList(20000);
            LongList tmpList = new LongList(20000);
            LongList allPossiblePrimeFactor = new LongList();
            for (long p : primes) {
                allPossiblePrimeFactor.add(p);
                allPossiblePrimeFactor.addAll(Factorization.factorizeNumberPrime(p - 1));
            }
            allPossiblePrimeFactor.unique();

            collect(allFactorOfM, m, 0);
            LongPower power = new LongPower(ILongModular.getInstance(m));

            long total = 1;
            for (int i = 0; i < allFactorOfM.size(); i++) {
                long g = allFactorOfM.get(i);
                if (g == m) {
                    continue;
                }
                long mg = m / g;
                tmpList.clear();
                collect(tmpList, mg, 0);
                long cnt = 0;
                for (int j = tmpList.size() - 1; j >= 0; j--) {
                    long t = tmpList.get(j);
                    cnt += mu(t) * ((m - 1) / (t * g));
                }

                tmpList.clear();
                long euler = euler(mg);
                LongList primeFactors = tmpList;
                for (int j = 0; j < allPossiblePrimeFactor.size(); j++) {
                    long p = allPossiblePrimeFactor.get(j);
                    if (euler % p == 0) {
                        primeFactors.add(p);
                    }
                }

                long n = euler;
                for (int j = 0; j < primeFactors.size(); j++) {
                    long p = primeFactors.get(j);
                    while (n % p == 0 && power.pow(x, n / p) % mg == 1) {
                        n /= p;
                    }
                }

                if (cnt % n != 0) {
                    throw new IllegalStateException();
                }
                total += cnt / n;
            }

            out.println(total);
        }

        public void collect(LongList list, long x, int i) {
            if (i == primes.length) {
                list.add(x);
                return;
            }
            collect(list, x, i + 1);
            while (x % primes[i] == 0) {
                x /= primes[i];
                collect(list, x, i + 1);
            }
        }

    }

    static class DigitUtils {
        private DigitUtils() {
        }

        public static long round(double x) {
            if (x >= 0) {
                return (long) (x + 0.5);
            } else {
                return (long) (x - 0.5);
            }
        }

        public static long mod(long x, long mod) {
            x %= mod;
            if (x < 0) {
                x += mod;
            }
            return x;
        }

        public static long mulMod(long a, long b, long mod) {
            long k = DigitUtils.round((double) a / mod * b);
            return DigitUtils.mod(a * b - k * mod, mod);
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(long c) {
            cache.append(c);
            println();
            return this;
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class LongPower {
        final ILongModular modular;

        public LongPower(ILongModular modular) {
            this.modular = modular;
        }

        public long pow(long x, long n) {
            if (n == 0) {
                return 1;
            }
            long r = pow(x, n >> 1);
            r = modular.mul(r, r);
            if ((n & 1) == 1) {
                r = modular.mul(r, x);
            }
            return r;
        }

    }

    static class Factorization {
        public static LongList factorizeNumberPrime(long x) {
            LongList ans = new LongList();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                ans.add(i);
                while (x % i == 0) {
                    x /= i;
                }
            }
            if (x > 1) {
                ans.add(x);
            }
            return ans;
        }

    }

    static class LongHashMap {
        private int[] slot;
        private int[] next;
        private long[] keys;
        private long[] values;
        private int alloc;
        private boolean[] removed;
        private int mask;
        private int size;
        private boolean rehash;

        public LongHashMap(int cap, boolean rehash) {
            this.mask = (1 << (32 - Integer.numberOfLeadingZeros(cap - 1))) - 1;
            slot = new int[mask + 1];
            next = new int[cap + 1];
            keys = new long[cap + 1];
            values = new long[cap + 1];
            removed = new boolean[cap + 1];
            this.rehash = rehash;
        }

        private void doubleCapacity() {
            int newSize = Math.max(next.length + 10, next.length * 2);
            next = Arrays.copyOf(next, newSize);
            keys = Arrays.copyOf(keys, newSize);
            values = Arrays.copyOf(values, newSize);
            removed = Arrays.copyOf(removed, newSize);
        }

        public void alloc() {
            alloc++;
            if (alloc >= next.length) {
                doubleCapacity();
            }
            next[alloc] = 0;
            removed[alloc] = false;
            size++;
        }

        private void rehash() {
            int[] newSlots = new int[Math.max(16, slot.length * 2)];
            int newMask = newSlots.length - 1;
            for (int i = 0; i < slot.length; i++) {
                if (slot[i] == 0) {
                    continue;
                }
                int head = slot[i];
                while (head != 0) {
                    int n = next[head];
                    int s = hash(keys[head]) & newMask;
                    next[head] = newSlots[s];
                    newSlots[s] = head;
                    head = n;
                }
            }
            this.slot = newSlots;
            this.mask = newMask;
        }

        private int hash(long x) {
            int h = Long.hashCode(x);
            return h ^ (h >>> 16);
        }

        public void put(long x, long y) {
            put(x, y, true);
        }

        public void put(long x, long y, boolean cover) {
            int h = hash(x);
            int s = h & mask;
            if (slot[s] == 0) {
                alloc();
                slot[s] = alloc;
                keys[alloc] = x;
                values[alloc] = y;
            } else {
                int index = findIndexOrLastEntry(s, x);
                if (keys[index] != x) {
                    alloc();
                    next[index] = alloc;
                    keys[alloc] = x;
                    values[alloc] = y;
                } else if (cover) {
                    values[index] = y;
                }
            }
            if (rehash && size >= slot.length) {
                rehash();
            }
        }

        public long getOrDefault(long x, long def) {
            int h = hash(x);
            int s = h & mask;
            if (slot[s] == 0) {
                return def;
            }
            int index = findIndexOrLastEntry(s, x);
            return keys[index] == x ? values[index] : def;
        }

        public long get(long x) {
            return getOrDefault(x, 0);
        }

        private int findIndexOrLastEntry(int s, long x) {
            int iter = slot[s];
            while (keys[iter] != x) {
                if (next[iter] != 0) {
                    iter = next[iter];
                } else {
                    return iter;
                }
            }
            return iter;
        }

        public LongEntryIterator iterator() {
            return new LongEntryIterator() {
                int index = 1;
                int readIndex = -1;

                public boolean hasNext() {
                    while (index <= alloc && removed[index]) {
                        index++;
                    }
                    return index <= alloc;
                }

                public long getEntryKey() {
                    return keys[readIndex];
                }

                public long getEntryValue() {
                    return values[readIndex];
                }

                public void next() {
                    if (!hasNext()) {
                        throw new IllegalStateException();
                    }
                    readIndex = index;
                    index++;
                }
            };
        }

        public String toString() {
            LongEntryIterator iterator = iterator();
            StringBuilder builder = new StringBuilder("{");
            while (iterator.hasNext()) {
                iterator.next();
                builder.append(iterator.getEntryKey()).append("->").append(iterator.getEntryValue()).append(',');
            }
            if (builder.charAt(builder.length() - 1) == ',') {
                builder.setLength(builder.length() - 1);
            }
            builder.append('}');
            return builder.toString();
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public long readLong() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            long val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static interface LongEntryIterator {
        boolean hasNext();

        void next();

        long getEntryKey();

        long getEntryValue();

    }

    static class LongModular implements ILongModular {
        final long m;

        public LongModular(long m) {
            this.m = m;
        }

        public long mul(long a, long b) {
            return b == 0 ? 0 : ((mul(a, b >> 1) << 1) % m + a * (b & 1)) % m;
        }

    }

    static class LongModularDanger implements ILongModular {
        final long m;

        public LongModularDanger(long m) {
            this.m = m;
        }

        public long mul(long a, long b) {
            return DigitUtils.mulMod(a, b, m);
        }

    }

    static class LongList implements Cloneable {
        private int size;
        private int cap;
        private long[] data;
        private static final long[] EMPTY = new long[0];

        public LongList(int cap) {
            this.cap = cap;
            if (cap == 0) {
                data = EMPTY;
            } else {
                data = new long[cap];
            }
        }

        public LongList(LongList list) {
            this.size = list.size;
            this.cap = list.cap;
            this.data = Arrays.copyOf(list.data, size);
        }

        public LongList() {
            this(0);
        }

        public void ensureSpace(int req) {
            if (req > cap) {
                while (cap < req) {
                    cap = Math.max(cap + 10, 2 * cap);
                }
                data = Arrays.copyOf(data, cap);
            }
        }

        private void checkRange(int i) {
            if (i < 0 || i >= size) {
                throw new ArrayIndexOutOfBoundsException();
            }
        }

        public long get(int i) {
            checkRange(i);
            return data[i];
        }

        public void add(long x) {
            ensureSpace(size + 1);
            data[size++] = x;
        }

        public void addAll(long[] x, int offset, int len) {
            ensureSpace(size + len);
            System.arraycopy(x, offset, data, size, len);
            size += len;
        }

        public void addAll(LongList list) {
            addAll(list.data, 0, list.size);
        }

        public void sort() {
            if (size <= 1) {
                return;
            }
            Randomized.shuffle(data, 0, size);
            Arrays.sort(data, 0, size);
        }

        public void unique() {
            if (size <= 1) {
                return;
            }

            sort();
            int wpos = 1;
            for (int i = 1; i < size; i++) {
                if (data[i] != data[wpos - 1]) {
                    data[wpos++] = data[i];
                }
            }
            size = wpos;
        }

        public int size() {
            return size;
        }

        public long[] toArray() {
            return Arrays.copyOf(data, size);
        }

        public void clear() {
            size = 0;
        }

        public String toString() {
            return Arrays.toString(toArray());
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof LongList)) {
                return false;
            }
            LongList other = (LongList) obj;
            return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);
        }

        public int hashCode() {
            int h = 1;
            for (int i = 0; i < size; i++) {
                h = h * 31 + Long.hashCode(data[i]);
            }
            return h;
        }

        public LongList clone() {
            LongList ans = new LongList();
            ans.addAll(this);
            return ans;
        }

    }

    static interface ILongModular {
        long mul(long a, long b);

        static ILongModular getInstance(long mod) {
            //return new LongModularDanger(mod);
            return mod <= (1L << 54) ? new LongModularDanger(mod) : new LongModular(mod);
        }

    }

    static class SequenceUtils {
        public static boolean equal(long[] a, int al, int ar, long[] b, int bl, int br) {
            if ((ar - al) != (br - bl)) {
                return false;
            }
            for (int i = al, j = bl; i <= ar; i++, j++) {
                if (a[i] != b[j]) {
                    return false;
                }
            }
            return true;
        }

    }

    static class Randomized {
        private static Random random = new Random(0);

        public static void shuffle(long[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                long tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static int nextInt(int l, int r) {
            return random.nextInt(r - l + 1) + l;
        }

    }
}


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

public class Memory_and_Scores {

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

		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(f.readLine());

		int a = Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		int k = Integer.parseInt(st.nextToken());
		int t = Integer.parseInt(st.nextToken());

		f.close();

		long[][] dp = new long[2][k * t * 4 + 401];
		dp[0][k * t * 2 + 200] = 1;

		long mod = 1000000007;

		for (int i = 0; i < 2 * t; i++) {

			int cur = i % 2;
			int nxt = (i + 1) % 2;

			Arrays.fill(dp[nxt], 0);

			for (int j = 0; j <= k * t * 4 + 400; j++) {

				if (dp[cur][j] == 0) {
					continue;
				}

				dp[nxt][j + k + 1] -= dp[cur][j];
				if (dp[nxt][j + k + 1] < 0) {
					dp[nxt][j + k + 1] += mod;
				}
				if (dp[nxt][j + k + 1] >= mod) {
					dp[nxt][j + k + 1] -= mod;
				}

				dp[nxt][j - k] += dp[cur][j];
				if (dp[nxt][j - k] >= mod) {
					dp[nxt][j - k] -= mod;
				}

			}

			for (int j = 1; j <= k * t * 4 + 400; j++) {
				dp[nxt][j] += dp[nxt][j - 1];
				if (dp[nxt][j] >= mod) {
					dp[nxt][j] -= mod;
				}
			}

		}

		int ans = 0;
		for (int i = b - a + k * t * 2 + 201; i <= k * t * 4 + 400; i++) {
			ans += dp[0][i];
			if (ans >= mod) {
				ans -= mod;
			}
		}

		System.out.println(ans);

	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] Y = new int[3];
            int[] M = new int[3];
            int[] cost = new int[3];
            for (int i = 0; i < 3; i++) {
                Y[i] = in.nextInt();
            }
            for (int i = 0; i < 3; i++) {
                M[i] = in.nextInt();
            }
            for (int i = 0; i < 3; i++) {
                cost[i] = in.nextInt();
            }
            int left = 0;
            int right = Integer.MAX_VALUE;
            int res = 0;
            while (right >= left) {
                int mid = (left + right) >> 1;
                if (check(mid, Y, M, cost)) {
                    res = mid;
                    right = mid - 1;
                } else {
                    left = mid + 1;
                }
            }
            out.println(res);
        }

        boolean check(int value, int[] Y, int[] M, int[] cost) {
            for (int defensive = 0; defensive <= value / cost[2]; defensive++) {
                int remain = value - defensive * cost[2];
                for (int attack = 0; attack <= remain / cost[1]; ++attack) {
                    int remain2 = remain - attack * cost[1];
                    int[] nY = new int[3];
                    nY[0] = Y[0] + remain2 / cost[0];
                    nY[1] = Y[1] + attack;
                    nY[2] = Y[2] + defensive;
                    if (canWin(nY, M)) return true;
                }
            }
            return false;
        }

        boolean canWin(int[] y, int[] m) {
            int yPerSecond = Math.max(0, m[1] - y[2]);
            int mPerSecond = Math.max(0, y[1] - m[2]);
            if (mPerSecond == 0) return false;
            if (yPerSecond == 0) return true;
            return (y[0] + yPerSecond - 1) / yPerSecond > (m[0] + mPerSecond - 1) / mPerSecond;
        }

    }

    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.HashMap;
import java.util.Scanner;

public class Leapyear {
    static HashMap<String,Integer> map = new HashMap();
    static int sum2 (int x){
        if (x<6){
            return x+2;
        }
        else if(x == 6){
            return 1;
        }
        return 2;
    }
    static int sum3(int x){
        if (x<5){
            return x+3;
        }else if(x==5){
            return 1;
        }
        else if(x == 6){
            return 2;
        }
        return 3;
    }

    public static void main(String[] args) {
        map.put("sunday",1);
        map.put("monday",2);
        map.put( "tuesday",3);
        map.put( "wednesday",4);
        map.put("thursday",5);
        map.put("friday",6);
        map.put( "saturday",7);

        Scanner in = new Scanner(System.in);
        String day1 = in.next().trim();
        String day2 = in.next().trim();

        if(day1.equals(day2)){
            System.out.println("YES");
        }else if(sum2(map.get(day1))==map.get(day2)||sum3(map.get(day1))==map.get(day2)){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }

    }

}


import java.io.StreamTokenizer;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
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;
		TokenizerReader in = new TokenizerReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(@SuppressWarnings("UnusedParameters") int testNumber, TokenizerReader in, PrintWriter out) {
        int n = in.nextInt(), m = in.nextInt(), min = in.nextInt(), max = in.nextInt();
        out.println(ok(Input.intArray(in, m), n, min, max) ? "Correct" : "Incorrect");
    }

    private boolean ok(int[] t, int n, int min, int max) {
        boolean haveMin = false, haveMax = false;
        for (int i : t) {
            if (i < min) return false;
            if (i > max) return false;
            if (i == min) haveMin = true;
            if (i == max) haveMax = true;
        }
        if (t.length < n-1) return true;
        if (!haveMin && !haveMax && min != max) return false;
        return true;
    }
}

class TokenizerReader extends StreamTokenizer {
    public TokenizerReader(InputStream in) {
        super(new BufferedReader(new InputStreamReader(in)));
        defaultConfig();
    }

    public String nextString() {
        try {
            nextToken();
        } catch (IOException e) {
            throw new RuntimeException("nextString: exception in line " + lineno(), e);
        }
        return sval;
    }

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

    public void defaultConfig() {
        resetSyntax();
        wordChars(33, 126);
        whitespaceChars(0, ' ');
    }

}

abstract class Input {
    public static int[] intArray(TokenizerReader in, int size) {
        int[] res = new int[size];
        for (int i = 0; i < size; ++i)
            res[i] = in.nextInt();
        return res;
    }

}


/**
 * Created by IntelliJ IDEA.
 * User: aircube
 * Date: 28.02.11
 * Time: 20:43
 * To change this template use File | Settings | File Templates.
 */

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

public class TaskD {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;

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

    void run() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        st = null;
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    int a[][] ;
    int dm[][];
    void solve() throws IOException {
        a = new int[15][];
        a[0] = new int[] {1, 2, 3};
        a[1] = new int[] {4, 5, 6, 7};
        a[2] = new int[] {8, 9, 10, 11, 12};
        a[3] = new int[] {13, 14, 15, 16};
        a[4] = new int[] {17, 18, 19};
        a[5] = new int[] {8, 13, 17};
        a[6] = new int[] {4, 9, 14, 18};
        a[7] = new int[] {1, 5, 10, 15, 19};
        a[8] = new int[] {2, 6, 11, 16};
        a[9] = new int[] {3, 7, 12};
        a[10] = new int[] {1, 4, 8};
        a[11] = new int[] {2, 5, 9, 13};
        a[12] = new int[] {3, 6, 10, 14, 17};
        a[13] = new int[] {7, 11, 15, 18};
        a[14] = new int[] {12, 16, 19};

        dm = new int[1 << 19][2];
        for (int i = 0; i < dm.length; ++i)
            dm[i][0] = dm[i][1] = -1;

        for (int i = 0; i < a.length; ++i)
            for (int j = 0; j < a[i].length; ++j)
                a[i][j] -- ;

        int mask = 0;
        for (int t = 0; t < 19; ++t) {
            String str = nextToken();
            if (str.compareTo("O") == 0) mask |= (1 << t) ;;
        }
        int res = brute(mask, 0);
        out.print(res == 1 ? "Karlsson" : "Lillebror");

    }
    int brute(int mask, int turn) {
        if (mask == 0) {
            return turn;
        }
        if (dm[mask][turn] != -1) return dm[mask][turn];

        for(int v = 0; v < a.length; ++v) {

            for (int i = 0; i < a[v].length; ++i) {
                for(int j = i; j < a[v].length; ++j) {
                    boolean ok = true;
                    for (int u = i; ok && u <= j; ++u) {
                        if ((mask & (1 << a[v][u])) == 0) ok = false;
                    }
                    if (ok) {
                        for (int I = i; I <= j; ++I)
                            for(int J = I; J <= j; ++J) {
                                int cm = 0;
                                for (int k = I; k <= J; ++k) {
                                    cm |= (1 << a[v][k]);
                                }
                                int d = brute(mask ^ cm, turn ^ 1);
                                if (turn == 0 && d == 1)  return dm[mask][turn] = 1;
                                if (turn == 1 && d == 0) return dm[mask][turn] = 0;
                            }
                    }
                }
            }
        }

        return dm[mask][turn] = turn;
    }

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

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

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

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


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

public class SnowBall {

	public static void main(String[] args) throws IOException{
		String buff;
		String[] line;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		buff = br.readLine();
		line = buff.split(" ");
		int w = Integer.parseInt(line[0]);
		int h = Integer.parseInt(line[1]);
		buff = br.readLine();
		line = buff.split(" ");
		int u1 = Integer.parseInt(line[0]);
		int d1 = Integer.parseInt(line[1]);
		buff = br.readLine();
		line = buff.split(" ");
		int u2 = Integer.parseInt(line[0]);
		int d2 = Integer.parseInt(line[1]);

		int finalWeight = calculateWeight(w, h, u1, d1, u2, d2);
		bw.write(finalWeight + "");
		br.close();
		bw.close();
	}

	private static int calculateWeight(int w, int h, int u1, int d1, int u2,
			int d2) {

		while(h > 0){
			w += h;
			if(d1 == h){
				w = Integer.max(w - u1, 0);
			}
			if(d2 == h){
				w = Integer.max(w - u2, 0);
			}
			h--;
		}
		return w;
	}
}


import java.util.Scanner;

public class A {
    public static void main (String arg[]){
        Scanner sc = new Scanner(System.in);
        int y = sc.nextInt();
        int co = 0;
        for(int i =1;i<y/2+1;++i){
            int x = i;
            int xx= y-i;
            if(x%xx==0||xx%x==0){
                co++;
            }
        }
        System.out.println(co);
    }
}


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

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 reader = new FastReader();
		int desLen = reader.nextInt();
		int desBrd = reader.nextInt();
		int curLen = reader.nextInt();
		int curBrd = reader.nextInt();
		int totalNs = reader.nextInt();

		Integer[] array = new Integer[totalNs];
		for (int i=0; i<totalNs; i++)
			array[i] = reader.nextInt();

		Arrays.sort (array, new InverseSort());
		long[][] dp = new long[41][100003];
		dp[0][curBrd] = curLen;
		dp[0][curLen] = curBrd;

		int i=0;
		for (i=0; i<41 && i<totalNs; i++)
		{
			for (int j=1; j<100003; j++)
			{
				if ((j >= desBrd && dp[i][j] >= desLen) || (dp[i][j] >= desBrd && j >= desLen))
				{
					System.out.println (i);
					return;
				}

				long bre1 = (long)j*array[i];
				long len1 = dp[i][j];

				if (bre1 >= 100003)
						dp[i+1][100002] = Math.max (dp[i][j], dp[i+1][100002]);
				else
					dp[i+1][(int)bre1] = Math.max (dp[i+1][(int)bre1], dp[i][j]);

				dp[i+1][j] = Math.max (dp[i][j]*array[i], dp[i+1][j]);
			}
		}
		for (int j=1; j<100003; j++)
		{
			if ((j >= desBrd && dp[i][j] >= desLen) || (dp[i][j] >= desBrd && j >= desLen))
			{
				System.out.println (i);
				return;
			}
		}

		System.out.println (-1);
	}
}

class InverseSort implements Comparator<Integer>
{
	public int compare (Integer a, Integer b)
	{
		return (b-a);
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class JavaApplication154 {

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

        int arr[] = new int[3];
        arr[0] = sc.nextInt();
        arr[1] = sc.nextInt();
        arr[2] = sc.nextInt();

        Arrays.sort(arr);
        if(arr[2] - arr[1] - arr[0] < 0){
            System.out.println(0);
        }else{
            System.out.println((arr[2]-arr[1]-arr[0])+1);
        }

    }

}


import java.util.*;

/**
 *
 * @author alexandru
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        System.out.print(s.charAt(0));
        char c = s.charAt(s.length()-1);
        s = s.substring(1, s.length()-1);

        s = s.replaceAll("dot", ".");
        s = s.replaceFirst("at", "@");
        System.out.print(s);
        System.out.println(c);

    }

}


import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

/**
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Codeforces{
    public static InputStream inputStream = System.in;
    public static FastReader in = new FastReader(inputStream);
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    public static void main(String[] args)throws java.lang.Exception
    {
        new Codeforces().run();
        out.close();
    }
    void run() throws java.lang.Exception
    {
        String s1 = ns();
        String s2 = ns();
        if(s1.equals(s2)){
            out.println(s1);
        } else {
            out.println(1);
        }
    }
    private static int ni(){
        return in.nextInt();
    }
    private static long nl(){
        return in.nextLong();
    }
    private static String ns(){
        return in.nextString();
    }
    private static char nc(){
        return in.nextCharacter();
    }
    private static double nd(){
        return in.nextDouble();
    }

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

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

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

    private static long[] nal(int n)
    {
        long[] a = new long[n];
        for(int i=0;i<n;i++) a[i] = nl();
        return a;
    }
    //private void tr(Object... o) { if(o.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

class FastReader{
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private 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 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==','){
                c = read();
            }
            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{
            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 nextLine(){
        String s = readLine0 ();
        while (s.trim ().length () == 0)
            s = readLine0 ();
        return s;
    }

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

    public BigInteger nextBigInteger(){
        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 SpaceCharFilter getFilter(){
        return filter;
    }

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

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


import java.util.*;

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

		int n = sc.nextInt();
		int[] ar = new int[n];

		boolean condition = false;

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

		if(n%2 == 0 || ar[0]%2 == 0 || ar[n-1]%2 == 0) {
			condition = false;
		}else {
			condition = true;
		}

		if(condition) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


import java.util.Scanner;

public class Blackjack {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n <= 10)
            System.out.println(0);
        else if(n >= 11 && n <= 19 || n == 21)
            System.out.println(4);
        else if(n == 20)
            System.out.println(15);
        else
            System.out.println(0);
    }

}


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

import java.math.BigInteger;
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 Solution
{
    // Complete the maximumSum function below.
    public 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 boolean prime(long a){
        if(a==2||a==3)
            return true;
        if((a-1)%6==0)
            return true;
        if((a+1)%6==0)
            return true;
        return false;
    }
    public static  long gcd(long a,long b){
        if(b==0)
            return a;
        long r=a%b;
        return gcd(b,r);
    }

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

    public class ListNode {
        int val;
        ListNode next;
        ListNode() {}
        ListNode(int val) { this.val = val; }
        ListNode(int val, ListNode next) { this.val = val; this.next = next; }
    }

    public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
      }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {}

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    // private static final FastReader scanner = new FastReader();
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        long a=scanner.nextInt(),b=scanner.nextInt();
        long c=a+b;
        long a1=0,b1=0,c1=0;
        while (a>0){
            if(a%10!=0){
                a1=a1*10+(a%10);
            }
            a/=10;
        }
        while (b>0){
            if(b%10!=0){
                b1=b1*10+(b%10);
            }
            b/=10;
        }
        while (c>0){
            if(c%10!=0){
                c1=c1*10+(c%10);
            }
            c/=10;
        }
        a1=Integer.parseInt(new StringBuilder(String.valueOf(a1)).reverse().toString());
        b1=Integer.parseInt(new StringBuilder(String.valueOf(b1)).reverse().toString());
        c1=Integer.parseInt(new StringBuilder(String.valueOf(c1)).reverse().toString());
        if(a1+b1==c1)
            w.println("YES");
        else
            w.println("NO");
        w.close();
    }
}


import static java.lang.Math.min;
import static java.util.Arrays.fill;

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

public class C {

	static void solve() throws IOException {
		int n = nextInt();
		int v = nextInt();
		int edges = nextInt();
		boolean[][] can = new boolean[n][n];
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		for (int i = 0; i < n; i++) {
			b[i] = nextInt();
		}
		for (int i = 0; i < edges; i++) {
			int u = nextInt() - 1, vv = nextInt() - 1;
			can[u][vv] = true;
			can[vv][u] = true;
		}
		// boolean[][] floyd = new boolean[n][];
		// for (int i = 0; i < n; i++) {
		// floyd[i] = can[i].clone();
		// }
		// for (int k = 0; k < n; k++) {
		// for (int i = 0; i < n; i++) {
		// if (!floyd[i][k]) {
		// continue;
		// }
		// for (int j = 0; j < n; j++) {
		// floyd[i][j] |= floyd[k][j];
		// }
		// }
		// }
		int[] parent = new int[n];
		fill(parent, -1);
		List<Integer> from = new ArrayList<>();
		List<Integer> to = new ArrayList<>();
		List<Integer> amount = new ArrayList<>();
		boolean good = true;
		for (int start = 0; start < n && good; start++) {
			if (parent[start] != -1) {
				continue;
			}
			Queue<Integer> queue = new ArrayDeque<>();
			queue.add(start);

			parent[start] = start;
			int[] out = new int[n];

			while (!queue.isEmpty()) {
				int u = queue.poll();
				for (int j = 0; j < n; j++) {
					if (!can[u][j]) {
						continue;
					}
					if (parent[j] == -1) {
						parent[j] = u;
						queue.add(j);
						++out[u];
					}
				}
			}

			long diff = 0;
			for (int i = 0; i < n; i++) {
				if (parent[i] >= 0) {
					diff += a[i] - b[i];
				}
			}

			if (diff != 0) {
				good = false;
				break;
			}
			queue.clear();
			for (int i = 0; i < n; i++) {
				if (out[i] == 0 && parent[i] >= 0) {
					queue.add(i);
				}
			}

			while (!queue.isEmpty()) {
				int leaf = queue.poll();
				if (--out[parent[leaf]] == 0) {
					queue.add(parent[leaf]);
				}
				if (a[leaf] == b[leaf]) {
					parent[leaf] = -2;
					continue;
				}

				int[] curParent = new int[n];
				Queue<Integer> curQueue = new ArrayDeque<>();
				fill(curParent, -1);

				curQueue.add(leaf);
				int[] curOut = new int[n];
				curParent[leaf] = leaf;
				while (!curQueue.isEmpty()) {
					int u = curQueue.poll();
					for (int i = 0; i < n; i++) {
						if (!can[u][i]) {
							continue;
						}
						if (parent[i] < 0 || curParent[i] >= 0) {
							continue;
						}
						++curOut[u];
						curParent[i] = u;
						curQueue.add(i);
					}
				}

				for (int i = 0; i < n; i++) {
					if (curOut[i] == 0 && curParent[i] >= 0) {
						curQueue.add(i);
					}
				}

				while (!curQueue.isEmpty() && a[leaf] != b[leaf]) {
					int x = curQueue.poll();
					int par = curParent[x];

					if (a[leaf] < b[leaf]) {
						int flow = min(v - a[par], a[x]);
						if (par == leaf) {
							flow = min(b[leaf] - a[leaf], flow);
						}
						from.add(x);
						to.add(par);
						amount.add(flow);
						a[x] -= flow;
						a[par] += flow;
					} else {
						int flow = min(v - a[x], a[par]);
						if (par == leaf) {
							flow = min(flow, a[leaf] - b[leaf]);
						}
						from.add(par);
						to.add(x);
						amount.add(flow);
						a[par] -= flow;
						a[x] += flow;
					}
					if (--curOut[par] == 0) {
						curQueue.add(par);
					}
				}
//				System.err.println(a[leaf]+"="+b[leaf]);
				parent[leaf] = -2;
			}

			for (int i = 0; i < n; i++) {
				if (parent[i] >= 0) {
					parent[i] = -2;
				}
			}
		}
//		System.err.println(Arrays.toString(a));
//		System.err.println(Arrays.toString(b));
		if (!good) {
			out.println("NO");
		} else {
			out.println(from.size());
			for (int i = 0; i < from.size(); i++) {
				out.println((from.get(i)+1)+" "+(to.get(i)+1)+" "+amount.get(i));
			}
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		InputStream input = System.in;
		PrintStream output = System.out;
		File file = new File("c.in");
		if (file.exists() && file.canRead()) {
			input = new FileInputStream(file);
		}
		br = new BufferedReader(new InputStreamReader(input));
		out = new PrintWriter(output);
		solve();
		out.close();
	}

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

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

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

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


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

/**
 * CodeForces : 338
 *
 * @author vinaysaini E. Hexagons
 */
public class cf338e {

	static int dx[] = { 1, -1, -2, -1, 1, 2 };
	static int dy[] = { 2, 2, 0, -2, -2, 0 };

	public static void main(String[] args) {
		long x = 0, y = 0;

		long n = in.nextLong();
		long ringNumber = getRing(n);
		long stepsUpTo = 3 * ringNumber * ringNumber + 3 * ringNumber;
		x = 2 * ringNumber;
		long remainingSteps = n - stepsUpTo;
		if (remainingSteps > 0) {
			x = x + dx[0];
			y = y + dy[0];
			remainingSteps--;
		}
		if (remainingSteps >= ringNumber) {
			x += dx[1] * ringNumber;
			y += dy[1] * ringNumber;
			remainingSteps -= ringNumber;
		} else {
			x += dx[1] * remainingSteps;
			y += dy[1] * remainingSteps;
			remainingSteps -= remainingSteps;
		}
		if (remainingSteps >= ringNumber+1) {
			x += dx[2] * (ringNumber+1);
			y += dy[2] * (ringNumber+1);
			remainingSteps -= ringNumber+1;
		} else {
			x += dx[2] * remainingSteps;
			y += dy[2] * remainingSteps;
			remainingSteps -= remainingSteps;
		}
		if (remainingSteps >= ringNumber+1) {
			x += dx[3] * (ringNumber+1);
			y += dy[3] * (ringNumber+1);
			remainingSteps -= ringNumber+1;
		} else {
			x += dx[3] * remainingSteps;
			y += dy[3] * remainingSteps;
			remainingSteps -= remainingSteps;
		}
		if (remainingSteps >= ringNumber+1) {
			x += dx[4] * (ringNumber+1);
			y += dy[4] * (ringNumber+1);
			remainingSteps -= ringNumber+1;
		} else {
			x += dx[4] * remainingSteps;
			y += dy[4] * remainingSteps;
			remainingSteps -= remainingSteps;
		}
		if (remainingSteps >= ringNumber+1) {
			x += dx[5] * (ringNumber+1);
			y += dy[5] * (ringNumber+1);
			remainingSteps -= ringNumber+1;
		} else {
			x += dx[5] * remainingSteps;
			y += dy[5] * remainingSteps;
			remainingSteps -= remainingSteps;
		}
		if (remainingSteps >= ringNumber) {
			x += dx[0] * ringNumber;
			y += dy[0] * ringNumber;
			remainingSteps -= ringNumber;
		} else {
			x += dx[0] * remainingSteps;
			y += dy[0] * remainingSteps;
			remainingSteps -= remainingSteps;
		}

		out.println(x + " " + y);
		out.close();
	}

	static long getRing(long n) {
		long l = 0;
		long r = (long) 1e9;
		while (l < r) {
			long m = (l + r) / 2;
			long sum = 3 * m * m + 3 * m;
			if (n < sum) {
				r = m;
			} else
				l = m + 1;
		}
		return l - 1;
	}

	public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	public static FastScanner in = new FastScanner();

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			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;
		}
	} // --fast i/o ends here----//

}


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

public class A {
    private static class Solver {
        boolean ok(String s) {
            if(s.charAt(0) == '0') return s.length() == 1;
            if(s.length() >= 8) return false;
            return Integer.parseInt(s) <= 1000000;
        }

        public void run() throws IOException {
            int res = -1;
            final String s = IOFast.next();
            for(int i = 1; i < s.length(); i++)
                for(int j = i + 1; j < s.length(); j++) {
                    String[] ss = new String[] { s.substring(0, i), s.substring(i, j), s.substring(j) };
                    int x = 0;
                    boolean g = true;
                    for(int k = 0; k < ss.length; k++) {
                        g &= ok(ss[k]);
                        if(g) {
                            x += Integer.parseInt(ss[k]);
                        }
                    }
                    if(g) {
                        res = Math.max(res, x);
                    }
                }
            IOFast.out.println(res);
        }
    }

    public static void main(String[] args) throws IOException {
        new Solver().run();
        IOFast.out.flush();
    }

    static public class IOFast {
        private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        private static PrintWriter out = new PrintWriter(System.out);

//      private static final int BUFFER_SIZE = 50 * 200000;
        private static final StringBuilder buf = new StringBuilder();
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];

        static {
            for(int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
        }

        static boolean endInput;

        private static int nextInt() throws IOException {
            boolean plus = false;
            int ret = 0;
            while(true) {
                final int c = in.read();

                if(c == -1) {
                    endInput = true;
                    return Integer.MIN_VALUE;
                }

                if(isDigit[c]) {
                    if(c != '-') {
                        plus = true;
                        ret = c - '0';
                    }
                    break;
                }
            }

            while(true) {
                final int c = in.read();
                if(c == -1 || !isDigit[c]) {
                    break;
                }
                ret = ret * 10 + c - '0';
            }

            return plus ? ret : -ret;
        }

        private static long nextLong() throws IOException {
            boolean plus = false;
            long ret = 0;
            while(true) {
                final int c = in.read();

                if(c == -1) {
                    endInput = true;
                    return Integer.MIN_VALUE;
                }

                if(isDigit[c]) {
                    if(c != '-') {
                        plus = true;
                        ret = c - '0';
                    }
                    break;
                }
            }

            while(true) {
                final int c = in.read();
                if(c == -1 || !isDigit[c]) {
                    break;
                }
                ret = ret * 10 + c - '0';
            }

            return plus ? ret : -ret;
        }

        private static String next() throws IOException {
            buf.setLength(0);

            while(true) {
                final int c = in.read();

                if(c == -1) {
                    endInput = true;
                    return "-1";
                }

                if(!isSpace[c]) {
                    buf.append((char)c);
                    break;
                }
            }

            while(true) {
                final int c = in.read();

                if(c == -1 || isSpace[c]) {
                    break;
                }
                buf.append((char)c);
            }

            return buf.toString();
        }

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

    }

}


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
public static void sortbyColumn(int arr[][], int col)
    {

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

          @Override
          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);
    }
    // pair function

    // list.add(new Pair<>(sc.nextInt(), i + 1));
    //     Collections.sort(list, (a, b) -> Integer.compare(b.first, a.first));
    private static class Pair<F, S> {

        private F first;

        private S second;

        public Pair() {}

        public Pair(F first, S second) {
            this.first = first;
            this.second = second;
        }
    }

    static  boolean isPerfectSquare(int x)
    {
        int s = (int) Math.sqrt(x);
        return (s*s == x);
    }

    static boolean isFibonacci(int n)
    {

        return isPerfectSquare(5*n*n + 4) ||
               isPerfectSquare(5*n*n - 4);
    }

	public void run()
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int x = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();

		int count = 0;
		while (!(h+""+m).contains("7"))
		{
			m -= x;
			if (m < 0)
			{
				m += 60;
				h--;
				if(h<0)
					h+=24;
			}
			count++;
		}
		System.out.println(count);
	//		System.out.println(42 + 60*7 - 9*60 -24);
	}
}


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

public class RougeClock {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] buf = br.readLine().split(" ");

		long n = Long.parseLong(buf[0]);
		long m = Long.parseLong(buf[1]);

		int size_h = 1;
		int size_m = 1;
		for (int degree = 7; degree<n; degree*=7)
			size_h++;
		for (int degree = 7; degree<m; degree*=7)
			size_m++;

		int ans = 0;
		if(size_h+size_m<=7){
			for(int i =0;i<n;i++){
				for(int j =0;j<m;j++){
					int[] used = new int[7];
					for(int a=i, k = 0; k<size_h; a/=7, ++k)
						used[a%7]+=1;
					for(int a=j, k = 0; k<size_m; a/=7, ++k)
						used[a%7]+=1;
					if (max(used)<=1)
						ans++;
				}
			}
		}else{
			if(size_h<=6){
				for(int i =0;i<n;i++){
					int[] used = new int[6];
					for(int a=i, k = 0; k<=size_h; a/=7, k++){
						if(a%7==0)
							used[0]=2;
						else{
							used[a%7-1]+=1;
						}
					}
					if (max(used)<=1)
						ans++;
				}
			}
			if(size_m<=6){
				for(int i =0;i<m;i++){
					int[] used = new int[6];
					for(int a=i, k = 0; k<=size_h; a/=7, k++){
						if(a%7==0)
							used[0]=2;
						else
							used[a%7-1]+=1;
					}
					if (max(used)<=1)
						ans++;
				}
			}
		}

		System.out.println(ans);
	}

	private static int max(int[] used) {
		int max =0;
		for(int i =0; i<used.length;i++){
			if(used[i]>max){
				max = used[i];
			}
		}
		return max;
	}
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String s = new Scanner(System.in).nextLine();
        String chars = "><+-.,[]";
        int res =0;
        for(char c:s.toCharArray()) {
            int x = chars.indexOf(c)+8;
            res = (res *16+x)%1000003;
        }
        System.out.println(res);
    }
}


import java.util.*;
import java.io.*;
public class F2 {

	static long mod = 998244353;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		String[] s = new String[n];
		for(int i = 0; i < n; i++) {
			s[i] = sc.next();
		}

		HashSet<String> suffs = new HashSet<>();
		for(int i = 0; i < n; i++){
			for(int j = 1; j < s[i].length(); j++){
				suffs.add(s[i].substring(j));
			}
		}
		suffs.add("");
		HashSet<Pair> nodes = new HashSet<>();
		for(String a: suffs){
			for(String b: suffs){
				if(isPref(a, b)) {
					nodes.add(new Pair(a, b));
				}
			}
		}
		int N = nodes.size();
//		System.out.println(N);
		HashMap<Pair, Integer> code = new HashMap<>();
		Pair[] decode = new Pair[N];
		int count = 0;
		for(Pair p: nodes) {
			decode[count] = p;
			code.put(p, count++);
		}
		int[][] aut = new int[N][N];
		Pair p0 = new Pair("","");
		for(String t: s) {
			for(String u: s) {
				if(isPref(t, u)) {
					String a = t.substring(1);
					String b = u.substring(1);
					Pair p = new Pair(a, b);
					aut[code.get(p0)][code.get(p)]++;
				}
				else if(isPref(u, t)) {
					String a = u.substring(1);
					String b = t.substring(1);
					Pair p = new Pair(a, b);
					aut[code.get(p0)][code.get(p)]++;
				}
			}
		}
		for(Pair p: nodes) {
			Pair q = next(p);
			if(p.equals(p0)){
				continue;
			}
			else if(q != null) {
				aut[code.get(p)][code.get(q)]++;
			}
			else {
				for(String t: s) {
					q = next(p, t);
					if(q != null && nodes.contains(q)) {
						aut[code.get(p)][code.get(q)]++;
					}
				}
			}
		}
		Matrix mat = new Matrix(aut);
		Matrix matp = pow(mat, m);
		System.out.println(matp.mat[code.get(p0)][code.get(p0)]);
	}
	static Pair next(Pair p, String s) {
		if(p.a.equals("")) {
			if(isPref(s, p.b)) {
				String a = s.substring(1);
				String b = p.b.substring(1);
				return new Pair(a, b);
			}
			else if(isPref(p.b, s)) {
				String a = p.b.substring(1);
				String b = s.substring(1);
				return new Pair(a, b);
			}
			else return null;
		}
		else return null;
	}
	static Pair next(Pair p) {
		if(p.a.equals("")) return null;
		String a = p.a.substring(1);
		String b = p.b.substring(1);
		return new Pair(a, b);
	}
	static boolean isPref(String a, String b) { //a of b
		if(a.length() > b.length()) return false;
		else return b.substring(0, a.length()).equals(a);
	}
	static class Pair {
		String a, b;
		public Pair(String a, String b) {
			this.a = a; this.b = b;
		}
		@Override
		public int hashCode() {
			return a.hashCode() + b.hashCode();
		}
		@Override
		public boolean equals(Object o) {
			Pair p = (Pair)o;
			return a.equals(p.a) && b.equals(p.b);
		}
		public String toString() {
			return "'"+a+"' '"+b;
		}
	}

	static Matrix pow(Matrix m, int exp) {
		Matrix res = new Matrix(m.n);
		Matrix mapow = m;
		while(exp > 0) {
			if((exp & 1) == 1) {
				res = res.mult(mapow);
			}
			mapow = mapow.mult(mapow);
			exp >>= 1;
		}
		return res;
	}
	static class Matrix{
		int[][] mat; int n;
		public Matrix(int[][] mat) {
			n = mat.length;
			this.mat = mat;
		}
		public Matrix(int n) {
			mat = new int[n][n];
			this.n = n;
			for(int i = 0; i < n; i++) mat[i][i] = 1;
		}
		Matrix mult(Matrix m) {
			int[][] res = new int[n][n];
			for(int k = 0; k < n; k++) {
				for(int i = 0; i < n; i++) {
					for(int j = 0; j < n; j++) {
						long a = mat[i][k];
						long b = m.mat[k][j];
						long c = res[i][j];
						res[i][j] = (int)((c + a*b%mod)%mod);
					}
				}
			}
			return new Matrix(res);
		}
		public String toString(){
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < n; i++) {
				sb.append(Arrays.toString(mat[i])+"\n");
			}
			return sb.toString();
		}
	}

}


// upsolve with rainboy
import java.io.*;
import java.util.*;

public class CF1187G extends PrintWriter {
	CF1187G() { super(System.out); }
	static class Scanner {
		Scanner(InputStream in) { this.in = in; } InputStream in;
		int k, l; byte[] bb = new byte[1 << 15];
		byte getc() {
			if (k >= l) {
				k = 0;
				try { l = in.read(bb); } catch (IOException e) { l = 0; }
				if (l <= 0) return -1;
			}
			return bb[k++];
		}
		int nextInt() {
			byte c = 0; while (c <= 32) c = getc();
			int a = 0;
			while (c > 32) { a = a * 10 + c - '0'; c = getc(); }
			return a;
		}
	}
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF1187G o = new CF1187G(); o.main(); o.flush();
	}

	static final int INF = 0x3f3f3f3f;
	ArrayList[] aa_;
	int n_, m_;
	int[] pi, dd, bb;
	int[] uu, vv, uv, cost;
	int[] cc;
	void init() {
		aa_ = new ArrayList[n_];
		for (int u = 0; u < n_; u++)
			aa_[u] = new ArrayList<Integer>();
		pi = new int[n_];
		dd = new int[n_];
		bb = new int[n_];
		qq = new int[nq];
		iq = new boolean[n_];
		uu = new int[m_];
		vv = new int[m_];
		uv = new int[m_];
		cost = new int[m_];
		cc = new int[m_ * 2];
		m_ = 0;
	}
	void link(int u, int v, int cap, int cos) {
		int h = m_++;
		uu[h] = u;
		vv[h] = v;
		uv[h] = u ^ v;
		cost[h] = cos;
		cc[h << 1 ^ 0] = cap;
		aa_[u].add(h << 1 ^ 0);
		aa_[v].add(h << 1 ^ 1);
	}
	int[] qq;
	int nq = 1 << 20, head, cnt;
	boolean[] iq;
	void enqueue(int v) {
		if (iq[v])
			return;
		if (head + cnt == nq) {
			if (cnt * 2 <= nq)
				System.arraycopy(qq, head, qq, 0, cnt);
			else {
				int[] qq_ = new int[nq *= 2];
				System.arraycopy(qq, head, qq_, 0, cnt);
				qq = qq_;
			}
			head = 0;
		}
		qq[head + cnt++] = v; iq[v] = true;
	}
	int dequeue() {
		int u = qq[head++]; cnt--; iq[u] = false;
		return u;
	}
	boolean spfa(int s, int t) {
		Arrays.fill(pi, INF);
		pi[s] = 0;
		head = cnt = 0;
		enqueue(s);
		while (cnt > 0) {
			int u = dequeue();
			int d = dd[u] + 1;
			ArrayList<Integer> adj = aa_[u];
			for (int h_ : adj)
				if (cc[h_] > 0) {
					int h = h_ >> 1;
					int p = pi[u] + ((h_ & 1) == 0 ? cost[h] : -cost[h]);
					int v = u ^ uv[h];
					if (pi[v] > p || pi[v] == p && dd[v] > d) {
						pi[v] = p;
						dd[v] = d;
						bb[v] = h_;
						enqueue(v);
					}
				}
		}
		return pi[t] != INF;
	}
	void push(int s, int t) {
		int c = INF;
		for (int u = t, h_, h; u != s; u ^= uv[h]) {
			h = (h_ = bb[u]) >> 1;
			c = Math.min(c, cc[h_]);
		}
		for (int u = t, h_, h; u != s; u ^= uv[h]) {
			h = (h_ = bb[u]) >> 1;
			cc[h_] -= c; cc[h_ ^ 1] += c;
		}
	}
	void push1(int s, int t) {
		for (int u = t, h_, h; u != s; u ^= uv[h]) {
			h = (h_ = bb[u]) >> 1;
			cc[h_]--; cc[h_ ^ 1]++;
		}
	}
	int edmonds_karp(int s, int t) {
		while (spfa(s, t))
			push1(s, t);
		int c = 0;
		for (int h = 0; h < m_; h++)
			c += cost[h] * cc[h << 1 ^ 1];
		return c;
	}
	void main() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int[] ii = new int[k];
		for (int h = 0; h < k; h++)
			ii[h] = sc.nextInt() - 1;
		ArrayList[] aa = new ArrayList[n];
		for (int i = 0; i < n; i++)
			aa[i] = new ArrayList<Integer>();
		for (int h = 0; h < m; h++) {
			int i = sc.nextInt() - 1;
			int j = sc.nextInt() - 1;
			aa[i].add(j);
			aa[j].add(i);
		}
		int t = n + k + 1;
		n_ = n * t + 1;
		m_ = k + (m * 2 * k + n) * (t - 1);
		init();
		for (int i = 0; i < n; i++) {
			ArrayList<Integer> adj = aa[i];
			for (int s = 0; s < t - 1; s++) {
				int u = i * t + s;
				for (int j : adj) {
					int v = j * t + s + 1;
					for (int x = 1; x <= k; x++)
						link(u, v, 1, c + (x * 2 - 1) * d);
				}
			}
		}
		for (int i = 0; i < n; i++)
			for (int s = 0; s < t - 1; s++) {
				int u = i * t + s, v = u + 1;
				link(u, v, k, i == 0 ? 0 : c);
			}
		for (int h = 0; h < k; h++)
			link(n_ - 1, ii[h] * t + 0, 1, 0);
		println(edmonds_karp(n_ - 1, 0 * t + t - 1));
	}
}