/*
Reference:
競プロ初心者日記 #25「World Tour Finals2019 Eの解説を解説する」
https://www.nicovideo.jp/watch/sm35888883

ｺﾄﾉﾊｼﾏｲｶｼｺｲﾔｯﾀｰ
*/

//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

template <int p>
struct Modint
{
    int value;

    Modint() : value(0) {}
    Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {}

    inline Modint &operator+=(const Modint &b)
    {
        if ((this->value += b.value) >= p)
            this->value -= p;
        return (*this);
    }
    inline Modint &operator-=(const Modint &b)
    {
        if ((this->value += p - b.value) >= p)
            this->value -= p;
        return (*this);
    }
    inline Modint &operator*=(const Modint &b)
    {
        this->value = (int)((1LL * this->value * b.value) % p);
        return (*this);
    }
    inline Modint &operator/=(const Modint &b)
    {
        (*this) *= b.inverse();
        return (*this);
    }

    Modint operator+(const Modint &b) const { return Modint(*this) += b; }
    Modint operator-(const Modint &b) const { return Modint(*this) -= b; }
    Modint operator*(const Modint &b) const { return Modint(*this) *= b; }
    Modint operator/(const Modint &b) const { return Modint(*this) /= b; }

    inline Modint &operator++(int) { return (*this) += 1; }
    inline Modint &operator--(int) { return (*this) -= 1; }

    inline bool operator==(const Modint &b) const
    {
        return this->value == b.value;
    }
    inline bool operator!=(const Modint &b) const
    {
        return this->value != b.value;
    }
    inline bool operator<(const Modint &b) const
    {
        return this->value < b.value;
    }
    inline bool operator<=(const Modint &b) const
    {
        return this->value <= b.value;
    }
    inline bool operator>(const Modint &b) const
    {
        return this->value > b.value;
    }
    inline bool operator>=(const Modint &b) const
    {
        return this->value >= b.value;
    }

    // requires that "this->value and p are co-prime"
    // a_i * v + a_(i+1) * p = r_i
    // r_i = r_(i+1) * q_(i+1) * r_(i+2)
    // q == 1 (i > 1)
    // reference: https://atcoder.jp/contests/agc026/submissions/2845729
    // (line:93)
    inline Modint inverse() const
    {
        assert(this->value != 0);
        int r0 = p, r1 = this->value, a0 = 0, a1 = 1;
        while (r1)
        {
            int q = r0 / r1;
            r0 -= q * r1;
            swap(r0, r1);
            a0 -= q * a1;
            swap(a0, a1);
        }
        return Modint(a0);
    }

    friend istream &operator>>(istream &is, Modint<p> &a)
    {
        long t;
        is >> t;
        a = Modint<p>(t);
        return is;
    }
    friend ostream &operator<<(ostream &os, const Modint<p> &a)
    {
        return os << a.value;
    }
};

/*
verified @ https://atcoder.jp/contests/abc034/submissions/4316971
*/

const int MOD = 1e9 + 7;

using Int = Modint<MOD>;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void integrate(akari<Int> &P, akari<Int> &Q, Int &C, const akari<Int> &P1, const akari<Int> &Q1, const Int &C1, int m, bool up)
{
    if (up)
    {
        for (int i = 0; i <= m; i++)
        {
            P[0] += P1[i] / Int(i + 1);
            P[i + 1] += P1[i] / Int(-(i + 1));
        }
        for (int i = 0; i <= m; i++)
        {
            Q[0] += Q1[i] / Int(i + 1);
            Q[i + 1] += Q1[i] / Int(-(i + 1));
        }
        Q[0] -= C1;
        C += C1;
    }
    else
    {
        for (int i = 0; i <= m; i++)
        {
            P[i + 1] += P1[i] / Int(i + 1);
        }
        for (int i = 0; i <= m; i++)
        {
            Q[i + 1] += Q1[i] / Int(i + 1);
        }
        P[0] += C1;
        C -= C1;
    }
}

