import java.util.Scanner;

public class IQTest {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		String s="";
		for(int i=0;i<4;i++) {
			s += input.next();
		}

		String[] sArr = s.split("");

		for(int j=0;j<s.length();j++) {
			if(j<4) {
				// Next
				if(checkNext(j, sArr)) {
					System.out.println("YES");
					return;
				}
			} else if ( j > 11 ) {
				// Previous
				if(checkPrevious(j, sArr)) {
					System.out.println("YES");
					return;
				}
			} else {
				// Both
				if(j%4==0) {
					if(checkNext(j, sArr)) {
						System.out.println("YES");
						return;
					} else {
						continue;
					}
				}
				if(checkNext(j, sArr)) {
					System.out.println("YES");
					return;
				} else if(checkPrevious(j, sArr)) {
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");

	}

	private static boolean checkNext(int j, String[] sArr) {
		if((sArr[j+1].equals("#") && sArr[j+4].equals("#") && sArr[j+5].equals("#")) || (sArr[j+1].equals(".") && sArr[j+4].equals(".") && sArr[j+5].equals("."))) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean checkPrevious(int j, String[] sArr) {
		if((sArr[j-1].equals("#") && sArr[j-4].equals("#") && sArr[j-5].equals("#")) || (sArr[j-1].equals(".") && sArr[j-4].equals(".") && sArr[j-5].equals("."))) {
			return true;
		} else {
			return false;
		}
	}

}


/*
 * ACM Code => cf110d.java
 * Written by Sam X
 * Date: 三月, 08, 2019
 * Time: 14:27
 */
import java.util.*;
import java.math.*;

public class cf110d
{
    static ArrayList<Long> vec = new ArrayList<>();
    static void dfs(long x)
    {
        if(x>1e9) return;
        vec.add(x*10+4);
        vec.add(x*10+7);
        dfs(x*10+4);
        dfs(x*10+7);
    }
    static final long contain(long x1, long y1, long x2, long y2)
    {
        return Math.max(Math.min(y1,y2)-Math.max(x1,x2)+1,0l);
    }
    public static void main(String args[])
    {
        Scanner cin = new Scanner(System.in);
        long pl = cin.nextLong(),
             pr = cin.nextLong(),
             vl = cin.nextLong(),
             vr = cin.nextLong(),
             k = cin.nextLong();

        dfs(0);
        vec.add(0l);
        vec.add((long)1e9);

        Collections.sort(vec);

        long ans=0;

        for(int i=1; i<=vec.size()-k+1; ++i)
        {
            int j=i+k-1;
            ans+=contain(vec.get(i-1)+1, vec.get(i), pl, pr)*contain(vec.get(j), vec.get(j+1)-1, vl, vr);
            if(vec.get(i)>pr) break;
        }

        for(int i=1; i<=vec.size()-k+1; ++i)
        {
            int j=i+k-1;
            ans+=contain(vec.get(i-1)+1, vec.get(i), vl, vr)*contain(vec.get(j), vec.get(j+1)-1, pl, pr);
            if(vec.get(i)>vr) break;
        }

        if(k==1)
        {
            for(int i=0; i<vec.size(); ++i)
            {
                if(contain(vec.get(i), vec.get(i), pl, pr)!=0 &&
                   contain(vec.get(i), vec.get(i), vl, vr)!=0) ans--;
            }
        }

        System.out.printf("%.12f\n", (double)ans/(vr-vl+1)/(pr-pl+1));
        cin.close();
    }
}


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

public class Main {
    static final int mod = 1000000007;
    static Boolean[] canReach;
    static int k, parent[];
    static int ans;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        k = sc.nextInt();
        generatePermutations(0, "");
        for (int i = k + 1; i <= n; i++)
            ans = (int) ((1l * ans * (n - k)) % mod);
        out.println(ans);
        out.flush();
        out.close();
    }

    static void generatePermutations(int i, String perm) {
        if (i == k) {
            char[] options = perm.toCharArray();
            parent = new int[k + 1];
            canReach = new Boolean[k + 1];
            for (int j = 1; j <= k; j++)
                parent[j] = options[j - 1] - '0';
            boolean add = true;
            for (int j = 1; j <= k; j++)
                add &= canReach(j);
            if (add) ans++;
            return;
        }
        for (int j = 1; j <= k; j++) {
            String tmp = perm + j;
            generatePermutations(i + 1, tmp);
        }

    }

    static boolean canReach(int i) {
        if (canReach[i] != null) return canReach[i];
        if (i == 1) return true;
        canReach[i] = false;
        return canReach[i] = canReach(parent[i]);
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

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

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

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

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

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

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

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

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

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

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

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

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

    }

}


import java.io.*;

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

public class icpc
{
    static long count = 0L;
    public static void main(String[] args)throws IOException
    {
        Reader in = new Reader();
        //BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int n = in.nextInt();
        int k = in.nextInt();
        generate(new int[k], k, 0);
        long ans = (count * binPow(n - k, n - k, 1000000007L)) % 1000000007L;
        System.out.println(ans);

    }
    public static long binPow(long a, long n, long m)
    {
        if (n == 0)
            return 1L;
        else
        {
            long res = binPow(a, n / 2, m);
            long ans = (res * res) % m;
            if (n % 2 == 1)
                return (ans * a) % m;
            return ans;
        }
    }
    public static void generate(int[] A, int k, int i)
    {
        if (i == k)
            check(A);
        else
        {
            for (int j=1;j<=k;j++)
            {
                A[i] = j;
                generate(A, k, i + 1);
                A[i] = 0;
            }
        }
    }
    public static void check(int[] A)
    {
        boolean flag = true;

        for (int i=0;i<A.length;i++)
        {
            int j = i;
            HashSet<Integer> h = new HashSet<>();
            while (j != 0 && !h.contains(j))
            {
                h.add(j);
                j = A[j] - 1;
            }
            if (j != 0)
            {
                flag = false;
                break;
            }
        }
        if (flag)
            icpc.count++;
    }
}
class FastFourierTransform
{
    private void fft(double[] a, double[] b, boolean invert)
    {
        int count = a.length;
        for (int i = 1, j = 0; i < count; i++)
        {
            int bit = count >> 1;
            for (; j >= bit; bit >>= 1)
                j -= bit;
            j += bit;
            if (i < j)
            {
                double temp = a[i];
                a[i] = a[j];
                a[j] = temp;
                temp = b[i];
                b[i] = b[j];
                b[j] = temp;
            }
        }
        for (int len = 2; len <= count; len <<= 1)
        {
            int halfLen = len >> 1;
            double angle = 2 * Math.PI / len;
            if (invert)
                angle = -angle;
            double wLenA = Math.cos(angle);
            double wLenB = Math.sin(angle);
            for (int i = 0; i < count; i += len)
            {
                double wA = 1;
                double wB = 0;
                for (int j = 0; j < halfLen; j++)
                {
                    double uA = a[i + j];
                    double uB = b[i + j];
                    double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
                    double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
                    a[i + j] = uA + vA;
                    b[i + j] = uB + vB;
                    a[i + j + halfLen] = uA - vA;
                    b[i + j + halfLen] = uB - vB;
                    double nextWA = wA * wLenA - wB * wLenB;
                    wB = wA * wLenB + wB * wLenA;
                    wA = nextWA;
                }
            }
        }
        if (invert)
        {
            for (int i = 0; i < count; i++)
            {
                a[i] /= count;
                b[i] /= count;
            }
        }
    }

    public long[] multiply(long[] a, long[] b)
    {
        int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;
        resultSize = Math.max(resultSize, 1);
        double[] aReal = new double[resultSize];
        double[] aImaginary = new double[resultSize];
        double[] bReal = new double[resultSize];
        double[] bImaginary = new double[resultSize];
        for (int i = 0; i < a.length; i++)
            aReal[i] = a[i];
        for (int i = 0; i < b.length; i++)
            bReal[i] = b[i];
        fft(aReal, aImaginary, false);
        fft(bReal, bImaginary, false);
        for (int i = 0; i < resultSize; i++)
        {
            double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];
            aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];
            aReal[i] = real;
        }
        fft(aReal, aImaginary, true);
        long[] result = new long[resultSize];
        for (int i = 0; i < resultSize; i++)
            result[i] = Math.round(aReal[i]);
        return result;
    }
}
class NumberTheory
{
    public boolean isPrime(long n)
    {
        if(n < 2)
            return false;
        for(long x = 2;x * x <= n;x++)
        {
            if(n % x == 0)
                return false;
        }
        return true;
    }
    public ArrayList<Long> primeFactorisation(long n)
    {
        ArrayList<Long> f = new ArrayList<>();
        for(long x=2;x * x <= n;x++)
        {
            while(n % x == 0)
            {
                f.add(x);
                n /= x;
            }
        }
        if(n > 1)
            f.add(n);
        return f;
    }
    public int[] sieveOfEratosthenes(int n)
    {
        //Returns an array with the smallest prime factor for each number and primes marked as 0
        int[] sieve = new int[n + 1];
        for(int x=2;x * x <= n;x++)
        {
            if(sieve[x] != 0)
                continue;
            for(int u=x*x;u<=n;u+=x)
            {
                if(sieve[u] == 0)
                {
                    sieve[u] = x;
                }
            }
        }
        return sieve;
    }
    public long gcd(long a, long b)
    {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }
    public long phi(long n)
    {
        double result = n;

        for(long p=2;p*p<=n;p++)
        {
            if(n % p == 0)
            {
                while (n % p == 0)
                    n /= p;
                result *= (1.0 - (1.0 / (double)p));
            }
        }
        if(n > 1)
            result *= (1.0 - (1.0 / (double)n));
        return (long)result;
    }
    public Name extendedEuclid(long a, long b)
    {
        if(b == 0)
            return new Name(a, 1, 0);
        Name n1 = extendedEuclid(b, a % b);
        Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);
        return n2;
    }
    public long modularExponentiation(long a, long b, long n)
    {
        long d = 1L;
        String bString = Long.toBinaryString(b);
        for(int i=0;i<bString.length();i++)
        {
            d = (d * d) % n;
            if(bString.charAt(i) == '1')
                d = (d * a) % n;
        }
        return d;
    }
}
class Name
{
    long d;
    long x;
    long y;

