#include<bits/stdc++.h>usingnamespace std;constint mod =1e9+7;intmain(){int T; cin >> T;while(T--){
string s; cin >> s;
ll ans =1;int a =0, b = s.length()-1;while(s[a]=='?')++a;while(s[b]=='?')--b;for(int i = a; i <= b;++i){if(s[i]=='?'){int t = i;while(s[t]=='?')++t;if(s[i-1]!= s[t]) ans =(ans *((t - i +1)% mod))% mod;
i = t;}}
cout << ans << endl;}return0;}