#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
string a, b;
int p1 = 0, p2 = 0, n1 = 0, n2 = 0, q = 0, c1 = 0, c2 = 0, pa = 0, na = 0;
double r = 0.0;
char arr[12];
void print(int x, int s) {
  pa = 0;
  na = 0;
  int i = s - 1;
  while (x || i >= 0) {
    if (b[i] == '?') {
      if (x & 1) {
        arr[i] = '+';
        pa++;
      } else {
        arr[i] = '-';
        na++;
      }
      x >>= 1;
    }
    i--;
  }
  if (((pa - na) + c2) == c1) {
    r++;
  }
}
void create(int n, int siz) {
  int s = (1 << n);
  for (int i = 0; i < s; i++) {
    print(i, siz);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> a >> b;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] == '+') {
      p1++;
    } else if (a[i] == '-') {
      n1++;
    }
  }
  c1 = p1 - n1;
  for (int i = 0; i < b.length(); i++) {
    if (b[i] == '+') {
      p2++;
    } else if (b[i] == '-') {
      n2++;
    } else {
      q++;
    }
  }
  c2 = p2 - n2;
  create(q, b.length());
  cout << fixed << setprecision(9) << (r / (pow(2, (q * 1.0)))) << endl;
  return 0;
}