    public Name(long d, long x, long y)
    {
        this.d = d;
        this.x = x;
        this.y = y;
    }
}
class SuffixArray
{
    int ALPHABET_SZ = 256, N;
    int[] T, lcp, sa, sa2, rank, tmp, c;

    public SuffixArray(String str)
    {
        this(toIntArray(str));
    }

    private static int[] toIntArray(String s)
    {
        int[] text = new int[s.length()];
        for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);
        return text;
    }

    public SuffixArray(int[] text)
    {
        T = text;
        N = text.length;
        sa = new int[N];
        sa2 = new int[N];
        rank = new int[N];
        c = new int[Math.max(ALPHABET_SZ, N)];
        construct();
        kasai();
    }

    private void construct()
    {
        int i, p, r;
        for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;
        for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
        for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;
        for (p = 1; p < N; p <<= 1)
        {
            for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;
            for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;
            Arrays.fill(c, 0, ALPHABET_SZ, 0);
            for (i = 0; i < N; ++i) c[rank[i]]++;
            for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
            for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];
            for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)
            {
                if (!(rank[sa[i - 1]] == rank[sa[i]]
                        && sa[i - 1] + p < N
                        && sa[i] + p < N
                        && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;
                sa2[sa[i]] = r;
            }
            tmp = rank;
            rank = sa2;
            sa2 = tmp;
            if (r == N - 1) break;
            ALPHABET_SZ = r + 1;
        }
    }

    private void kasai()
    {
        lcp = new int[N];
        int[] inv = new int[N];
        for (int i = 0; i < N; i++) inv[sa[i]] = i;
        for (int i = 0, len = 0; i < N; i++)
        {
            if (inv[i] > 0)
            {
                int k = sa[inv[i] - 1];
                while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;
                lcp[inv[i] - 1] = len;
                if (len > 0) len--;
            }
        }
    }
}
class ZAlgorithm
{
    public int[] calculateZ(char input[])
    {
        int Z[] = new int[input.length];
        int left = 0;
        int right = 0;
        for(int k = 1; k < input.length; k++) {
            if(k > right) {
                left = right = k;
                while(right < input.length && input[right] == input[right - left]) {
                    right++;
                }
                Z[k] = right - left;
                right--;
            } else {
                //we are operating inside box
                int k1 = k - left;
                //if value does not stretches till right bound then just copy it.
                if(Z[k1] < right - k + 1) {
                    Z[k] = Z[k1];
                } else { //otherwise try to see if there are more matches.
                    left = k;
                    while(right < input.length && input[right] == input[right - left]) {
                        right++;
                    }
                    Z[k] = right - left;
                    right--;
                }
            }
        }
        return Z;
    }
    public ArrayList<Integer> matchPattern(char text[], char pattern[])
    {
        char newString[] = new char[text.length + pattern.length + 1];
        int i = 0;
        for(char ch : pattern) {
            newString[i] = ch;
            i++;
        }
        newString[i] = '$';
        i++;
        for(char ch : text) {
            newString[i] = ch;
            i++;
        }
        ArrayList<Integer> result = new ArrayList<>();
        int Z[] = calculateZ(newString);

        for(i = 0; i < Z.length ; i++) {
            if(Z[i] == pattern.length) {
                result.add(i - pattern.length - 1);
            }
        }
        return result;
    }
}
class KMPAlgorithm
{
    public int[] computeTemporalArray(char[] pattern)
    {
        int[] lps = new int[pattern.length];

        int index = 0;
        for(int i=1;i<pattern.length;)
        {
            if(pattern[i] == pattern[index])
            {
                lps[i] = index + 1;
                index++;
                i++;
            }
            else
            {
                if(index != 0)
                {
                    index = lps[index - 1];
                }
                else
                {
                    lps[i] = 0;
                    i++;
                }
            }
        }
        return lps;
    }

    public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)
    {
        int[] lps = computeTemporalArray(pattern);

        int j = 0;
        int i = 0;
        int n = text.length;
        int m = pattern.length;
        ArrayList<Integer> indices = new ArrayList<>();
        while(i < n)
        {
            if(pattern[j] == text[i])
            {
                i++;
                j++;
            }
            if(j == m)
            {
                indices.add(i - j);
                j = lps[j - 1];
            }
            else if(i < n && pattern[j] != text[i])
            {
                if(j != 0)
                    j = lps[j - 1];
                else
                    i = i + 1;
            }
        }
        return indices;
    }
}
class Hashing
{
    public long[] computePowers(long p, int n, long m)
    {
        long[] powers = new long[n];
        powers[0] = 1;
        for(int i=1;i<n;i++)
        {
            powers[i] = (powers[i - 1] * p) % m;
        }
        return powers;
    }
    public long computeHash(String s)
    {
        long p = 31;
        long m = 1_000_000_009;
        long hashValue = 0L;
        long[] powers = computePowers(p, s.length(), m);
        for(int i=0;i<s.length();i++)
        {
            char ch = s.charAt(i);
            hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;
        }
        return hashValue;
    }
}
class BasicFunctions
{
    public long min(long[] A)
    {
        long min = Long.MAX_VALUE;
        for(int i=0;i<A.length;i++)
        {
            min = Math.min(min, A[i]);
        }
        return min;
    }
    public long max(long[] A)
    {
        long max = Long.MAX_VALUE;
        for(int i=0;i<A.length;i++)
        {
            max = Math.max(max, A[i]);
        }
        return max;
    }
}
class MergeSortInt
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

}
class MergeSortLong
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(long arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
}
class Node
{
    String s;
    Node(String s)
    {
        this.s = s;
    }

    @Override
    public boolean equals(Object ob)
    {
        if(ob == null)
            return false;
        if(!(ob instanceof Node))
            return false;
        if(ob == this)
            return true;
        Node obj = (Node)ob;
        if(this.s.equals(obj.s))
            return true;
        return false;
    }

    @Override
    public int hashCode()
    {
        return (int)this.s.length();
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

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

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

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

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

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

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

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

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

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

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

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

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

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}
class FenwickTree
{
    public void update(long[] fenwickTree,long delta,int index)
    {
        index += 1;
        while(index < fenwickTree.length)
        {
            fenwickTree[index] += delta;
            index = index + (index & (-index));
        }
    }
    public long prefixSum(long[] fenwickTree,int index)
    {
        long sum = 0L;
        index += 1;
        while(index > 0)
        {
            sum += fenwickTree[index];
            index -= (index & (-index));
        }
        return sum;
    }
}
class SegmentTree
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }
    public int[] createSegmentTree(int[] input)
    {
        int np2 = nextPowerOfTwo(input.length);
        int[] segmentTree = new int[np2 * 2 - 1];

        for(int i=0;i<segmentTree.length;i++)
            segmentTree[i] = Integer.MIN_VALUE;

        constructSegmentTree(segmentTree,input,0,input.length-1,0);
        return segmentTree;

    }
    private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/ 2;
        constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);
        constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);
        segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);
    }
    public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)
    {
        return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);
    }
    private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)
    {
        if(qlow <= low && qhigh >= high){
            return segmentTree[pos];
        }
        if(qlow > high || qhigh < low){
            return Integer.MIN_VALUE;
        }
        int mid = (low+high)/2;
        return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),
                rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));
    }
}
class Trie
{

