Problem: Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.

Each command is one of the following two types: 

  1. Go 1 unit towards the positive direction, denoted as '+'
  2. Go 1 unit towards the negative direction, denoted as '-'



But the Wi-Fi condition is so poor that Dreamoon's smartphone reports some of the commands can't be recognized and Dreamoon knows that some of them might even be wrong though successfully recognized. Dreamoon decides to follow every recognized command and toss a fair coin to decide those unrecognized ones (that means, he moves to the 1 unit to the negative or positive direction with the same probability 0.5). 

You are given an original list of commands sent by Drazil and list received by Dreamoon. What is the probability that Dreamoon ends in the position originally supposed to be final by Drazil's commands?

Input

The first line contains a string s1 — the commands Drazil sends to Dreamoon, this string consists of only the characters in the set {'+', '-'}. 

The second line contains a string s2 — the commands Dreamoon's smartphone recognizes, this string consists of only the characters in the set {'+', '-', '?'}. '?' denotes an unrecognized command.

Lengths of two strings are equal and do not exceed 10.

Output

Output a single real number corresponding to the probability. The answer will be considered correct if its relative or absolute error doesn't exceed 10 - 9.

Examples

Input

++-+-
+-+-+


Output

1.000000000000


Input

+-+-
+-??


Output

0.500000000000


Input

+++
??-


Output

0.000000000000

Note

For the first sample, both s1 and s2 will lead Dreamoon to finish at the same position  + 1. 

For the second sample, s1 will lead Dreamoon to finish at position 0, while there are four possibilites for s2: {"+-++", "+-+-", "+--+", "+---"} with ending position {+2, 0, 0, -2} respectively. So there are 2 correct cases out of 4, so the probability of finishing at the correct position is 0.5. 

For the third sample, s2 could only lead us to finish at positions {+1, -1, -3}, so the probability to finish at the correct position  + 3 is 0.

Solution (in JAVA):

Solution:

import java.awt.Point;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;

public class Main {

    static int score = 0;

    public static void main(String[] args) throws IOException {
        //Scanner in = new Scanner(System.in);
        //Scanner in=new Scanner(new File("input.txt"));
        //PrintWriter out=new PrintWriter(System.out);
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        String c = in.next();
        String r = in.next();
        int correct = 0;
        for (int i = c.length() - 1; i >= 0; i--) {
            correct = c.charAt(i) == '+' ? correct + 1 : correct - 1;
        }
        int recieved = 0;
        int alamatSoal = 0;
        for (int i = r.length() - 1; i >= 0; i--) {
            if (r.charAt(i) == '+') {
                recieved++;
            } else if (r.charAt(i) == '-') {
                recieved--;
            } else {
                alamatSoal++;
            }
        }
        float soorat;
        float makhraj = 1f;
        int ekhtelaf = correct - recieved;
        if (correct == recieved && alamatSoal == 0) {
            soorat = makhraj = 1f;
        } else {
            if (alamatSoal == 0) {
                soorat = 0f;
            } else {
                if (Math.abs(ekhtelaf) <= Math.abs(alamatSoal)) {
                    int mosbatha = (ekhtelaf + alamatSoal) / 2;
                    soorat = Algorithm.C(alamatSoal, mosbatha);
                    makhraj = (float) Math.pow(2, alamatSoal);
                } else {
                    soorat = 0f;
                }
            }
        }
        out.format("%.12f\n", soorat / makhraj);
        out.close();
    }
    
    static class Algorithm {

        static HashSet<Integer> NumbersFrom(String digitsString) {
            int[] digits = new int[10];
            for (int i = digitsString.length() - 1; i >= 0; i--) {
                if (digitsString.charAt(i) >= '0' && digitsString.charAt(i) <= '9') {
                    digits[digitsString.charAt(i) - '0']++;
                }
            }
            return NumbersFrom(digits);
        }

        static HashSet<Integer> NumbersFrom(int[] digits) {
            int maxDigit = 0;
            for (int i = 0; i < digits.length; i++) {
                maxDigit += digits[i];
            }
            return NumbersFrom(digits, maxDigit);
        }

        static HashSet<Integer> NumbersFrom(int[] digits, int maxDigit) {
            ArrayList<Integer> list = new ArrayList<Integer>();
            for (int i = 0; i < digits.length; i++) {
                if (digits[i] > 0) {
                    list.add(i);
                }
            }
            int t1 = 0;
            int t2 = list.size();
            for (int i = 1; i < maxDigit; i++) {
                for (int j = t1; j < t2; j++) {
                    int number = list.get(j);
                    int temp = number;
                    while (temp > 0) {
                        digits[temp % 10]--;
                        temp /= 10;
                    }

                    for (int k = 0; k < 10; k++) {
                        if (digits[k] > 0) {
                            list.add(number * 10 + k);
                        }
                    }
                    while (number > 0) {
                        digits[number % 10]++;
                        number /= 10;
                    }
                }
                t1 = t2;
                t2 = list.size();
            }
            HashSet<Integer> set = new HashSet<Integer>(list);

            return set;
        }

        static long C(int n, int r) {
            if (r < n / 2) {
                return C(n, n - r);
            }
            return ZarbeMotevali(r + 1, n) / Fact(n - r);
        }

        private static long ZarbeMotevali(int first, int end) {
            long answer = 1;
            for (long i = first; i <= end; i++) {
                answer *= i;
            }
            return answer;
        }

        private static long Fact(int n) {
            return ZarbeMotevali(2, n);
        }
    }
}

class Graph {

    private int[][] matrix;
    private boolean[] visited;
    private Stack<Integer> DFS;

    public Graph(int[][] matrix) {
        this.matrix = matrix;
        this.DFS = new Stack<>();
        this.visited = new boolean[matrix.length];
    }

    public Stack<Integer> getDFS() {
        this.DFS(0);
        return DFS;
    }

    public Stack<Integer> getDFS(int vertex) {
        this.DFS.clear();
        this.DFS(vertex);
        return this.DFS;
    }

    private void DFS(int vertrx) {
        this.DFS.push(vertrx);
        this.visited[vertrx] = true;

        for (int i = 0; i < this.matrix[vertrx].length; i++) {
            if (this.matrix[vertrx][i] != 0 && !this.visited[i] && vertrx != i) {
                this.DFS(i);
            }
        }
    }
}

class FastScanner {

    private InputStream stream;
    private byte[] buffer = new byte[1024];
    private int curChar;
    private int numChars;

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

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

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

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

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

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

    float nextFloat() {
        return Float.parseFloat(next());
    }

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

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

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