#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T>
class modulo_int {
public:
  static constexpr int mod = T::value;
  static_assert(mod > 0, "mod must be positive");
private:
  long long value;
  constexpr void normalize() {
    value %= mod;
    if (value < 0) value += mod;
  }
public:
  constexpr modulo_int(long long value_ = 0): value(value_) { normalize(); }
  constexpr modulo_int operator - () const { return modulo_int(mod - value); }
  constexpr modulo_int operator ~ () const { return power(mod - 2); }
  constexpr long long operator () () const { return value; }
  constexpr modulo_int operator + (const modulo_int& rhs) const { return modulo_int(*this) += rhs; }
  constexpr modulo_int& operator += (const modulo_int& rhs) {
    if ((value += rhs.value) >= mod) value -= mod;
    return (*this);
  }
  constexpr modulo_int operator - (const modulo_int& rhs) const { return modulo_int(*this) -= rhs; }
  constexpr modulo_int& operator -= (const modulo_int& rhs) {
    if ((value += mod - rhs.value) >= mod) value -= mod;
    return (*this);
  }
  constexpr modulo_int operator * (const modulo_int& rhs) const { return modulo_int(*this) *= rhs; }
  constexpr modulo_int& operator *= (const modulo_int& rhs) {
    (value *= rhs.value) %= mod;
    return (*this);
  }
  constexpr modulo_int operator / (const modulo_int& rhs) const { return modulo_int(*this) /= rhs; }
  constexpr modulo_int& operator /= (const modulo_int& rhs) {
    return (*this) *= ~rhs;
  }
  constexpr modulo_int power (unsigned long long pow) const {
    modulo_int result(1), mult(*this);
    while (pow > 0) {
      if (pow & 1) result *= mult;
      mult *= mult;
      pow >>= 1;
    }
    return result;
  }
  friend std::istream& operator >> (std::istream& stream, modulo_int& lhs) {
    stream >> lhs.value;
    lhs.normalize();
    return stream;
  }
  friend std::ostream& operator << (std::ostream& stream, const modulo_int& rhs) {
    return stream << rhs.value;
  }
};

template <class T>
class polynomial {
public:
  using value_type = T;

// private:
  std::vector<value_type> data;

public:
  polynomial(): data(1, 0) { }
  polynomial(int size_): data(size_, 0) { }

  void operator += (const polynomial &rhs) {
    if (degree() < rhs.degree()) {
      data.resize(rhs.degree());
    }
    for (int i: range(0, std::min(degree(), rhs.degree()))) {
      data[i] += rhs[i];
    }
  }
  void operator -= (const polynomial &rhs) {
    if (degree() < rhs.degree()) {
      data.resize(rhs.degree());
    }
    for (int i: range(0, std::min(degree(), rhs.degree()))) {
      data[i] -= rhs[i];
    }
  }

  polynomial integrate() const {
    polynomial res(degree() + 1);
    for (int i: range(0, degree())) {
      res[i + 1] = data[i] / (i + 1);
    }
    return res;
  }
  std::pair<value_type, value_type> calculate() const {
    value_type r1, r2;
    value_type t1(1), t2(-1);
    for (int i: range(0, degree())) {
      r1 += data[i] * t1;
      r2 += data[i] * t2;
      t1 *= (i + 1);
      t2 *= (i + 1);
      t2 -= 1;
    }
    return { r1, r2 };
  }

  value_type &operator [] (int i) const {
    return (value_type&) this -> data[i];
  }
  value_type operator () (const value_type &val) const {
    value_type res, cur(1);
    for (auto coeff: data) {
      res += cur * coeff;
      cur *= val;
    }
    return res;
  }
  int degree() const {
    return data.size();
  }

};

using modint = modulo_int<std::integral_constant<int, 1000000007>>;
using poly = polynomial<modint>;

struct state {
  poly first, second;
  modint third;
  state(): first(poly()), second(poly()), third(modint()) { }
  state(const poly &first_, const poly &second_, const modint &third_): 
    first(first_), second(second_), third(third_)
  { }
  state integrate(bool val) const {
    auto P = first.integrate();
    auto Q = second.integrate();
    if (val) {
      P[0] -= P(1);
      Q[0] -= Q(1);
      Q[0] += third;
    }
    else {
      P[0] -= P(0);
      Q[0] -= Q(0);
      P[0] += third;
    }
    return state(P, Q, -third);
  }
  void set(const modint &a, const modint &b, const modint &c) {
    first[0] = a;
    second[0] = b;
    third = c;
  }
  void operator += (const state &rhs) {
    first += rhs.first;
    second += rhs.second;
    third += rhs.third;
  }
  void operator -= (const state &rhs) {
    first -= rhs.first;
    second -= rhs.second;
    third -= rhs.third;
  }
};

template <class T, int N, int I = 0>
auto gen_vec(const int (&list)[N], typename std::enable_if<(I == N), const T&>::type value = T()) {
  return value;
}

template <class T, int N, int I = 0>
auto gen_vec(const int (&list)[N], typename std::enable_if<(I != N), const T&>::type value = T()) {
  return std::vector<decltype(gen_vec<T, N, I + 1>(list, value))>(list[I], gen_vec<T, N, I + 1>(list, value));
}

int main() {
  int N;
  std::string S;
  std::cin >> N >> S;
  if (S.front() == 'X') {
    S = "-" + S;
    ++N;
  }
  auto dp = gen_vec<state>({ N, 2, 2 });
  dp[0][0][1].set(0, 0, 1);
  dp[0][1][0].set(1, 0, -1);
  dp[0][1][1].set(1, 0, -1);
  for (int i: range(1, N)) {
    if (S[i] == 'X') {
      dp[i][0][0] += dp[i - 1][1][0].integrate(0);
      dp[i][0][0] -= dp[i - 1][0][1].integrate(1);
      dp[i][0][0] -= dp[i - 1][1][1].integrate(1);
    }
    else {
      dp[i][0][1] += dp[i - 1][1][0].integrate(0);
      dp[i][1][0] += dp[i - 1][0][0].integrate(0);
      dp[i][1][1] += dp[i - 1][0][0].integrate(0);
      dp[i][0][1] -= dp[i - 1][0][0].integrate(1);
      dp[i][0][1] -= dp[i - 1][1][0].integrate(1);
    }
  }
  modint A, B, C;
  for (int i: range(0, 2)) {
    auto p = dp[N - 1][i][0].first;
    auto q = dp[N - 1][i][0].second;
    auto r = dp[N - 1][i][0].third;
    auto t1 = p.calculate();
    auto t2 = q.calculate();
    A += t1.first;
    B += t1.second;
    B += t2.first;
    C += t2.second;
    A += r / 2;
    C -= r / 2;
  }
  for (int i: range(0, 2)) {
    auto p = dp[N - 1][i][1].first;
    auto q = dp[N - 1][i][1].second;
    auto r = dp[N - 1][i][1].third;
    auto t1 = p.calculate();
    auto t2 = q.calculate();
    A -= t1.first;
    B -= t1.second;
    B -= t2.first;
    C -= t2.second;
    A -= r / 2;
    C += r / 2;
    A += p.integrate()(1);
    B += q.integrate()(1);
    A += r;
    B -= r;
  }
  std::cout << A << ' ' << B << ' ' << C << '\n';
  return 0;
}


Measured memory_bytes: 16512