#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}

template <unsigned long long mod > class modint{
public:
    ll x;
    constexpr modint(){x = 0;}
    constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){}
    constexpr modint set_raw(ll _x){
        //_x in [0, mod)
        x = _x;
        return *this;
    }
    constexpr modint operator-(){
        return x == 0 ? 0 : mod - x;
    }
    constexpr modint& operator+=(const modint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr modint operator+(const modint& a) const{
        return modint(*this) += a;
    }
    constexpr modint& operator-=(const modint& a){
        if((x -= a.x) < 0) x += mod;
        return *this;
    }
    constexpr modint operator-(const modint& a) const{
        return modint(*this) -= a;
    }
    constexpr modint& operator*=(const modint& a){
        (x *= a.x)%=mod;
        return *this;
    }
    constexpr modint operator*(const modint& a) const{
        return modint(*this) *= a;
    }
    constexpr modint pow(unsigned long long pw) const{
        modint res(1), comp(*this);
        while(pw){
            if(pw&1) res *= comp;
            comp *= comp;
            pw >>= 1;
        }
        return res;
    }
    //以下、modが素数のときのみ
    constexpr modint inv() const{
        if(x == 2) return (mod + 1) >> 1;
        return modint(*this).pow(mod - 2);
    }
    constexpr modint& operator/=(const modint &a){
        (x *= a.inv().x)%=mod;
        return *this;
    }
    constexpr modint operator/(const modint &a) const{
        return modint(*this) /= a;
    }
};
#define mod2 1000000007
using mint = modint<mod2>;

ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
using vm = vector<mint>;

mint fibo(int n, bool debug = false){
    vector<vm> dp(2, vm(2, 0));
    dp[0][0] = 1;
    rep(i, n - 1){
        dp[1][0] = dp[0][1];
        dp[1][1] = dp[0][0] + dp[0][1];
        swap(dp[0], dp[1]);
        if(debug){
            cout<<dp[0][0]<<' '<<dp[0][1]<<endl;
        }
    }
    return dp[0][1];
}

int main(){
    //fibo(6, true);
    cin>>N;
    char aa, ab, ba, bb;
    cin>>aa>>ab>>ba>>bb;
    if(N <= 3){
        cout<<1<<endl;
    }else{
        if(ab == 'A'){
            if(aa == 'A'){
                cout<<1<<endl;
            }else if(ba == 'A'){
                cout<<fibo(N)<<endl;
            }else{
                cout<<mint(2).pow(N - 3)<<endl;
            }
        }else{
            if(bb == 'B'){
                cout<<1<<endl;
            }else if(ba == 'A'){
                cout<<mint(2).pow(N - 3)<<endl;
            }else{
                cout<<fibo(N)<<endl;
            }
        }
    }
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll N; cin>>N;
  vector<ll> A(N),B,C;
  bool isOK=false;
  for(ll i=0; i<N; ++i) {
    cin>>A[i];
    A[i]%=200;
  }
  // N<=8なら全て
  // N>8なら先頭8個のみを全探索
  vector<vector<ll>> group(200);
  for(ll i=1; i<1ll<<min(8ll,N); ++i) {
    bitset<8> bs=i;
    ll val=0;
    for(ll j=0; j<bs.size(); ++j) {
      if(bs.test(j)) val=(val+A[j])%200;
    }
    group[val].push_back(i);
    if(group[val].size()>=2) {
      isOK=true;
      bitset<8> x=group[val][0], y=group[val][1];
      for(ll j=0; j<8; ++j) {
        if(x.test(j)) B.push_back(j+1);
        if(y.test(j)) C.push_back(j+1);
      }
      break;
    }
  }
  if(isOK) {
    cout<<"Yes"<<endl;
    cout<<B.size()<<" ";
    for(auto& e:B) cout<<e<<" ";
    cout<<endl;
    cout<<C.size()<<" ";
    for(auto& e:C) cout<<e<<" ";
    cout<<endl;
  } else cout<<"No"<<endl;
}
