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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.StringTokenizer;

//import Number_theory.pair;

public class hacker49 {
	public static int r1=0;
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	static class pair{
		private long cnt;
		private long[] fq;
		private long[] pref;
		pair(){
			fq=new long[41];
			pref=new long[41];
			cnt=(long)0;
		}	
	}
	
	public static void main(String[] args) {
		OutputStream outputStream =System.out;
	    PrintWriter out =new PrintWriter(outputStream);
		FastReader s=new FastReader();
         String str1=s.next();
         String str2=s.next();
         for(int i=0;i<str1.length();i++) {
        	 if(str1.charAt(i)=='+') {
        		 get++;
        	 }else {
        		 get--;
        	 }
         }
         int count=0;
         int curr=0;
         for(int i=0;i<str2.length();i++) {
        	 if(str2.charAt(i)=='?') {
        		 count++;
        	 }else if(str2.charAt(i)=='+'){
        		 curr++;
        	 }else {
        		 curr--;
        	 }
         }
         double g=(double) Math.pow(2, count);
         ans(count,curr);
         double i=(h/g);
         out.printf("%.12f", i);
//System.out.println(h+" "+g);
        out.close();
	}
	static int get=0;
	static int h=0;
	static void  ans(int b,int sum) {
		if(b==0) {
			if(sum==get) {
				h++;
			}
			return;
		}else {
			ans(b-1,sum+1);
			ans(b-1,sum-1);
			
		}
		
		
	}
	static int lower(char[] b,int n) {
		int l=3;
		int r=n;
//		for(int i=0;i<32;i++) {
		while(r!=l) {
			int mid=(l+r)/2;
			if(good(b,mid)) {
				r=mid;
			}else {
				l=mid+1;
			}
		}
//		}
		if(r==(n)) {
			return 0;
		}else {
			return (r);
		}
	}
	static boolean good(char[] b,int k) {
		int[] a=new int[4];
		int l=1;
		int r=k+1;
//		System.out.println(k);
		int n=b.length;
		for(int i=1;i<=k;i++) {
			a[(int)(b[i]-'0')]++;
		}
		if(a[1]>0 && a[2]>0 && a[3]>0) {
			return true;
		}else {
			boolean p=false;
			while(r<n) {
				a[(int)(b[l]-'0')]--;
				a[(int)(b[r]-'0')]++;
				if(a[1]>0 && a[2]>0 && a[3]>0) {
					p=true;
					break;
				}
//				System.out.println(1);
				l++;
				r++;
			}
			if(p) {
				return true;
			}
			return false;
		}
	}
	static ArrayList<Long> d=new ArrayList<>(); 
	public static long res=1;
	public static void pf(long n) {
		
		 for (long i=1; i<=Math.sqrt(n); i++)
	        {
	            if (n%i==0)
	            {
	                // If divisors are equal, print only one
	                if (n/i == i) {
//	                    System.out.print(" "+ i);
	                	d.add(i);
	                }else { // Otherwise print both
	                    d.add(i);
	                    d.add(n/i);}
	            }
	        }	
	}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	public static void Create(long[] a,pair[] segtree,int low,int high,int pos) {
		if(low>high) {
			return;
		}
		if(low==high) {
			for(int i=1;i<=40;i++) {
				if(i==a[low]) {
					segtree[pos].fq[i]=1;
				}else {
					segtree[pos].fq[i]=0;
				}
				segtree[pos].pref[i]=segtree[pos].fq[i]+segtree[pos].pref[i-1];
			}
			
			return ;
		}
		int mid=(low+high)/2;
		Create(a,segtree,low,mid,2*pos);
		Create(a,segtree,mid+1,high,2*pos+1);
		pair a3=new pair();
		for(int i=1;i<=40;i++) {
			a3.fq[i]=segtree[2*pos].fq[i] +segtree[2*pos+1].fq[i];
			a3.pref[i]=a3.fq[i]+a3.pref[i-1];
		}
		for(int i=1;i<=40;i++) {
		a3.cnt+=segtree[2*pos].fq[i]*segtree[2*pos+1].pref[i-1];
		}
		a3.cnt+=segtree[2*pos].cnt+segtree[2*pos+1].cnt;
		for(int i=1;i<=40;i++) { 
		segtree[pos].fq[i]=a3.fq[i];
		 segtree[pos].pref[i]=a3.pref[i];} 
		segtree[pos].cnt=a3.cnt;
	}
	public static void update(pair[] segtree,int low,int high,int index,int pos,int val) {
		
		if(low==high && low==index) {
			for(int i=1;i<=40;i++) {
				if(i==val) {
					segtree[pos].fq[val]=1;
				}else {
					segtree[pos].fq[i]=0;
				}
				segtree[pos].pref[i]=segtree[pos].fq[i]+segtree[pos].pref[i-1];
			}
			segtree[pos].cnt=(long)0;
			return;
		}
			int mid=(high+low)/2; 
			if(index<=mid) {
			update(segtree,low,mid,index,2*pos,val);}else {
			 update(segtree,mid+1,high,index,2*pos+1,val);}
			pair a3=new pair();
			for(int i=1;i<=40;i++) {
				a3.fq[i]=segtree[2*pos].fq[i] +segtree[2*pos+1].fq[i];
				a3.pref[i]=a3.fq[i]+a3.pref[i-1];
			}
			for(int i=1;i<=40;i++) {
			a3.cnt+=segtree[2*pos].fq[i]*segtree[2*pos+1].pref[i-1];
			}
			a3.cnt+=segtree[2*pos].cnt+segtree[2*pos+1].cnt;
			for(int i=1;i<=40;i++) { 
			segtree[pos].fq[i]=a3.fq[i];
			 segtree[pos].pref[i]=a3.pref[i];} 
			segtree[pos].cnt=a3.cnt;
	}
	public static pair query(pair[] segtree,int low,int high,int qlow,int qhigh ,int pos) {
		if(low>=qlow && high<=qhigh) {
			return segtree[pos];
		}
		if(qhigh<low || qlow>high) {
			return new pair();
		}
		int mid=(low+high)/2;
		
	  pair a1=query(segtree,low,mid,qlow,qhigh,2*pos);
	  pair a2=query(segtree,mid+1,high,qlow,qhigh,2*pos+1);
	  pair a3=new pair();
	  for(int i=1;i<=40;i++) {
			a3.fq[i]=a1.fq[i] +a2.fq[i];
			a3.pref[i]=a3.fq[i]+a3.pref[i-1];
		}
		for(int i=1;i<=40;i++) {
			a3.cnt+=a1.fq[i]*a2.pref[i-1];
		}
		a3.cnt+=a1.cnt+a2.cnt;
	  return a3;
	  
	}
	
	public static long nextPowerOf2(long n) 
	{ 
	    n--; 
	    n |= n >> 1; 
	    n |= n >> 2; 
	    n |= n >> 4; 
	    n |= n >> 8; 
	    n |= n >> 16; 
	    n++;     
	    return n; 
	} 
	}