    private class TrieNode
    {
        Map<Character, TrieNode> children;
        boolean endOfWord;
        public TrieNode()
        {
            children = new HashMap<>();
            endOfWord = false;
        }
    }

    private final TrieNode root;
    public Trie()
    {
        root = new TrieNode();
    }

    public void insert(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                node = new TrieNode();
                current.children.put(ch, node);
            }
            current = node;
        }
        current.endOfWord = true;
    }

    public boolean search(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                return false;
            }
            current = node;
        }
        return current.endOfWord;
    }

    public void delete(String word)
    {
        delete(root, word, 0);
    }

    private boolean delete(TrieNode current, String word, int index)
    {
        if (index == word.length())
        {
            if (!current.endOfWord)
            {
                return false;
            }
            current.endOfWord = false;
            return current.children.size() == 0;
        }
        char ch = word.charAt(index);
        TrieNode node = current.children.get(ch);
        if (node == null)
        {
            return false;
        }
        boolean shouldDeleteCurrentNode = delete(node, word, index + 1);

        if (shouldDeleteCurrentNode)
        {
            current.children.remove(ch);
            return current.children.size() == 0;
        }
        return false;
    }
}
class SegmentTreeLazy
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public int[] createSegmentTree(int input[])
    {
        int nextPowOfTwo = nextPowerOfTwo(input.length);
        int segmentTree[] = new int[nextPowOfTwo*2 -1];

        for(int i=0; i < segmentTree.length; i++){
            segmentTree[i] = Integer.MAX_VALUE;
        }
        constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);
        return segmentTree;
    }

    private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/2;
        constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);
        constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);
        segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);
    }

    public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)
    {
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);
    }

    private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)
    {
        if(low > high)
        {
            return;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(startRange > high || endRange < low)
        {
            return;
        }

        if(startRange <= low && endRange >= high)
        {
            segmentTree[pos] += delta;
            if(low != high) {
                lazy[2*pos + 1] += delta;
                lazy[2*pos + 2] += delta;
            }
            return;
        }

        int mid = (low + high)/2;
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);
        segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);
    }

    public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)
    {
        return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);
    }

    private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)
    {
        if(low > high)
        {
            return Integer.MAX_VALUE;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(qlow > high || qhigh < low)
        {
            return Integer.MAX_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return segmentTree[pos];
        }

        int mid = (low+high)/2;
        return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy,  qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class dvpion_423 {
	private static BufferedReader in;
	private static StringTokenizer st;
	private static PrintWriter out;
	static long mod=(long) (1e9 + 7);
	static String ans = "";
	public static void main(String[] args) throws NumberFormatException, IOException {
		Locale.setDefault(Locale.US);
		in = new BufferedReader(new InputStreamReader(System.in));
		st = new StringTokenizer("");
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = 8;
		char q[][] = new char[n + 1][n + 1];
		for(int i = 1; i <= n; i++){
				String t = next();
		        for(int j = 1; j <= n; j++){
		        	q[i][j] = t.charAt(j - 1);
		        }
		}
		int a = 1000000000;
		int b = 1000000000;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		        for(int j = 1; j <= n; j++){
		            cnt = 0;
		            if(q[i][j] == 'W'){
		                int x = i, y = j;
		                while(true){
		                    if(x - 1 >= 1 && q[x - 1][y] == '.'){
		                        cnt++;
		                        x--;
		                    }
		                    else
		                        break;
		                }
		                if(x == 1){
		                    if(a < cnt)		a = cnt;
		                }
		            }
		            cnt = 0;
		            if(q[i][j] == 'B'){
		                int x = i, y = j;
		                while(true){
		                    if(x + 1 <= n && q[x + 1][y] == '.'){
		                        cnt++;
		                        x++;
		                    }
		                    else
		                        break;
		                }
		                if(x == n){
		                    if(b < cnt)	b = cnt;
		                }
		            }
		        }
		    }
		    if(a <= b){
		        out.print("A");
		    }
		    else{
		        out.print("B");
		    }
		out.close();
	}
	private static void go(int ind, int n, int s, String temp, int cur) {
		if(ind == n + 1){
			if(cur == s){
				ans = temp;
			}
			return;
		}
		String t = temp;
		int c = cur;
		temp = temp + "-";
		cur = cur - a[ind];
		go(ind + 1, n, s, temp, cur);
		temp = t + "+";
		cur = c + a[ind];
		go(ind + 1, n, s, temp, cur);
	}
	private static long cnt(long n, long r) {
		int ret = 0;
		while(n > 0){
			n /= r;
			ret ++;
		}
		return ret;
	}
	private static long go(long a, long n) {
		long ret = 0;
		while(n >= 1){
			ret ++;
			n /= a;
		}
		return ret - 1;
	}
	private static long bin_pow(long a, long n) {
		long ret = 1;
		while(n > 0){
			if(n % 2 == 0){
				n /= 2;
				a = a * a % mod;
			}
			else{
				n --;
				ret = ret * a % mod;
			}
		}
		return ret % mod;
	}
	private static double inf = 1e19;

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

	private static long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(next());
	}

	private static int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(next());
	}

	private static String next() throws IOException {
		while(!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Quiz {
	static int mod = 1000000009;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	public static void main(String[] args) throws IOException {
		Reader in = new Reader();
		int i, t, n, m, k, buckets;
		long ans = 0;
		n = in.nextInt();
		m = in.nextInt();
		k = in.nextInt();
		if (n == 0 || m == 0) {
			System.out.println("0");
			return;
		}
		buckets = n - m + 1;
		if (buckets >= m) {
			System.out.println(m);
			return;
		}
//		if()
		int maxInABucket = k - 1;
		int val[] = new int[buckets];
		i = 0;
		t = m;
		int filled = 0;
		while (t > 0) {
			if (t - (maxInABucket - filled) >= 0) {
				val[i] += maxInABucket - filled;
				t -= maxInABucket - filled;
			} else {
				val[i] += t;
				t = 0;
			}
			i++;
			if (i == buckets) {
				break;
//				i = 0;
//				filled = maxInABucket;
//				maxInABucket += k;
			}
		}
		filled = maxInABucket;
		maxInABucket += k;
		if (t > 0) {
			i = 0;
			while (t > 0) {
				if (t - (maxInABucket - filled) >= 0) {
					val[0] += maxInABucket - filled;
					t -= maxInABucket - filled;
				} else {
					val[0] += t;
					t = 0;
				}
				filled = maxInABucket;
				maxInABucket += k;
				i = (i + 1) % buckets;
			}
		}
//		System.out.println(Arrays.toString(val));
		long x = val[0];
		for (i = 0; i < x / k; i++) {
			ans = (ans % mod + k % mod) % mod;
			ans = ((ans % mod) * 2) % mod;
			val[0] -= k;
		}
		ans = (ans % mod + val[0] % mod) % mod;
//		System.out.println(ans);
		for (i = 1; i < buckets; i++) {
//			int x = 0;
//			for (int j = 1; j <= val[i]; j++) {
//				ans = ((ans % mod) + 1) % mod;
//				x++;
//				if (x == k) {
//					ans = ((ans % mod) * 2) % mod;
//					x = 0;
//				}
//			}
//			System.out.println(ans);
			ans = (ans % mod + val[i] % mod) % mod;
		}
		System.out.println(ans);
	}
}


/*package whatever //do not write package name here */

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

public class GFG {
    static Queue<Integer> q1=new LinkedList<>();
    static Queue<Integer> q2=new LinkedList<>();
    static String s1;
    static String s2;
    static HashSet<String> h1=new HashSet<>();
    static    HashSet<String> h2=new HashSet<>();
    static String solve()
    {
        h1.add(s1);
        h2.add(s2);
        int cnt=0;
       while((!q1.isEmpty())&&(!q2.isEmpty()))
       {
           int a=q1.remove();
           int b=q2.remove();
           if(a>b)
           {
               q1.add(b);
               q1.add(a);
               s1=s1.substring(1,s1.length())+b+""+a;
               s2=s2.substring(1,s2.length());
               if(h1.contains(s1)&&h2.contains(s2))
                     return "-1";

               h1.add(s1);
               h2.add(s2);
           }
           else
           {
               q2.add(a);
               q2.add(b);
               s2=s2.substring(1,s2.length())+a+""+b;
               s1=s1.substring(1,s1.length());
               if(h1.contains(s1)&&h2.contains(s2))
                     return "-1";

                     h1.add(s1);
               h2.add(s2);
           }
           cnt++;
       }
       return q1.isEmpty()?(cnt+" 2"):(cnt+" 1");
    }
	public static void main (String[] args) throws Exception{

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(bf.readLine());
		String s[]=bf.readLine().trim().split("\\s+");
		int k1=Integer.parseInt(s[0]);
		for(int i=1;i<=k1;i++){
		  s1+=s[i];
		  q1.add(Integer.parseInt(s[i]));}
		s=bf.readLine().trim().split("\\s+");
		int k2=Integer.parseInt(s[0]);
		for(int i=1;i<=k2;i++){
		    s2+=s[i];
		  q2.add(Integer.parseInt(s[i]));}
		System.out.println(solve());
	}
}


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

public class Solution {

  static int[] merge_sort(int[] a){
      int n=a.length,i,temp;
      int[] b,c;
      if(n==1) return a;
      if(n==2){
          if(a[0]<=a[1]) return a;
          else{
              temp=a[0];
              a[0]=a[1];
              a[1]=temp;
              return a;
          }
      }

      b=new int[n/2];
      c=new int[n-n/2];

      for(i=0;i<n/2;i++){
          b[i]=a[i];
      }

      for(i=n/2;i<n;i++){
          c[i-n/2]=a[i];
      }

      b=merge_sort(b);
      c=merge_sort(c);

      int left=0,right=0,count=0;

      while(left<n/2 && right<(n-n/2)){
          if(b[left]<c[right]){
              a[count]=b[left];
              count++;
              left++;

          }
      }

      if(left==n/2){
          for(i=count;i<n;i++){
              a[i]=c[right];
              right++;
          }
      }

       if(right==n-n/2){
          for(i=count;i<n;i++){
              a[i]=b[left];
              left++;
          }
      }

      return a;

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

        int n,m,i,min=1000;
        int[] f;

        n=in.nextInt();
        m=in.nextInt();

        f=new int[m];

        for(i=0;i<m;i++){
            f[i]=in.nextInt();
        }
        f=merge_sort(f);

        for(i=0;i<=m-n;i++){
            if(f[i+n-1]-f[i]<min)min=f[i+n-1]-f[i];
        }

        System.out.print(min);

   }
}


import java.util.*;

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

        int max = 0;
        for(int i = 1 ; i <= n - 1 ; i++)
        {
            if(a/i != 0 && b/(n - i) != 0)
            {
                int minCakes = Math.min(a/i , b/(n - i));
                if(minCakes > max)
                maxx = minCakes;
            }

        }

        System.out.println(max);
    }
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 *
 * @author pttrung
 */
public class E_Round_297_Div2 {

	public static long MOD = 1000000007;
	static HashMap<State, Long> map = new HashMap();

	public static void main(String[] args) throws FileNotFoundException {
		// PrintWriter out = new PrintWriter(new FileOutputStream(new File(
		// "output.txt")));
		PrintWriter out = new PrintWriter(System.out);
		Scanner in = new Scanner();
		int n = in.nextInt();
		int k = in.nextInt();
		long s = in.nextLong();
		int[]data = new int[n];
		for(int i = 0; i < n;i++){
			data[i] = in.nextInt();
		}
		out.println(cal(0,k,s, data));
		out.close();
	}

	public static long cal(int index, int left, long cur, int[] data) {
		if (index == data.length) {
			if (cur == 0) {
				return 1;
			}
			return 0;
		}
		if (cur == 0) {
			return 1;
		}
		State s = new State(index, left, cur);
		if (map.containsKey(s)) {
			return map.get(s);
		}
		long result = cal(index + 1, left, cur, data);
		if (data[index] <= cur) {
			result += cal(index + 1, left, cur - data[index], data);
		}
		if (left > 0 && data[index] <= 19) {
			long v = 1;
			for (long i = 1; i <= data[index]; i++) {
				v *= i;
			}
			if (v <= cur) {
				result += cal(index + 1, left - 1, cur - v, data);
			}
		}
		map.put(s, result);
		return result;
	}

	public static class State {
		int index, left;
		long cur;

		public State(int index, int left, long cur) {
			this.index = index;
			this.left = left;
			this.cur = cur;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + (int) (cur ^ (cur >>> 32));
			result = prime * result + index;
			result = prime * result + left;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			State other = (State) obj;
			if (cur != other.cur)
				return false;
			if (index != other.index)
				return false;
			if (left != other.left)
				return false;
			return true;
		}

	}

	public static int[] KMP(String val) {
		int i = 0;
		int j = -1;
		int[] result = new int[val.length() + 1];
		result[0] = -1;
		while (i < val.length()) {
			while (j >= 0 && val.charAt(j) != val.charAt(i)) {
				j = result[j];
			}
			j++;
			i++;
			result[i] = j;
		}
		return result;

	}

	public static boolean nextPer(int[] data) {
		int i = data.length - 1;
		while (i > 0 && data[i] < data[i - 1]) {
			i--;
		}
		if (i == 0) {
			return false;
		}
		int j = data.length - 1;
		while (data[j] < data[i - 1]) {
			j--;
		}
		int temp = data[i - 1];
		data[i - 1] = data[j];
		data[j] = temp;
		Arrays.sort(data, i, data.length);
		return true;
	}

	public static int digit(long n) {
		int result = 0;
		while (n > 0) {
			n /= 10;
			result++;
		}
		return result;
	}

	public static double dist(long a, long b, long x, long y) {
		double val = (b - a) * (b - a) + (x - y) * (x - y);
		val = Math.sqrt(val);
		double other = x * x + a * a;
		other = Math.sqrt(other);
		return val + other;

	}

	public static class Point implements Comparable<Point> {

		int x, y;

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

		@Override
		public int hashCode() {
			int hash = 5;
			hash = 47 * hash + this.x;
			hash = 47 * hash + this.y;
			return hash;
		}

		@Override
		public boolean equals(Object obj) {
			if (obj == null) {
				return false;
			}
			if (getClass() != obj.getClass()) {
				return false;
			}
			final Point other = (Point) obj;
			if (this.x != other.x) {
				return false;
			}
			if (this.y != other.y) {
				return false;
			}
			return true;
		}

		@Override
		public int compareTo(Point o) {
			return x - o.x;
		}
	}

	public static class FT {

		long[] data;

		FT(int n) {
			data = new long[n];
		}

		public void update(int index, long value) {
			while (index < data.length) {
				data[index] += value;
				index += (index & (-index));
			}
		}

		public long get(int index) {
			long result = 0;
			while (index > 0) {
				result += data[index];
				index -= (index & (-index));
			}
			return result;

		}
	}

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

	public static long pow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b == 1) {
			return a;
		}
		long val = pow(a, b / 2);
		if (b % 2 == 0) {
			return val * val % MOD;
		} else {
			return val * (val * a % MOD) % MOD;

		}
	}

	static class Scanner {

		BufferedReader br;
		StringTokenizer st;

		public Scanner() throws FileNotFoundException {
			// System.setOut(new PrintStream(new
			// BufferedOutputStream(System.out), true));
			br = new BufferedReader(new InputStreamReader(System.in));
			// br = new BufferedReader(new InputStreamReader(new
			// FileInputStream(new File("input.txt"))));
		}

		public String next() {

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

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

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

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

		public String nextLine() {
			st = null;
			try {
				return br.readLine();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}

		public boolean endLine() {
			try {
				String next = br.readLine();
				while (next != null && next.trim().isEmpty()) {
					next = br.readLine();
				}
				if (next == null) {
					return true;
				}
				st = new StringTokenizer(next);
				return st.hasMoreTokens();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}
	}
}


import java.io.*;
public class A
{
public static void main(String[] args)
{
      int day = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
String s = br.readLine();
int aS = Integer.parseInt(s.substring(0,2));
int bS = Integer.parseInt(s.substring(s.length() - 2));
String s1 = br.readLine();
int a = Integer.parseInt(s1.substring(0,1));
int b = Integer.parseInt(s1.substring(s1.length() - 1));
int tGusSt = 10;
int tGusEnd = 22;
int tBoyEnd = 14;
int tCount = 10;
do
{
      if(aS == 10 && bS == 19 || aS == 19 && bS == 10)
      {
            day = -1;
      }
 tCount++;
 if(tCount == tBoyEnd)
 {
       isUp  = false;
       day++;
       aS += a;
       if(tCount != tGusEnd)
       {
             aS += a;
             aS -= b;
       }
 }
 else
 {
       isUp = true;
 }
 if(isUp == true)
 {
       if(tCount != tBoyEnd)
       {
             aS += b;
       }
 }
}while(aS != bS);
}
catch(Exception excp)
{

}
finally
{
      System.out.println(day);
}
}
}


import java.util.Scanner;
public class A
{
	public static void main(String args[])
	{
		int h1 = s.nextInt();
		int h2 = s.nextInt();
		int a = s.nextInt();
		int b = s.nextInt();

		if(b>=a)
		{
			if((h2-h1)<=8*a)
				System.out.println(0);
			else
				System.out.println(-1);
		}
		else
		{
			int days = 0;
			h1 = h1+8*a;
			while(h1<h2)
			{
				h1 += 12*(a-b);
				days++;
			}
			System.out.println(days);
		}

	}

}


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

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

	void solve()
	{
		int mod = 1000000007;
		int n = ni();
		int[] ds = na(n);

		long[][] C = new long[50 + 1][50 + 1];
		for (int i = 0; i <= 50; i++) {
			C[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
				if (C[i][j] >= mod)
					C[i][j] -= mod;
			}
		}

		long[] ip2 = new long[50];
		long i2 = invl(2, mod);
		ip2[0] = 1;
		for(int i = 1;i < 50;i++)ip2[i] = ip2[i-1] * i2 % mod;

		// [同層で処理済みの1次の頂点][同層で処理済みの2次の頂点][同層で未処理の頂点]
		long[][][] dp = new long[30][30][30];
		dp[0][0][ds[0]] = ds[0] == 3 ? invl(6, mod) : invl(2, mod);
		for(int i = 1;i < n;i++){
			long[][][] ndp = new long[30][30][30];
			for(int k = 0;k < 30;k++){
				for(int l = 0;k+l < 30;l++){
					for(int m = 1;k+l+m < 30;m++){
						if(dp[k][l][m] == 0)continue;
						// 未処理の点から1個選ぶ
						// 1,2次の頂点と結ぶ
						for(int c1 = 0;c1 <= k && c1 <= ds[i]-1;c1++){
							for(int c2 = 0;c2 <= l && c1+c2 <= ds[i]-1;c2++){
								int n1 = k-c1+c2, n2 = l-c2;
								int pl = ds[i] - 1 - c1 - c2;
								if(pl == 1)n1++;
								if(pl == 2)n2++;
								long v = m * dp[k][l][m] % mod * C[k][c1] % mod * C[l][c2];
//								tr(i, k, l, m, c1, c2, n1, n2, dp[k][l][m], v);
								if(m-1 > 0){
									ndp[n1][n2][m-1] += v;
									ndp[n1][n2][m-1] %= mod;
								}else{
									// 次の層へ
									ndp[0][0][n1+2*n2] += v % mod * ip2[n2];
									ndp[0][0][n1+2*n2] %= mod;
								}
							}
						}
					}
				}
			}
			dp = ndp;
		}
		out.println(dp[0][0][0]);
	}

	public static long invl(long a, long mod) {
		long b = mod;
		long p = 1, q = 0;
		while (b > 0) {
			long c = a / b;
			long d;
			d = a;
			a = b;
			b = d % b;
			d = p;
			p = q;
			q = d - c * q;
		}
		return p < 0 ? p + mod : p;
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


import java.util.Scanner;

public class Bots3 {
    public static final int MOD = 1000000007;

    private static long[] fact;
    private static long[] fact1;

    public static void main(String[] args) {
        initFact();

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt() + 1;
        long res = (fact[2 * n] * fact1[n]) % MOD;
        res = (res * fact1[n] - 1) % MOD;

        System.out.println(res);
    }

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

    private static void initFact() {
        fact = new long[2010];
        fact1 = new long[2010];

        fact[0] = 1;
        fact1[0] = 1;

        for (int i = 1; i < fact.length; i++) {
            fact[i] = (fact[i - 1] * i) % MOD;
            fact1[i] = pow(fact[i], MOD - 2);
        }
    }

    private static long getCFact(int n, int k) {
        return (((fact[n] * fact1[k]) % MOD) * fact1[n - k]) % MOD;
    }

}


import java.util.Scanner;

public class Bots_Kamel_Final_Version {

	final static long BASE = 1_000_000_007;

	public static void main(String [] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		getResult(n);
		sc.close();
	}

	static void getResult(int n) {
		long lev = 1;
		long tot = 1;
		//First part --> Pure doubling
		for(int i = 1; i<=n; i++) {
			lev = (lev*2)%BASE;
			tot = (tot+lev)%BASE;
		}
		long [] modInv = getInverses(n+1);
		long [] combs = getCombs(n+1, 2*n, modInv);
		for(int i = n+1; i<=2*n; i++) {
			lev = 2*(lev - combs[i-n-1]+BASE)%BASE;
			tot = (tot+lev)%BASE;
		}
		System.out.print(tot);
	}

	static long [] getCombs(int start, int end, long [] inverses) {
		long [] ret = new long[end - start+1];
		ret[0] = 1;
		for(int i = 1;  i <ret.length; i++) {
			ret[i] = (ret[i-1]*((start+i-1)*inverses[i])%BASE)%BASE;
		}
		return ret;
	}

	static long [] getInverses(int n) {
		long [] ret = new long[n+1];
		ret[1] = 1;
		for(int i = 2; i < ret.length; i++) {
			ret[i] = (BASE - (BASE/i*ret[(int)BASE%i])%BASE)%BASE;
		}
		return ret;
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class A {
    public static void main(String[] args){
        try{
            BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
            int m=0,n=0;
            String in[] = new String[2];
            in = input.readLine().split(" ");
            m = Integer.parseInt(in[0]);
            n = Integer.parseInt(in[1]);
            ArrayList<Long> temp = new ArrayList<Long>();
            int count = 0;
            for(long a=0;a<=m*n;a++){
                for(long b=0;b<=m*n;b++){
                    if((a*a + b == n) && (a + b*b == m) && !temp.contains(a) && !temp.contains(b)){
                        count++;
                        temp.add(a);
                        temp.add(b);
                    }
                }
            }
            System.out.println(count);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}


import java.util.*;
public class Main {
    public static void main ( String arg[] ) {
        Scanner in = new Scanner( System.in );
        int n = in.nextInt();
        int a[] = new int[n];
        for ( int i = 0; i < n; i++ ) cin >> a[i] = in.nextInt();
        int x = 0, y = 0, z = 0;
        for ( int i = 0; i < n;  ) {
            x += a[i++];
            if ( i < n ) y += a[i++];
            if ( i < n ) z += a[i++];
        }
        if( Math.max(Math.max(x,y),z) == x ) System.out.println("chest");
        else if( Math.max(Math.max(x,y),z) == y ) System.out.println("biceps");
        else if( Math.max(Math.max(x,y),z) == z ) System.out.println("back");
    }
}


/**
 * Created by Grand on 27.07.2015.
 */
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class tr implements Runnable {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Thread(null, new tr(), "", 128 * (1L << 20)).start();

    }

    void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        /*if (ONLINE_JUDGE) {
            in = new BufferedReader(new FileReader("island2.in"));
            out = new PrintWriter("island2.out");
        } else {*/
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //}
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();

            init();
            solve();

            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {

        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    String readString(String s) throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine(), s + "\n \t");
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    int readInt(String s) throws IOException {
        return Integer.parseInt(readString(s));
    }

    boolean isPrime(int a) throws IOException {
        int del = 0;
        if (a == 2) {
            return false;
        }
        for (int i = 2; i < Math.sqrt(a) + 1; i++) {
            if (a % i == 0) {
                del = i;
                break;
            }
        }
        if (del > 0) {
            return false;
        } else return true;
    }

    public BigInteger bigFactorial(int num) throws IOException {
        BigInteger fact = new BigInteger("1");
        BigInteger i = new BigInteger("1");
        BigInteger one = new BigInteger("1");
        for (int j = 0; j < num; j++) {
            fact = fact.multiply(i);
            i = i.add(one);
//out.println(fact.toString()+" "+i.toString());
        }
//fact = fact.add(one);

        return fact;
    }

    public long factorial(int num) throws IOException {
        long res = 1;
        for (int i = 2; i <= num; i++) {
            res *= i;
        }
        return res;
    }

    //Random rd=new Random(System.currentTimeMillis());
    public int[] readIntArr(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = readInt();
            //a[n-i-1] = - a[i];
        }
        return a;
    }

    class Pair implements Comparable {
        int norm, pred;

        public Pair(int sumue, int start) {
            norm = sumue;
            pred = start;
        }

        public int getnorm() {
            return norm;
        }

        public void setnorm(int sumue) {
            this.norm = sumue;
        }

        public int getpred() {
            return pred;
        }

        public void setpred(int q) {
            this.pred = q;
        }

        @Override
        public int compareTo(Object o) {
            if (this.norm > ((Pair) o).norm) {
                return 1;
            }
            if (this.norm < ((Pair) o).norm) {
                return -1;
            }
            if (this.norm == ((Pair) o).norm && this.pred > ((Pair) o).pred) {
                return 1;
            }
            if (this.norm == ((Pair) o).norm && this.pred < ((Pair) o).pred) {
                return -1;
            }

            return 0;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "norm=" + norm +
                    ", pred=" + pred +
                    '}';
        }
    }

    Random rnd = new Random();

    class two {
        int sum;
        int sumpr;

        public two(int sum, int sumpr) {
            this.sum = sum;
            this.sumpr = sumpr;
        }

        public int getSum() {
            return sum;
        }

        public void setSum(int sum) {
            this.sum = sum;
        }

        public int getSumpr() {
            return sumpr;
        }

        public void setSumpr(int sumpr) {
            this.sumpr = sumpr;
        }
    }

    class four implements Comparable<four> {
        int l, r, price;
        String lic;

        public four(int l, int r, int price, String lic) {
            this.l = l;
            this.r = r;
            this.price = price;
            this.lic = lic;
        }

        public int getL() {
            return l;
        }

        public void setL(int l) {
            this.l = l;
        }

        public int getR() {
            return r;
        }

        public void setR(int r) {
            this.r = r;
        }

        public int getPrice() {
            return price;
        }

        public void setPrice(int price) {
            this.price = price;
        }

        public String getLic() {
            return lic;
        }

        public void setLic(String lic) {
            this.lic = lic;
        }

        @Override
        public int compareTo(four four) {
            return this.r - four.r;
        }
    }

    int kol=0;
    HashSet<String> st = new HashSet<String>();
    void solve() throws Exception {
        char[] a = readString().toCharArray();
        char[] b = readString().toCharArray();
        int m1 = 0, pl1 = 0, m2 = 0, pl2=0, vop=0;
        for (int i = 0; i < a.length; i++) {
            if(a[i]=='-')m1++;
            if(a[i]=='+')pl1++;
            if(b[i]=='-')m2++;
            if(b[i]=='+')pl2++;

        }
        vop = b.length - m2 - pl2;
        if(vop==0){
            if(m1+pl1==m2+pl2){
                System.out.println(1.0);
            }
            else System.out.println(0.0);
            return;
        }
        if(pl2>pl1 || m2>m1){
            System.out.println(0.0);
            return;
        }
        int pl = pl1-pl2;
        int m = m1-m2;
        res(b, m1, pl1);
        System.out.println((kol+0.0)/Math.pow(2, vop));

    }

    public void res(char[] a, int m, int pl){
        for (int i = 0; i < a.length; i++) {
            if(a[i]=='?'){
                char[] c = new char[a.length];
                char[] d = new char[a.length];
                System.arraycopy(a, 0, c, 0, a.length);
                System.arraycopy(a, 0, d, 0, a.length);
                c[i]='+';
                d[i]='-';
                res(c,m,pl);
                res(d,m,pl);
            }
        }
        int m1=0, pl1=0;
        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < a.length; i++) {
            if(a[i]=='-')m1++;
            if(a[i]=='+')pl1++;
            sb.append(a[i]);
        }
        if(m1==m && pl1==pl && !st.contains(sb.toString())){
            kol++;
            st.add(sb.toString());
        }
    }

}


import java.util.Scanner;
public class StringTask
{
   public static void main(String[] args)
   {
       int p;
       Scanner s=new Scanner(System.in);
       String str=s.nextLine();
       str=str.toLowerCase();
       str=str.replaceAll("[aeiou]","");
       StringBuilder str1=new StringBuilder(str);
       for(p=0;p<str1.length();p++)
       {
          str1= str1.insert(p,".");
       }
       System.out.println(str1);
    }
}


import java.util.Scanner;

public class IEEE3 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		String upperCase = input.toUpperCase();
		int upperCounter = 0 ;
		int lowerCounter = 0 ;
		for(int i = 0;i <input.length() ;i++){
			if(input.charAt(i)==upperCase.charAt(i))
				upperCounter++;
		}
		lowerCounter = input.length() - upperCounter;
		if(upperCounter>lowerCounter)
			System.out.print(upperCase);
		else if(lowerCounter > upperCounter)
			System.out.print(input.toLowerCase());
		else {
			String converted = "";
			for(int i = 0;i<input.length();i++){
				if(input.charAt(i)==upperCase.charAt(i))
					converted = converted + input.substring(i,i+1).toLowerCase();
				else
					converted = converted + input.substring(i,i=1).toUpperCase();
				}
			System.out.print(converted);
		}
}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.TreeSet;

public class C_Practice {

	static Reader r = new Reader();
	static PrintWriter out = new PrintWriter(System.out);

	private static void solve1() throws IOException {

		int n = r.nextInt();
		int arr[] = r.nextIntArray(n);

		for (int i = 0; i < n; i++) {
			if (arr[i] > i + 1) {
				out.println(-1);
				out.close();
				return;
			}
		}

		int cnt = 1;
		int ans[] = new int[n];
		Arrays.fill(ans, -1);
		boolean vis[] = new boolean[(int) 1e6 + 1];
		ArrayList<Integer> av = new ArrayList<Integer>();

		vis[arr[0]] = true;
		for (int i = 1; i < n; i++) {
			if (arr[i] != arr[i - 1]) {
				ans[i] = arr[i - 1];
				vis[arr[i]] = true;
			} else {
				cnt++;
			}
		}

		for (int i = 0; i <= 1000000 && cnt > 0; i++) {
			if (!vis[i]) {
				av.add(i);
				cnt--;
			}
		}

		int idx = 0;
		for (int i = 0; i < n; i++) {
			if (ans[i] == -1) {
				ans[i] = av.get(idx++);
			}
		}

		for (int i = 0; i < n; i++) {
			out.print(ans[i] + " ");
		}
		out.close();

	}

	static ArrayList<Integer> tree[];
	static int one, more;

	private static void BFS(int node, int depth, int parent) {
		if (depth == 1) {
			one++;
		} else if (depth > 1) {
			more++;
		}
		for (int child : tree[node]) {
			if (child != parent) {
				BFS(child, depth + 1, node);
			}
		}
	}

	private static void solve2() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();
			int x = r.nextInt();

			one = 0;
			more = 0;

			tree = new ArrayList[n + 1];

			for (int i = 1; i <= n; i++) {
				tree[i] = new ArrayList<Integer>();
			}

			for (int i = 1; i <= n - 1; i++) {
				int u = r.nextInt();
				int v = r.nextInt();
				tree[u].add(v);
				tree[v].add(u);
			}

			BFS(x, 0, -1);

			String ans = "";

			if (one <= 1) {
				ans = "Ayush";
			} else {
				int chance = (more & 1) == 0 ? 0 : 1; // 0 --> Ayush || 1 --> Ashish //
				if ((one & 1) == 0) {
					chance = (chance + 1) % 2;
				}
				ans = (chance == 0) ? "Ayush" : "Ashish";
			}

			res.append(ans).append("\n");

		}

		out.print(res);
		out.close();
	}

	private static boolean isOn(long num, int bit) {
		if ((num & (1L << bit)) == 0) {
			return false;
		}
		return true;
	}

	private static void solve3() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {
			long n = r.nextLong();
			long ans = 2 * n - Long.bitCount(n);
			res.append(ans).append("\n");
		}

		out.print(res);
		out.close();

	}

	private static void solve4() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();

			ArrayList<Integer> arr = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				arr.add(r.nextInt());
			}
			Collections.sort(arr);

			int ans = -1;
			ArrayList<Integer> temp;

			for (int i = 1; i <= 1024; i++) {
				temp = new ArrayList<Integer>();
				for (int j = 0; j < n; j++) {
					temp.add((arr.get(j) ^ i));
				}
				Collections.sort(temp);
				if (temp.equals(arr)) {
					ans = i;
					break;
				}
			}

			res.append(ans).append("\n");

		}

		out.print(res);
		out.close();

	}

	private static void solve5() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {
			int x1 = r.nextInt();
			int y1 = r.nextInt();
			int x2 = r.nextInt();
			int y2 = r.nextInt();
			res.append((long) (x2 - x1) * (y2 - y1) + 1).append("\n");
		}

		out.print(res);
		out.close();

	}

	private static void solve6() throws IOException {

		int n = r.nextInt();
		int s = r.nextInt();

		if ((s / n <= 1)) {
			out.print("NO");
		} else {
			int last = (s / n) + (s % n);
			int rem = (s / n);
			out.println("YES");
			for (int i = 1; i <= n - 1; i++) {
				out.print(rem + " ");
			}
			out.println(last);
			out.print(1);
		}
		out.close();

	}

	static class Pair implements Comparable<Pair> {

		int fi, se;

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

		@Override
		public boolean equals(Object o) {
			if (this == o)
				return true;
			if (o == null || getClass() != o.getClass())
				return false;
			Pair pair = (Pair) o;
			return fi == pair.fi && se == pair.se;
		}

		@Override
		public int hashCode() {
			return Objects.hash(fi, se);
		}

		@Override
		public int compareTo(Pair o) {
			if (o.se - o.fi + 1 == this.se - this.fi + 1) {
				return this.fi - o.fi;
			}
			return (o.se - o.fi + 1) - (this.se - this.fi + 1);
		}

	}

	private static void solve7() throws IOException {

		int t = r.nextInt();

		while (t-- > 0) {

			int n = r.nextInt();

			PriorityQueue<Pair> pq = new PriorityQueue<>();
			pq.add(new Pair(0, n - 1));

			int cnt = 0;
			int ans[] = new int[n];

			while (!pq.isEmpty()) {
				Pair p = pq.poll();
				int lt = p.fi;
				int rt = p.se;
				int idx = (lt + rt) / 2;
				ans[idx] = ++cnt;
				if (lt < idx)
					pq.add(new Pair(lt, idx - 1));
				if (rt > idx)
					pq.add(new Pair(idx + 1, rt));
			}

			for (int i = 0; i < n; i++) {
				out.print(ans[i] + " ");
			}
			out.println();

		}

		out.close();

	}

	public static class Pair1 {

		int x, y, prevX, prevY;

		public Pair1(int a, int b, int c, int d) {
			x = a;
			y = b;
			prevX = c;
			prevY = d;
		}

		@Override
		public int hashCode() {
			return prevX + prevY + x + y;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (this.getClass() != obj.getClass())
				return false;
			Pair1 other = (Pair1) obj;
			if (x == other.x && y == other.y && prevX == other.prevX && prevY == other.prevY)
				return true;
			if (x == other.prevX && y == other.prevY && prevX == other.x && prevY == other.y)
				return true;
			return false;
		}

	}

	private static void solve8() throws IOException {

		int t = r.nextInt();

		while (t-- > 0) {

			char str[] = r.next().toCharArray();
			HashSet<Pair1> set = new HashSet<>();

			long ans = 0;
			int x = 0, y = 0;

			for (int i = 0; i < str.length; i++) {
				int fi = x, se = y;
				if (str[i] == 'N')
					y++;
				else if (str[i] == 'S')
					y--;
				else if (str[i] == 'E')
					x++;
				else
					x--;
				int th = x, fo = y;
				Pair1 p = new Pair1(fi, se, th, fo);
				if (set.contains(p)) {
					ans += 1;
				} else {
					ans += 5;
					set.add(p);
				}
			}

			out.println(ans);

		}
		out.close();

	}

	private static void solve9() throws IOException {

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

		int vis[] = new int[n + 1];
		for (int i = 0; i < n; i++) {
			arr[i] = r.nextInt();
			vis[arr[i]] = 1;
		}

		TreeSet<Integer> av = new TreeSet<Integer>();
		for (int i = 1; i <= n; i++) {
			if (vis[i] == 0)
				av.add(i);
		}

		for (int i = 0; i < n; i++) {
			if (arr[i] == 0 && av.contains(i + 1)) {
				if (av.higher(i + 1) != null) {
					arr[i] = av.higher(i + 1);
					av.remove(arr[i]);
				} else {
					arr[i] = av.lower(i + 1);
					av.remove(arr[i]);
				}
			}
		}

		for (int i = 0; i < n; i++) {
			if (arr[i] == 0) {
				if (av.higher(i + 1) != null) {
					arr[i] = av.higher(i + 1);
					av.remove(arr[i]);
				} else {
					arr[i] = av.lower(i + 1);
					av.remove(arr[i]);
				}
			}
			out.print(arr[i] + " ");
		}

		out.close();

	}

	static class Day implements Comparable<Day> {
		int a, b;

		public Day(int a, int b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(Day o) {
			if (a == o.a) {
				return (b - o.b);
			}
			return (a - o.a);
		}
	}

	private static void solve10() throws IOException {

		int n = r.nextInt();

		Day arr[] = new Day[n];
		for (int i = 0; i < n; i++) {
			arr[i] = new Day(r.nextInt(), r.nextInt());
		}

		Arrays.sort(arr);

		int ans = Integer.MIN_VALUE;
		for (int i = 0; i < n; i++) {
			if (Math.min(arr[i].a, arr[i].b) >= ans) {
				ans = Math.max(ans, Math.min(arr[i].a, arr[i].b));
			} else {
				ans = Math.max(ans, Math.max(arr[i].a, arr[i].b));
			}
		}

		out.print(ans);
		out.close();

	}

	static class Point implements Comparable<Point> {
		int x, y;

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

		@Override
		public int compareTo(Point o) {
			if (x == o.x) {
				return (y - o.y);
			}
			return (x - o.x);
		}
	}

	static boolean onSegment(Point p, Point q, Point r) {
		if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y)
				&& q.y >= Math.min(p.y, r.y))
			return true;

		return false;
	}

	static int orientation(Point p, Point q, Point r) {
		int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);

		if (val == 0)
			return 0;

		return (val > 0) ? 1 : 2;
	}

	static boolean doIntersect(Point p1, Point q1, Point p2, Point q2) {
		int o1 = orientation(p1, q1, p2);
		int o2 = orientation(p1, q1, q2);
		int o3 = orientation(p2, q2, p1);
		int o4 = orientation(p2, q2, q1);

		if (o1 != o2 && o3 != o4)
			return true;

		if (o1 == 0 && onSegment(p1, p2, q1))
			return true;

		if (o2 == 0 && onSegment(p1, q2, q1))
			return true;

		if (o3 == 0 && onSegment(p2, p1, q2))
			return true;

		if (o4 == 0 && onSegment(p2, q1, q2))
			return true;

		return false;
	}

	private static void solve11() throws IOException {

		int rebel = r.nextInt();
		int bases = r.nextInt();

		Point a1[] = new Point[rebel];
		Point a2[] = new Point[bases];

		for (int i = 0; i < rebel; i++) {
			a1[i] = new Point(r.nextInt(), r.nextInt());
		}
		for (int i = 0; i < bases; i++) {
			a2[i] = new Point(r.nextInt(), r.nextInt());
		}

		Arrays.sort(a1);
		Arrays.sort(a2);

		boolean flag = (a1.length == a2.length) ? true : false;
		if (flag) {
			for (int i = 0; i < a1.length - 1; i++) {
				if (doIntersect(a1[i], a2[i], a1[i + 1], a2[i + 1])) {
					flag = false;
					break;
				}
			}
		}

		out.print(flag ? "Yes" : "No");
		out.close();

	}

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

