#include <bits/stdc++.h>
char s[16], p[16];
int i, t;
std::map<int, double> d, nd;
int main() {
  gets(s);
  gets(p);
  for (d[0] = 1; s[i]; i++) {
    t += 44 - s[i];
    nd.clear();
    for (auto x : d)
      if (p[i] == '?')
        nd[x.first + 1] += x.second / 2, nd[x.first - 1] += x.second / 2;
      else
        nd[x.first + 44 - p[i]] += x.second;
    d = nd;
  }
  printf("%.10lf", d[t]);
}
