#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

using Pair = std::pair<int, int>;

char winner(const char& l, const char& r) {
  if (l == r) return l;
  if (l == 'R' && r == 'P' || l == 'P' && r == 'R') return 'P';
  if (l == 'S' && r == 'P' || l == 'P' && r == 'S') return 'S';
  if (l == 'R' && r == 'S' || l == 'S' && r == 'R') return 'R';
  return '.';
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, k;
  cin >> n >> k;
  std::string s;
  cin >> s;
  s += s;

  std::string target_s {s};

  for (auto i = 0;i < k;++i) {
    int new_s_size {static_cast<int>(target_s.size())};
    std::string new_s{};
    for (auto j = 0;j < new_s_size;++j) {
      new_s += winner(target_s[2*j%n], target_s[(2*j + 1)%n]);
    }
    target_s = new_s;
    //std::cout << target_s << '\n';
  }
  cout << target_s[0] << '\n';
}

#include<bits/stdc++.h>
#define int ll
#define sz(x) int((x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using pi = pair<int,int>;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int minf = 0xc0c0c0c0c0c0c0c0;

const int N = 2002002;
const int mod = int(1e9) + 7;

struct Modular {
    int fact[N+5], inv[N+5], fact_inv[N+5];
    Modular() {
        fact[0] = fact[1] = inv[1] = fact_inv[0] = fact_inv[1] = 1;
        for (int i=2; i<=N; i++) {
            fact[i] = ll(fact[i-1])*i%mod;
        }
        for (int i=2; i<=N; i++) {
            inv[i] = -mod/i*ll(inv[mod%i])%mod+mod;
        }
        for (int i=2; i<=N; i++) {
            fact_inv[i] = ll(fact_inv[i-1])*inv[i]%mod;
        }
    }
    int comb(int n, int r) {
        return n>=r && r>=0 ? ll(fact[n])*fact_inv[n-r]%mod*fact_inv[r]%mod : 0;
    }
    int perm(int n, int r) {
        return n>=r && r>=0 ? ll(fact[n])*fact_inv[n-r]%mod : 0;
    }
} modular;

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);

    int n,m,k; cin>>n>>m>>k;

    if (n > m+k) {
        cout<<0<<'\n';
        return 0;
    }

    int res = modular.comb(n+m, n);

    res -= modular.comb(m+n, k+1+m);

    if (res < 0) res += mod;

    cout<<res<<'\n';


    return 0;
}