void solve()
{
    int n;
    seika s;
    cin >> n >> s;

    maki<akari<Int>> Ps(2, yukari<akari<Int>>(2, akari<akari<Int>>(2, akari<Int>(1)))), Qs(Ps);
    maki<Int> C(2, yukari<Int>(2, akari<Int>(2)));

    Ps[1][1][1][0] = 1;
    C[0][1][1] = 1;
    C[1][1][1] = -1;
    for (int i = 0; i < n; i++)
    {
        maki<akari<Int>> nxPs(2, yukari<akari<Int>>(2, akari<akari<Int>>(2, akari<Int>(i + 2)))), nxQs(nxPs);
        maki<Int> nxC(2, yukari<Int>(2, akari<Int>(2)));
        if (s[i] == 'X')
        {
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[0][0][1], Qs[0][0][1], C[0][0][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][0][1], Qs[1][0][1], C[1][0][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, true);

            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, false);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, false);
        }
        else
        {
            integrate(nxPs[1][1][1], nxQs[1][1][1], nxC[1][1][1], Ps[0][1][0], Qs[0][1][0], C[0][1][0], i, false);
            integrate(nxPs[1][1][1], nxQs[1][1][1], nxC[1][1][1], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, false);

            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[0][1][0], Qs[0][1][0], C[0][1][0], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, true);

            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, false);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, false);
        }
        swap(Ps, nxPs);
        swap(Qs, nxQs);
        swap(C, nxC);
    }

    akari<Int> ans(3);
    //I_k = a_k + b_k / e
    Int a = 1, b = Int(-1);
    for (int i = 0; i <= n; i++)
    {
        //[1][1]
        ans[0] += Ps[0][1][1][i] / Int(i + 1);
        ans[0] += Ps[1][1][1][i] / Int(i + 1);
        ans[1] += Qs[0][1][1][i] / Int(i + 1);
        ans[1] += Qs[1][1][1][i] / Int(i + 1);
        if (!i)
        {
            ans[0] += C[0][1][1] + C[1][1][1];
            ans[1] -= C[0][1][1] + C[1][1][1];
        }

        //[0][1]
        ans[0] += Ps[0][0][1][i] / Int(i + 1);
        ans[0] += Ps[1][0][1][i] / Int(i + 1);
        ans[1] += Qs[0][0][1][i] / Int(i + 1);
        ans[1] += Qs[1][0][1][i] / Int(i + 1);
        if (!i)
        {
            ans[0] += C[0][0][1] + C[1][0][1];
            ans[1] -= C[0][0][1] + C[1][0][1];
        }

        ans[0] -= Ps[0][0][1][i] * a;
        ans[0] -= Ps[1][0][1][i] * a;
        ans[1] -= Qs[0][0][1][i] * a;
        ans[1] -= Qs[1][0][1][i] * a;

        ans[1] -= Ps[0][0][1][i] * b;
        ans[1] -= Ps[1][0][1][i] * b;
        ans[2] -= Qs[0][0][1][i] * b;
        ans[2] -= Qs[1][0][1][i] * b;
        if (!i)
        {
            ans[0] -= (C[0][0][1] + C[1][0][1]) / 2;
            ans[2] += (C[0][0][1] + C[1][0][1]) / 2;
        }

        //[1][0]
        ans[0] += Ps[0][1][0][i] * a;
        ans[0] += Ps[1][1][0][i] * a;
        ans[1] += Qs[0][1][0][i] * a;
        ans[1] += Qs[1][1][0][i] * a;

        ans[1] += Ps[0][1][0][i] * b;
        ans[1] += Ps[1][1][0][i] * b;
        ans[2] += Qs[0][1][0][i] * b;
        ans[2] += Qs[1][1][0][i] * b;
        if (!i)
        {
            ans[0] += (C[0][1][0] + C[1][1][0]) / 2;
            ans[2] -= (C[0][1][0] + C[1][1][0]) / 2;
        }

        a *= i + 1;
        b = Int(i + 1) * b - 1;
    }
    print(ans[0], ans[1], ans[2]);
}

int main()
{
    solve();
    return 0;
}
### Prompt

Construct a cpp code solution to the problem outlined:

There is a very long bench. The bench is divided into M sections, where M is a very large integer.

Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:

* We call a section comfortable if the section is currently unoccupied and is not adjacent to any occupied sections. If there is no comfortable section, the person leaves the bench. Otherwise, the person chooses one of comfortable sections uniformly at random, and sits there. (The choices are independent from each other).



After all M people perform actions, Snuke chooses an interval of N consecutive sections uniformly at random (from M-N+1 possible intervals), and takes a photo. His photo can be described by a string of length N consisting of `X` and `-`: the i-th character of the string is `X` if the i-th section from the left in the interval is occupied, and `-` otherwise. Note that the photo is directed. For example, `-X--X` and `X--X-` are different photos.

What is the probability that the photo matches a given string s? This probability depends on M. You need to compute the limit of this probability when M goes infinity.

Here, we can prove that the limit can be uniquely written in the following format using three rational numbers p, q, r and e = 2.718 \ldots (the base of natural logarithm):

p + \frac{q}{e} + \frac{r}{e^2}

Your task is to compute these three rational numbers, and print them modulo 10^9 + 7, as described in Notes section.

