#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
string a, b;
int pos;
int pos2;
int qt;
int jeitos;
double dfs(int x, int p) {
  if (x == b.size()) {
    jeitos++;
    if (p == pos)
      return 1;
    else
      return 0;
  }
  double p1 = dfs(x + 1, p + 1);
  double p2 = dfs(x + 1, p - 1);
  return p1 + p2;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++)
    if (a[i] == '+')
      pos++;
    else
      pos--;
  sort(b.begin(), b.end());
  for (int i = 0; i < b.size(); i++)
    if (b[i] == '+')
      pos2++;
    else if (b[i] == '-')
      pos2--;
    else
      qt++;
  if (pos2 == pos && qt == 0) {
    cout << "1.000000000000" << endl;
    return 0;
  }
  double ans = dfs(b.size() - qt, pos2);
  if (ans == 0 or qt < pos2 - pos) {
    cout << "0.000000000000" << endl;
    return 0;
  }
  ans = jeitos / ans;
  printf("%.12f", 1 / ans);
  cout << endl;
  return 0;
}
