#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string a, b;
  cin >> a >> b;
  double pos[40], t[40];
  memset(pos, 0, sizeof(pos));
  pos[20] = 1;
  for (int i = 0; i < b.size(); i++) {
    if (b[i] == '+')
      for (int j = 39; j > 0; j--)
        if (pos[j] > 0) {
          pos[j + 1] = pos[j];
          pos[j] = 0;
        }
    if (b[i] == '-')
      for (int j = 0; j < 40; j++)
        if (pos[j] > 0) {
          pos[j - 1] = pos[j];
          pos[j] = 0;
        }
    if (b[i] == '?') {
      memset(t, 0, sizeof(t));
      for (int j = 1; j < 39; j++) {
        {
          t[j + 1] += pos[j];
          t[j - 1] += pos[j];
        }
      }
      for (int j = 0; j < 40; j++) pos[j] = t[j];
    }
  }
  int val = 0;
  for (int i = 0; i < b.size(); i++)
    if (a[i] == '+')
      val++;
    else
      val--;
  double ans = pos[val + 20], sum = 0;
  for (int i = 0; i < 40; i++) sum += pos[i];
  ans = ans / sum;
  cout << fixed << setprecision(12) << ans << ("\n");
  return 0;
}