//		solve1();

//		solve2();

//		solve3();

//		solve4();

//		solve5();

//		solve6();

//		solve7();

//		solve8();

//		solve9();

//		solve10();

		solve11();

	}

	static class Reader {

		final private int BUFFER_SIZE = 1 << 12;
		boolean consume = false;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		private boolean reachedEnd = false;

		public Reader() {
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = 0;
			bytesRead = 0;
		}

		public boolean hasNext() {
			return !reachedEnd;
		}

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

		private void consumeSpaces() throws IOException {
			while (read() <= ' ' && reachedEnd == false)
				;
			bufferPointer--;
		}

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

		public String next() throws IOException {
			StringBuilder sb = new StringBuilder();
			consumeSpaces();
			byte c = read();
			do {
				sb.append((char) c);
			} while ((c = read()) > ' ');
			if (consume) {
				consumeSpaces();
			}
			;
			if (sb.length() == 0) {
				return null;
			}
			return sb.toString();
		}

		public String nextLine() throws IOException {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			return str;
		}

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

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

		public double nextDouble() throws IOException {
			consumeSpaces();
			double ret = 0;
			double div = 1;
			byte c = read();
			boolean neg = (c == '-');
			if (neg) {
				c = read();
			}
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}
			if (consume) {
				consumeSpaces();
			}
			if (neg) {
				return -ret;
			}
			return ret;
		}

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

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

		public int[][] nextIntMatrix(int n, int m) throws IOException {
			int[][] grid = new int[n][m];
			for (int i = 0; i < n; i++) {
				grid[i] = nextIntArray(m);
			}
			return grid;
		}

		public char[][] nextCharacterMatrix(int n) throws IOException {
			char[][] a = new char[n][];
			for (int i = 0; i < n; i++) {
				a[i] = next().toCharArray();
			}
			return a;
		}

		public void close() throws IOException {
			if (System.in == null) {
				return;
			} else {
				System.in.close();
			}
		}
	}

}


