#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
constexpr ll mod=1e9+7;
class mint {
 private:
  ll _num,_mod;
  mint set(ll num){ 
      _num = num ;
      if(_num>=0) _num%=_mod;
      else _num+=(1-(_num+1)/_mod)*_mod; 
      return *this;
  }
  ll _mpow(ll x, ll n){ //x^n(mod) ←普通にpow(x,n)では溢れてしまうため，随時mod計算 2分累乗法だから早い
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % _mod;
        x = x*x % _mod;
        n = n >> 1;
    }
    return ans;
  }
  ll imod(ll n){return _mpow(n , _mod-2);}
 public:
  mint(){ _num = 0;_mod=mod; }
  mint(ll num){ _mod = mod; _num = (num+(1LL<<25)*mod) % mod; }
  mint(ll num,ll M){ _mod=M;_num=(num+(1LL<<25)*mod)%_mod; }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  mint operator= (const ll x){ return set(x); }
  mint operator+ (const ll x){ return mint(_num + (x % _mod) , _mod); }
  mint operator- (const ll x){ return mint(_num - (x % _mod), _mod); }
  mint operator* (const ll x){ return mint(_num * (x % _mod) , _mod); }
  mint operator/ (ll x){ return mint(_num * imod(x) , _mod);}
  mint operator+=(const ll x){ return set(_num + (x % _mod)); }
  mint operator-=(const ll x){ return set(_num - (x % _mod)); }
  mint operator*=(const ll x){ return set(_num * (x % _mod)); }
  mint operator/=(ll x){ return set(_num * imod(x));}
  mint operator+ (const mint &x){ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x){ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x){ return mint(_num * x._num , _mod); }
  mint operator/ (mint x){ return mint(_num * imod(x._num) , _mod);}
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(mint x){ return set(_num * imod(x._num));}

  bool operator<(const mint &x)const{return _num<x._num;}
  bool operator==(const mint &x)const{return _num==x._num;}
  bool operator>(const mint &x)const{return _num>x._num;}

  friend mint operator+(ll x,const mint &m){return mint(m._num + (x % m._mod) , m._mod);}
  friend mint operator-(ll x,const mint &m){return mint( (x % m._mod) - m._num , m._mod);}
  friend mint operator*(ll x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(ll x,mint m){return mint(m.imod(m._num) * x , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }

  friend ostream& operator<<(ostream &os, const mint &x){ os << x._num; return os; }
  friend istream& operator>>(istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};

typedef tuple<vector<mint>,vector<mint>,mint> T;
T sekibun(T &v,int state){
    vector<mint> p,q;
    mint c;
    tie(p,q,c)=v;
    if(state==0){
        p.push_back(0);
        q.push_back(0);
        for(int i=p.size()-1;i>0;--i){
            p[i]=p[i-1]/mint(i);
        }
        for(int i=q.size()-1;i>0;--i){
            q[i]=q[i-1]/mint(i);
        }
        p[0]=c;
        q[0]=0;
        c=mod-c;
    }
    else if(state==1){
        p.push_back(0);
        q.push_back(0);
        mint r=0;
        for(int i=p.size()-1;i>0;--i){
            p[i]=mod-p[i-1]/mint(i);
            r+=p[i-1]/mint(i);
        }
        p[0]=r;
        r=0;
        for(int i=q.size()-1;i>0;--i){
            q[i]=mod-q[i-1]/mint(i);
            r+=q[i-1]/mint(i);
        }
        q[0]=r-c;
    }
    else{
        p.push_back(0);
        q.push_back(0);
        mint r=0;
        REP(i,p.size()){
            r+=p[i]/mint(i+1);
            p[i]=0;
        }
        p[0]=r+c;
        r=0;
        REP(i,q.size()){
            r+=q[i]/mint(i+1);
            q[i]=0;
        }
        q[0]=r-c;
        c=0;
    }
    return tie(p,q,c);
}
T operator+(T a,T b){
    vector<mint> p(max(get<0>(a).size(),get<0>(b).size()))
                ,q(max(get<1>(a).size(),get<1>(b).size()));
    mint c=0;
    REP(i,get<0>(a).size()) p[i]+=get<0>(a)[i];
    REP(i,get<0>(b).size()) p[i]+=get<0>(b)[i];
    REP(i,get<1>(a).size()) q[i]+=get<1>(a)[i];
    REP(i,get<1>(b).size()) q[i]+=get<1>(b)[i];
    c=get<2>(a)+get<2>(b);
    return tie(p,q,c);
}

mint pre[1010][2];
void calc(){
    pre[0][0]=1;
    pre[0][1]=-1;
    rep(i,0,1005){
        pre[i+1][0]=pre[i][0]*mint(i+1);
        pre[i+1][1]=pre[i][1]*mint(i+1)-1;
    }
}
typedef tuple<mint,mint,mint> F;

F int_e(T f){
    F res; vector<mint> p=get<0>(f),q=get<1>(f);
    rep(i,0,p.size())get<0>(res)+=p[i]*pre[i][0],get<1>(res)+=p[i]*pre[i][1];
    rep(i,0,q.size())get<1>(res)+=q[i]*pre[i][0],get<2>(res)+=q[i]*pre[i][1];
    get<0>(res)+=get<2>(f)/2; get<2>(res)-=get<2>(f)/2; return res;
}
void t_add(F &a,F b){get<0>(a)+=get<0>(b),get<1>(a)+=get<1>(b),get<2>(a)+=get<2>(b);}
void t_dec(F &a,F b){get<0>(a)-=get<0>(b),get<1>(a)-=get<1>(b),get<2>(a)-=get<2>(b);}
int main(){
    int N;cin>>N;
    string S;cin>>S;calc();
    typedef vector<T> vt;
    typedef vector<vt> vvt;
    typedef vector<vvt> vvvt;
    vector<vvvt> dp(N+1,vvvt(2,vvt(2,vt(2))));
    dp[0][0][1][1]=T({0},{0},1);
    dp[0][1][1][1]=T({1},{0},-1);
    rep(i,1,N+1){
        if(S[i-1]=='X'){
            dp[i][0][1][0]=sekibun(dp[i-1][0][0][1],1)+sekibun(dp[i-1][1][0][1],1)
                          +sekibun(dp[i-1][0][1][1],1)+sekibun(dp[i-1][1][1][1],1)
                          +sekibun(dp[i-1][1][1][0],0)+sekibun(dp[i-1][1][1][1],0);
        }
        else{
            dp[i][0][0][1]=sekibun(dp[i-1][1][1][0],0)+sekibun(dp[i-1][1][1][1],0);
            REP(j,2) REP(k,2) dp[i][0][0][1]=dp[i][0][0][1]+sekibun(dp[i-1][j][1][k],1);
            dp[i][1][1][1]=sekibun(dp[i-1][0][1][0],0)+sekibun(dp[i-1][0][1][1],0);
        }
    }
    F ans;
    REP(i,2){
        t_add(ans,int_e(dp[N][i][1][0]));
        T S=sekibun(dp[N][i][0][1],2);
        t_add(ans,F(get<0>(S)[0],get<1>(S)[0],get<2>(S)));
        t_dec(ans,int_e(dp[N][i][0][1]));
        S=sekibun(dp[N][i][1][1],2);
        t_add(ans,F(get<0>(S)[0],get<1>(S)[0],get<2>(S)));
    }
    mint p,q,r;
    tie(p,q,r)=ans;
    cout<<p<<" "<<q<<" "<<r<<endl;
}

### Prompt

Your task is to create a Cpp solution to the following problem:

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
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
constexpr ll mod=1e9+7;
class mint {
 private:
  ll _num,_mod;
  mint set(ll num){ 
      _num = num ;
      if(_num>=0) _num%=_mod;
      else _num+=(1-(_num+1)/_mod)*_mod; 
      return *this;
  }
  ll _mpow(ll x, ll n){ //x^n(mod) ←普通にpow(x,n)では溢れてしまうため，随時mod計算 2分累乗法だから早い
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % _mod;
        x = x*x % _mod;
        n = n >> 1;
    }
    return ans;
  }
  ll imod(ll n){return _mpow(n , _mod-2);}
 public:
  mint(){ _num = 0;_mod=mod; }
  mint(ll num){ _mod = mod; _num = (num+(1LL<<25)*mod) % mod; }
  mint(ll num,ll M){ _mod=M;_num=(num+(1LL<<25)*mod)%_mod; }
  mint(const mint &cp){_num=cp._num;_mod=cp._mod;}
  mint operator= (const ll x){ return set(x); }
  mint operator+ (const ll x){ return mint(_num + (x % _mod) , _mod); }
  mint operator- (const ll x){ return mint(_num - (x % _mod), _mod); }
  mint operator* (const ll x){ return mint(_num * (x % _mod) , _mod); }
  mint operator/ (ll x){ return mint(_num * imod(x) , _mod);}
  mint operator+=(const ll x){ return set(_num + (x % _mod)); }
  mint operator-=(const ll x){ return set(_num - (x % _mod)); }
  mint operator*=(const ll x){ return set(_num * (x % _mod)); }
  mint operator/=(ll x){ return set(_num * imod(x));}
  mint operator+ (const mint &x){ return mint(_num + x._num , _mod); }
  mint operator- (const mint &x){ return mint(_num - x._num , _mod);}
  mint operator* (const mint &x){ return mint(_num * x._num , _mod); }
  mint operator/ (mint x){ return mint(_num * imod(x._num) , _mod);}
  mint operator+=(const mint &x){ return set(_num + x._num); }
  mint operator-=(const mint &x){ return set(_num - x._num); }
  mint operator*=(const mint &x){ return set(_num * x._num); }
  mint operator/=(mint x){ return set(_num * imod(x._num));}

  bool operator<(const mint &x)const{return _num<x._num;}
  bool operator==(const mint &x)const{return _num==x._num;}
  bool operator>(const mint &x)const{return _num>x._num;}

  friend mint operator+(ll x,const mint &m){return mint(m._num + (x % m._mod) , m._mod);}
  friend mint operator-(ll x,const mint &m){return mint( (x % m._mod) - m._num , m._mod);}
  friend mint operator*(ll x,const mint &m){return mint(m._num * (x % m._mod) , m._mod);}
  friend mint operator/(ll x,mint m){return mint(m.imod(m._num) * x , m._mod);}

  explicit operator ll() { return _num; }
  explicit operator int() { return (int)_num; }

  friend ostream& operator<<(ostream &os, const mint &x){ os << x._num; return os; }
  friend istream& operator>>(istream &is, mint &x){ll val; is>>val; x.set(val); return is;}
};

typedef tuple<vector<mint>,vector<mint>,mint> T;
T sekibun(T &v,int state){
    vector<mint> p,q;
    mint c;
    tie(p,q,c)=v;
    if(state==0){
        p.push_back(0);
        q.push_back(0);
        for(int i=p.size()-1;i>0;--i){
            p[i]=p[i-1]/mint(i);
        }
        for(int i=q.size()-1;i>0;--i){
            q[i]=q[i-1]/mint(i);
        }
        p[0]=c;
        q[0]=0;
        c=mod-c;
    }
    else if(state==1){
        p.push_back(0);
        q.push_back(0);
        mint r=0;
        for(int i=p.size()-1;i>0;--i){
            p[i]=mod-p[i-1]/mint(i);
            r+=p[i-1]/mint(i);
        }
        p[0]=r;
        r=0;
        for(int i=q.size()-1;i>0;--i){
            q[i]=mod-q[i-1]/mint(i);
            r+=q[i-1]/mint(i);
        }
        q[0]=r-c;
    }
    else{
        p.push_back(0);
        q.push_back(0);
        mint r=0;
        REP(i,p.size()){
            r+=p[i]/mint(i+1);
            p[i]=0;
        }
        p[0]=r+c;
        r=0;
        REP(i,q.size()){
            r+=q[i]/mint(i+1);
            q[i]=0;
        }
        q[0]=r-c;
        c=0;
    }
    return tie(p,q,c);
}
T operator+(T a,T b){
    vector<mint> p(max(get<0>(a).size(),get<0>(b).size()))
                ,q(max(get<1>(a).size(),get<1>(b).size()));
    mint c=0;
    REP(i,get<0>(a).size()) p[i]+=get<0>(a)[i];
    REP(i,get<0>(b).size()) p[i]+=get<0>(b)[i];
    REP(i,get<1>(a).size()) q[i]+=get<1>(a)[i];
    REP(i,get<1>(b).size()) q[i]+=get<1>(b)[i];
    c=get<2>(a)+get<2>(b);
    return tie(p,q,c);
}

mint pre[1010][2];
void calc(){
    pre[0][0]=1;
    pre[0][1]=-1;
    rep(i,0,1005){
        pre[i+1][0]=pre[i][0]*mint(i+1);
        pre[i+1][1]=pre[i][1]*mint(i+1)-1;
    }
}
typedef tuple<mint,mint,mint> F;

F int_e(T f){
    F res; vector<mint> p=get<0>(f),q=get<1>(f);
    rep(i,0,p.size())get<0>(res)+=p[i]*pre[i][0],get<1>(res)+=p[i]*pre[i][1];
    rep(i,0,q.size())get<1>(res)+=q[i]*pre[i][0],get<2>(res)+=q[i]*pre[i][1];
    get<0>(res)+=get<2>(f)/2; get<2>(res)-=get<2>(f)/2; return res;
}
void t_add(F &a,F b){get<0>(a)+=get<0>(b),get<1>(a)+=get<1>(b),get<2>(a)+=get<2>(b);}
void t_dec(F &a,F b){get<0>(a)-=get<0>(b),get<1>(a)-=get<1>(b),get<2>(a)-=get<2>(b);}
int main(){
    int N;cin>>N;
    string S;cin>>S;calc();
    typedef vector<T> vt;
    typedef vector<vt> vvt;
    typedef vector<vvt> vvvt;
    vector<vvvt> dp(N+1,vvvt(2,vvt(2,vt(2))));
    dp[0][0][1][1]=T({0},{0},1);
    dp[0][1][1][1]=T({1},{0},-1);
    rep(i,1,N+1){
        if(S[i-1]=='X'){
            dp[i][0][1][0]=sekibun(dp[i-1][0][0][1],1)+sekibun(dp[i-1][1][0][1],1)
                          +sekibun(dp[i-1][0][1][1],1)+sekibun(dp[i-1][1][1][1],1)
                          +sekibun(dp[i-1][1][1][0],0)+sekibun(dp[i-1][1][1][1],0);
        }
        else{
            dp[i][0][0][1]=sekibun(dp[i-1][1][1][0],0)+sekibun(dp[i-1][1][1][1],0);
            REP(j,2) REP(k,2) dp[i][0][0][1]=dp[i][0][0][1]+sekibun(dp[i-1][j][1][k],1);
            dp[i][1][1][1]=sekibun(dp[i-1][0][1][0],0)+sekibun(dp[i-1][0][1][1],0);
        }
    }
    F ans;
    REP(i,2){
        t_add(ans,int_e(dp[N][i][1][0]));
        T S=sekibun(dp[N][i][0][1],2);
        t_add(ans,F(get<0>(S)[0],get<1>(S)[0],get<2>(S)));
        t_dec(ans,int_e(dp[N][i][0][1]));
        S=sekibun(dp[N][i][1][1],2);
        t_add(ans,F(get<0>(S)[0],get<1>(S)[0],get<2>(S)));
    }
    mint p,q,r;
    tie(p,q,r)=ans;
    cout<<p<<" "<<q<<" "<<r<<endl;
}

```