#include using namespace std; const int maxn = 3e6, mod = 1e9 + 7; int t, n; int f[maxn + 10][21], ans; char s[maxn + 10]; void addto(int &x, int y) { x += y; if (x >= mod) x -= mod; } int main() { scanf("%d", &t); while (t--) { scanf("%s", s + 1); n = strlen(s + 1) + 1; for (int i = 1; i <= n; ++i) for (int j = 0; j < 21; ++j) f[i][j] = 0; for (int i = 0; i < 21; ++i) f[0][i] = 1; ans = 0; for (int i = 1; i <= n; ++i) { for (int j = 0; j < 21; ++j) if (i >> j & 1) { if (s[i] != '+') { addto(f[i][0], f[i ^ (1 << j)][j]); if (i == n) addto(ans, f[i ^ (1 << j)][j]); } addto(f[i][j], f[i ^ (1 << j)][j]); } for (int j = 1; j < 21; ++j) addto(f[i][j], f[i][j - 1]); } printf("%d %d\n", n, ans); } }