import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
import java.lang.Math;

public class GuardDuty {

	boolean segmentosSeInterceptam(Ponto p1, Ponto p2, Ponto p3, Ponto p4) {

		int d1 = direcao(p3, p4, p1);
		int d2 = direcao(p3, p4, p2);
		int d3 = direcao(p1, p2, p3);
		int d4 = direcao(p1, p2, p4);

		if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
			return true;
		} else if (d1 == 0 && noSegmento(p3, p4, p1)) {
			return true;
		} else if (d2 == 0 && noSegmento(p3, p4, p2)) {
			return true;
		} else if (d3 == 0 && noSegmento(p1, p2, p3)) {
			return true;
		} else if (d4 == 0 && noSegmento(p1, p2, p4)) {
			return true;
		} else {
			return false;
		}
	}

	int direcao(Ponto pi, Ponto pj, Ponto pk) {
		int resp = (pk.x - pi.x) * (pj.y - pi.y) - (pj.x - pi.x) * (pk.y - pi.y);
		// (pk - pi) * (pj - pi)
		return resp;
	}

	boolean noSegmento(Ponto pi, Ponto pj, Ponto pk) {
		if ((Math.min(pi.x, pj.x) <= pk.x) && (pk.x <= Math.max(pi.x, pj.x))) {
			if ((Math.min(pi.y, pj.y) <= pk.y) && (pk.y <= Math.max(pi.y, pj.y))) {
				return true;
			}
		}
		return false;
	}

	boolean nSegmentosInterceptam(Ponto[] s) {
		// T = NULL;
		LinkedList<Integer> ll = new LinkedList<Integer>();
		ll.clear();
		Iterator<Integer> it = ll.iterator();
		int ant = -1;
		ordenaExtremidades(s);
		for (int p = 0; p < s.length; p++) {
			if (s[p].esq) {

				ll.add(s[p].seg);
				it = ll.iterator();
				ant = -1;

				// Percorre pra saber se existe segmentos acima ou abaixo do
				// atual na estrutura aux
				while (it.hasNext()) {
					Iterator<Integer> temp = it;
					int next = temp.next();
					//System.out.println("next = " + next);
					if (next == s[p].seg) {

						// Se existe segmento acima e eles se interceptam em
						// algum ponto
						if (temp.hasNext()) {

							int seg2 = temp.next();

							//System.out.println("1x = " + s[p].x + ", y = " + s[p].y + ", p = " + p);

							Ponto fim1 = buscaPonto(s, p, s[p].seg, false);
							Ponto ini2 = buscaPonto(s, 0, seg2, true);
							Ponto fim2 = buscaPonto(s, p, seg2, false);

							if (fim1 != null && ini2 != null && fim2 != null) {

								if (segmentosSeInterceptam(s[p], fim1, ini2, fim2)) {
									return true;
								}
							}
						}

						// Se existe segmento abaixo e eles se interceptam em
						// algum ponto
						if (ant != -1) {
							// temp = ant;
							int segAnt = ant;

							//System.out.println("2x = " + s[p].x + ", y = " + s[p].y + ", p = " + p);

							Ponto iniAnt = buscaPonto(s, 0, segAnt, true);
							Ponto fimAnt = buscaPonto(s, p, segAnt, false);
							Ponto fim1 = buscaPonto(s, p, s[p].seg, false);

							if (fim1 != null && iniAnt != null && fimAnt != null) {
								if (segmentosSeInterceptam(iniAnt, fimAnt, s[p], fim1)) {
									return true;
								}
							}

						}

					}

					ant = next;
				}
			} else if (!s[p].esq) {

				it = ll.iterator();
				ant = -1;

				while (it.hasNext()) {

					Iterator<Integer> temp = it;
					int next = temp.next();
					//System.out.println("next = " + next);
					if (next == s[p].seg) {

						// Se existe um segmento acima e outro abaixo do atual
						if ((ant != -1)) {

							int seg2 = next;

							//System.out.println("3x = " + s[p].x + ", y = " + s[p].y + ", p = " + p);

							Ponto ini2 = buscaPonto(s, 0, seg2, true);
							Ponto fim2 = buscaPonto(s, p, seg2, false);

							// Iterator<Integer> temp2 = ant;
							int segAnt = ant;
							Ponto iniAnt = buscaPonto(s, 0, segAnt, true);
							Ponto fimAnt = buscaPonto(s, p, segAnt, false);

							if (fimAnt != null && ini2 != null && fim2 != null && iniAnt != null && segAnt != seg2) {
								if (segmentosSeInterceptam(ini2, fim2, iniAnt, fimAnt)) {
									return true;
								}
							}
						}

					}

					ant = next;
				}
				Integer rem = s[p].seg;
				ll.remove(rem);

			}

		}
		return false;
	}

	Ponto buscaPonto(Ponto[] s, int ini, int seg, boolean esq) {
		for (int i = ini; ini < s.length; i++) {
			if (s[i].seg == seg && s[i].esq == esq) {
				return s[i];
			}
		}
		return null;
	}

	void ordenaExtremidades(Ponto[] s) {

		for (int i = 1; i < s.length; i++) {

			Ponto v = s[i];
			int j = i;

			while ((j > 0)) {
				if (s[j - 1].x > v.x) {
					s[j] = s[j - 1];
					j--;
				} else if (s[j - 1].x == v.x) {
					if (!s[j - 1].esq && v.esq) {
						s[j] = s[j - 1];
						j--;
					} else if (s[j - 1].esq == v.esq) {
						if (s[j - 1].y > v.y) {
							s[j] = s[j - 1];
							j--;
						} else {
							break;
						}
					} else {
						break;
					}
				} else {
					break;
				}
			}
			s[j] = v;

		}
	}

	public static void main(String[] args) {

		GuardDuty gd = new GuardDuty();
		Scanner in = new Scanner(System.in);

		int r = in.nextInt();
		int b = in.nextInt();

		if (r != b) {
			System.out.println("No");
			in.close();
			System.exit(0);
			//return;
		}

		Ponto[] navesBases = new Ponto[r + b];

		int x, y;
		// Naves na primeira metade
		for (int i = 0; i < r; i++) {

			x = in.nextInt();
			y = in.nextInt();

			navesBases[i] = new Ponto(x, y, true);
		}

		// Bases na segunda metade
		for (int j = r; j < navesBases.length; j++) {

			x = in.nextInt();
			y = in.nextInt();

			navesBases[j] = new Ponto(x, y, false);
		}

		for (int k = 0; k < r; k++) {
			for (int l = r; l < navesBases.length; l++) {
				navesBases[l].seg = l - r + 1;

				if (l + k - r < r) {
					navesBases[l + k - r].seg = l - r + 1;

					if (navesBases[l].x < navesBases[l + k - r].x) {
						navesBases[l].esq = true;
						navesBases[l + k - r].esq = false;
					} else {
						navesBases[l].esq = false;
						navesBases[l + k - r].esq = true;
					}

				} else {

					navesBases[l + k - 2 * r].seg = l - r + 1;
					if (navesBases[l].x < navesBases[l + k - 2 * r].x) {

						navesBases[l].esq = true;
						navesBases[l + k - 2 * r].esq = false;
					} else {
						navesBases[l].esq = false;
						navesBases[l + k - 2 * r].esq = true;
					}

				}

			}

			if(gd.nSegmentosInterceptam(navesBases)) {
				System.out.println("Yes");
				in.close();
				System.exit(1);
				//return;
			}
		}

		System.out.println("No");
		in.close();
		System.exit(0);
	}

}

