#include <bits/stdc++.h>

using namespace std;

const int md = (int) 1e9 + 7;

vector<int> fact, inv, inv_fact, inv_fact_sum;

struct poly {
  vector<int> p, q;
  int c;

  poly(vector<int> p = vector<int>(), vector<int> q = vector<int>(), int c = 0): p(p), q(q), c(c) {
  }
};

struct info {
  int p, q, r;

  info(int p = 0, int q = 0, int r = 0): p(p), q(q), r(r) {
  }
};

inline void add(int &x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
}

inline void sub(int &x, int y) {
  x -= y;
  if (x < 0) {
    x += md;
  }
}

inline int mul(int x, int y) {
  return (int) ((long long) x * y % md);
}

vector<int>& operator += (vector<int> &a, const vector<int> &b) {
  if (a.size() < b.size()) {
    a.resize(b.size());
  }
  for (int i = 0; i < (int) b.size(); ++i) {
    add(a[i], b[i]);
  }
  return a;
}

poly& operator += (poly &a, const poly &b) {
  a.p += b.p;
  a.q += b.q;
  add(a.c, b.c);
  return a;
}

info& operator += (info &a, const info &b) {
  add(a.p, b.p);
  add(a.q, b.q);
  add(a.r, b.r);
  return a;
}

info& operator -= (info &a, const info &b) {
  sub(a.p, b.p);
  sub(a.q, b.q);
  sub(a.r, b.r);
  return a;
}

poly integral_0_x(const poly &a) {
  vector<int> pp, qq;
  int cc;
  pp.push_back(a.c);
  for (int i = 0; i < (int) a.p.size(); ++i) {
    pp.push_back(mul(a.p[i], inv[i + 1]));
  }
  qq.push_back(0);
  for (int i = 0; i < (int) a.q.size(); ++i) {
    qq.push_back(mul(a.q[i], inv[i + 1]));
  }
  cc = (md - a.c) % md;
  return poly(pp, qq, cc);
}

poly integral_x_1(const poly &a) {
  vector<int> pp, qq;
  int cc;
  pp.push_back(0);
  for (int i = 0; i < (int) a.p.size(); ++i) {
    int coef = mul(a.p[i], inv[i + 1]);
    add(pp[0], coef);
    pp.push_back((md - coef) % md);
  }
  qq.push_back((md - a.c) % md);
  for (int i = 0; i < (int) a.q.size(); ++i) {
    int coef = mul(a.q[i], inv[i + 1]);
    add(qq[0], coef);
    qq.push_back((md - coef) % md);
  }
  cc = a.c;
  return poly(pp, qq, cc);
}

info integral_0_1(const poly &a) {
  int p, q, r;
  p = a.c;
  for (int i = 0; i < (int) a.p.size(); ++i) {
    add(p, mul(a.p[i], inv[i + 1]));
  }
  q = (md - a.c) % md;
  for (int i = 0; i < (int) a.q.size(); ++i) {
    add(q, mul(a.q[i], inv[i + 1]));
  }
  r = 0;
  return info(p, q, r);
}

info integral_0_1_e(const poly &a) {
  int p, q, r;
  p = 0;
  for (int i = 0; i < (int) a.p.size(); ++i) {
    add(p, mul(a.p[i], fact[i]));
  }
  add(p, mul(a.c, (md + 1) >> 1));
  q = 0;
  for (int i = 0; i < (int) a.p.size(); ++i) {
    sub(q, mul(a.p[i], mul(fact[i], inv_fact_sum[i])));
  }
  for (int i = 0; i < (int) a.q.size(); ++i) {
    add(q, mul(a.q[i], fact[i]));
  }
  r = 0;
  for (int i = 0; i < (int) a.q.size(); ++i) {
    sub(r, mul(a.q[i], mul(fact[i], inv_fact_sum[i])));
  }
  sub(r, mul(a.c, (md + 1) >> 1));
  return info(p, q, r);
}

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int n;
  string s;
  cin >> n >> s;
  vector<vector<vector<vector<poly>>>> dp(n, vector<vector<vector<poly>>>(2, vector<vector<poly>>(2, vector<poly>(2))));
  fact.resize(n + 1);
  inv.resize(n + 1);
  inv_fact.resize(n + 1);
  inv_fact_sum.resize(n + 1);
  fact[0] = fact[1] = inv[0] = inv[1] = inv_fact[0] = inv_fact[1] = inv_fact_sum[0] = 1;
  inv_fact_sum[1] = 2;
  for (int i = 2; i <= n; ++i) {
    fact[i] = mul(fact[i - 1], i);
    inv[i] = mul(md - md / i, inv[md % i]);
    inv_fact[i] = mul(inv_fact[i - 1], inv[i]);
    inv_fact_sum[i] = inv_fact_sum[i - 1];
    add(inv_fact_sum[i], inv_fact[i]);
  }
  if (s[0] == 'X') {
    dp[0][0][1][0] = poly(vector<int>(), vector<int>(), 1);
  } else {
    dp[0][0][0][1] = poly(vector<int>(), vector<int>(), 1);
    dp[0][1][1][1] = poly(vector<int>(1, 1), vector<int>(), md - 1);
  }
  for (int i = 1; i < n; ++i) {
    if (s[i] == 'X') {
      for (int j = 0; j < 2; ++j) {
        dp[i][0][1][0] += integral_0_x(dp[i - 1][1][1][j]);
      }
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          dp[i][0][1][0] += integral_x_1(dp[i - 1][j][k][1]);
        }
      }
    } else {
      for (int j = 0; j < 2; ++j) {
        dp[i][0][0][1] += integral_0_x(dp[i - 1][1][1][j]);
        dp[i][1][1][1] += integral_0_x(dp[i - 1][0][1][j]);
      }
      for (int j = 0; j < 2; ++j) {
        for (int k = 0; k < 2; ++k) {
          dp[i][0][0][1] += integral_x_1(dp[i - 1][j][1][k]);
        }
      }
    }
  }
  info ans;
  for (int i = 0; i < 2; ++i) {
    ans += integral_0_1(dp[n - 1][i][0][1]);
    ans += integral_0_1(dp[n - 1][i][1][1]);
    ans += integral_0_1_e(dp[n - 1][i][1][0]);
    ans -= integral_0_1_e(dp[n - 1][i][0][1]);
  }
  cout << ans.p << " " << ans.q << " " << ans.r << "\n";
  return 0;
}


Measured memory_bytes: 6912