Constraints

* 1 \leq N \leq 1000
* |s| = N
* s consists of `X` and `-`.

Input

Input is given from Standard Input in the following format:


N
s


Output

Print three rational numbers p, q, r, separated by spaces.

Examples

Input

1
X


Output

500000004 0 500000003


Input

3
---


Output

0 0 0


Input

5
X--X-


Output

0 0 1


Input

5
X-X-X


Output

500000004 0 833333337


Input

20
-X--X--X-X--X--X-X-X


Output

0 0 183703705


Input

100
X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X--X-X-X-X--X--X-X-X--X-X-X--X-X--X--X-X--X-X-X-


Output

0 0 435664291

### Response

```cpp
/*
Reference:
競プロ初心者日記 #25「World Tour Finals2019 Eの解説を解説する」
https://www.nicovideo.jp/watch/sm35888883

ｺﾄﾉﾊｼﾏｲｶｼｺｲﾔｯﾀｰ
*/

//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

template <int p>
struct Modint
{
    int value;

    Modint() : value(0) {}
    Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {}

    inline Modint &operator+=(const Modint &b)
    {
        if ((this->value += b.value) >= p)
            this->value -= p;
        return (*this);
    }
    inline Modint &operator-=(const Modint &b)
    {
        if ((this->value += p - b.value) >= p)
            this->value -= p;
        return (*this);
    }
    inline Modint &operator*=(const Modint &b)
    {
        this->value = (int)((1LL * this->value * b.value) % p);
        return (*this);
    }
    inline Modint &operator/=(const Modint &b)
    {
        (*this) *= b.inverse();
        return (*this);
    }

    Modint operator+(const Modint &b) const { return Modint(*this) += b; }
    Modint operator-(const Modint &b) const { return Modint(*this) -= b; }
    Modint operator*(const Modint &b) const { return Modint(*this) *= b; }
    Modint operator/(const Modint &b) const { return Modint(*this) /= b; }

    inline Modint &operator++(int) { return (*this) += 1; }
    inline Modint &operator--(int) { return (*this) -= 1; }

    inline bool operator==(const Modint &b) const
    {
        return this->value == b.value;
    }
    inline bool operator!=(const Modint &b) const
    {
        return this->value != b.value;
    }
    inline bool operator<(const Modint &b) const
    {
        return this->value < b.value;
    }
    inline bool operator<=(const Modint &b) const
    {
        return this->value <= b.value;
    }
    inline bool operator>(const Modint &b) const
    {
        return this->value > b.value;
    }
    inline bool operator>=(const Modint &b) const
    {
        return this->value >= b.value;
    }

    // requires that "this->value and p are co-prime"
    // a_i * v + a_(i+1) * p = r_i
    // r_i = r_(i+1) * q_(i+1) * r_(i+2)
    // q == 1 (i > 1)
    // reference: https://atcoder.jp/contests/agc026/submissions/2845729
    // (line:93)
    inline Modint inverse() const
    {
        assert(this->value != 0);
        int r0 = p, r1 = this->value, a0 = 0, a1 = 1;
        while (r1)
        {
            int q = r0 / r1;
            r0 -= q * r1;
            swap(r0, r1);
            a0 -= q * a1;
            swap(a0, a1);
        }
        return Modint(a0);
    }

    friend istream &operator>>(istream &is, Modint<p> &a)
    {
        long t;
        is >> t;
        a = Modint<p>(t);
        return is;
    }
    friend ostream &operator<<(ostream &os, const Modint<p> &a)
    {
        return os << a.value;
    }
};

/*
verified @ https://atcoder.jp/contests/abc034/submissions/4316971
*/

const int MOD = 1e9 + 7;

using Int = Modint<MOD>;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void integrate(akari<Int> &P, akari<Int> &Q, Int &C, const akari<Int> &P1, const akari<Int> &Q1, const Int &C1, int m, bool up)
{
    if (up)
    {
        for (int i = 0; i <= m; i++)
        {
            P[0] += P1[i] / Int(i + 1);
            P[i + 1] += P1[i] / Int(-(i + 1));
        }
        for (int i = 0; i <= m; i++)
        {
            Q[0] += Q1[i] / Int(i + 1);
            Q[i + 1] += Q1[i] / Int(-(i + 1));
        }
        Q[0] -= C1;
        C += C1;
    }
    else
    {
        for (int i = 0; i <= m; i++)
        {
            P[i + 1] += P1[i] / Int(i + 1);
        }
        for (int i = 0; i <= m; i++)
        {
            Q[i + 1] += Q1[i] / Int(i + 1);
        }
        P[0] += C1;
        C -= C1;
    }
}

void solve()
{
    int n;
    seika s;
    cin >> n >> s;

    maki<akari<Int>> Ps(2, yukari<akari<Int>>(2, akari<akari<Int>>(2, akari<Int>(1)))), Qs(Ps);
    maki<Int> C(2, yukari<Int>(2, akari<Int>(2)));

    Ps[1][1][1][0] = 1;
    C[0][1][1] = 1;
    C[1][1][1] = -1;
    for (int i = 0; i < n; i++)
    {
        maki<akari<Int>> nxPs(2, yukari<akari<Int>>(2, akari<akari<Int>>(2, akari<Int>(i + 2)))), nxQs(nxPs);
        maki<Int> nxC(2, yukari<Int>(2, akari<Int>(2)));
        if (s[i] == 'X')
        {
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[0][0][1], Qs[0][0][1], C[0][0][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][0][1], Qs[1][0][1], C[1][0][1], i, true);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, true);

            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, false);
            integrate(nxPs[0][1][0], nxQs[0][1][0], nxC[0][1][0], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, false);
        }
        else
        {
            integrate(nxPs[1][1][1], nxQs[1][1][1], nxC[1][1][1], Ps[0][1][0], Qs[0][1][0], C[0][1][0], i, false);
            integrate(nxPs[1][1][1], nxQs[1][1][1], nxC[1][1][1], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, false);

            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[0][1][0], Qs[0][1][0], C[0][1][0], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[0][1][1], Qs[0][1][1], C[0][1][1], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, true);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, true);

            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][0], Qs[1][1][0], C[1][1][0], i, false);
            integrate(nxPs[0][0][1], nxQs[0][0][1], nxC[0][0][1], Ps[1][1][1], Qs[1][1][1], C[1][1][1], i, false);
        }
        swap(Ps, nxPs);
        swap(Qs, nxQs);
        swap(C, nxC);
    }

    akari<Int> ans(3);
    //I_k = a_k + b_k / e
    Int a = 1, b = Int(-1);
    for (int i = 0; i <= n; i++)
    {
        //[1][1]
        ans[0] += Ps[0][1][1][i] / Int(i + 1);
        ans[0] += Ps[1][1][1][i] / Int(i + 1);
        ans[1] += Qs[0][1][1][i] / Int(i + 1);
        ans[1] += Qs[1][1][1][i] / Int(i + 1);
        if (!i)
        {
            ans[0] += C[0][1][1] + C[1][1][1];
            ans[1] -= C[0][1][1] + C[1][1][1];
        }

        //[0][1]
        ans[0] += Ps[0][0][1][i] / Int(i + 1);
        ans[0] += Ps[1][0][1][i] / Int(i + 1);
        ans[1] += Qs[0][0][1][i] / Int(i + 1);
        ans[1] += Qs[1][0][1][i] / Int(i + 1);
        if (!i)
        {
            ans[0] += C[0][0][1] + C[1][0][1];
            ans[1] -= C[0][0][1] + C[1][0][1];
        }

        ans[0] -= Ps[0][0][1][i] * a;
        ans[0] -= Ps[1][0][1][i] * a;
        ans[1] -= Qs[0][0][1][i] * a;
        ans[1] -= Qs[1][0][1][i] * a;

        ans[1] -= Ps[0][0][1][i] * b;
        ans[1] -= Ps[1][0][1][i] * b;
        ans[2] -= Qs[0][0][1][i] * b;
        ans[2] -= Qs[1][0][1][i] * b;
        if (!i)
        {
            ans[0] -= (C[0][0][1] + C[1][0][1]) / 2;
            ans[2] += (C[0][0][1] + C[1][0][1]) / 2;
        }

        //[1][0]
        ans[0] += Ps[0][1][0][i] * a;
        ans[0] += Ps[1][1][0][i] * a;
        ans[1] += Qs[0][1][0][i] * a;
        ans[1] += Qs[1][1][0][i] * a;

        ans[1] += Ps[0][1][0][i] * b;
        ans[1] += Ps[1][1][0][i] * b;
        ans[2] += Qs[0][1][0][i] * b;
        ans[2] += Qs[1][1][0][i] * b;
        if (!i)
        {
            ans[0] += (C[0][1][0] + C[1][1][0]) / 2;
            ans[2] -= (C[0][1][0] + C[1][1][0]) / 2;
        }

        a *= i + 1;
        b = Int(i + 1) * b - 1;
    }
    print(ans[0], ans[1], ans[2]);
}

int main()
{
    solve();
    return 0;
}
```