class Ponto {

	public int x;
	public int y;
	public int seg;
	public boolean esq;
	public boolean nave;

	public Ponto(int x, int y, boolean nave) {
		super();
		this.x = x;
		this.y = y;
		this.nave = nave;
	}

}


import java.util.*;

public class Contest {

	public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
	int  [] a = new int[3] ;
	a[0] = scanner.nextInt();
	a[1] = scanner.nextInt();
	a[2]= scanner.nextInt();
	Set<Integer> vals = new HashSet<Integer>();
	//int [] val = new int[1501];
	 Arrays.sort(a);
	int initVal = 1;
	while(initVal<1500) {
		vals.add(initVal);
	//	System.out.println(initVal);
		initVal+=a[0];

	}
	 initVal = 2;
	 while(initVal<1500) {
		// System.out.println(initVal);
			vals.add(initVal);
			initVal+=a[1];

	}
	 while(!vals.contains(initVal)) {
		 initVal++;
	 }
	 while(initVal<1500) {
		// System.out.println(vals);
			vals.add(initVal);
			initVal+=a[2];

	}
	 if(vals.size()>=1499) {
		 System.out.println("YES");
	 }
	 else {
		 System.out.println("NO");
	 }
	scanner.close();
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
public class R466A  {
    static int min,ans=101;
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n = in.nextInt();
        min = in.nextInt();
        TreeSet<Integer> ts = new TreeSet<>();
        for (int i = 0; i < n; i++)
            ts.add(in.nextInt());
        doit(0, ts);
        w.println(ans);
        w.close();
    }

    static void doit(int x, TreeSet<Integer> ts) {
        if (ts.last() - ts.first() <= min){
            ans=Math.min(min,x);
            return;
        }
        TreeSet<Integer> ts1 = (TreeSet)ts.clone(), ts2 = (TreeSet)ts.clone();
        ts1.pollFirst();
        ts2.pollLast();
        doit(x + 1, ts1);
        doit(x + 1, ts2);

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

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

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

        public int 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 void skip(int x) {
            while (x-- > 0)
                read();
        }

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

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

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

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

            return res.toString();
        }

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

        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 int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

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

    }
}