#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, const pair<T, T> &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, const pair<const T, T> &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, const array<T, 3> &p) {
  return os << "(" << p[0] << "," << p[1] << "," << p[2] << ")";
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &p) {
  for (auto x : p) os << x << ' ';
  return os;
}
const double EPS = 1e-9;
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;
const int SZ = 1e5 + 20;
double dp[100][100];
string x, y;
int n = 50;
double pd(int i, int j) {
  if (dp[i][j] != -1) return dp[i][j];
  if (j == 0) {
    if (y[j] == '?' && abs(50 - i) == 1)
      dp[i][j] = 0.5;
    else if (y[j] == '+' && i == 51)
      dp[i][j] = 1.0;
    else if (y[j] == '-' && i == 49)
      dp[i][j] = 1.0;
    else
      dp[i][j] = 0.0;
    return dp[i][j];
  }
  if (y[j] == '+') {
    return dp[i][j] = pd(i - 1, j - 1);
  } else if (y[j] == '-') {
    return dp[i][j] = pd(i + 1, j - 1);
  } else {
    return dp[i][j] = pd(i + 1, j - 1) / 2.0 + pd(i - 1, j - 1) / 2.0;
  }
}
int main() {
  for (int i = 0; i < 100; i++)
    for (int j = 0; j < 100; j++) dp[i][j] = -1;
  cin >> x >> y;
  for (auto c : x) {
    if (c == '+')
      n++;
    else
      n--;
  }
  printf("%.12lf\n", pd(n, y.size() - 1));
  return 0;
}
