#include #include const int M = 1000000007; const int _n = 5000000; int T; char s[_n]; int n; int bit, nn; int x[_n], y[_n], f[_n]; void solve(int l, int r) { if (l == r) { y[l] = x[l]; return; } int mid = (l + r) >> 1; solve(l, mid); for (int i = mid + 1; i <= r; i++) { if (! f[i]) { (x[i] += y[l + i - mid - 1]) %= M; } } solve(mid + 1, r); for (int i = mid + 1; i <= r; i++) { (y[i] += y[l + i - mid - 1]) %= M; } } int main() { scanf("%d", &T); while (T--) { scanf("%s", s + 1); n = strlen(s + 1) + 1; bit = 0; nn = 1; while (nn <= n) { nn <<= 1; bit++; } for (int i = 0; i < nn; i++) { x[i] = 0; y[i] = 0; f[i] = 0; } for (int i = 1; i < n; i++) { if (s[i] == '+') { f[i] = 1; } } x[0] = 1; y[0] = 1; solve(0, nn - 1); printf("%d %d\n", n, x[n]); } return 0; }