// Slower C++ solution:
#include <iostream>

#include <string>

#include <vector>

#include <set>

#include <algorithm>

#include <cctype>

#include <cmath>

#include <queue>

#include <map>





using namespace std;

string yn(bool a)

{

  if (a){return "Yes";}

  else{return "No";}

}



int main()

{

  ios::sync_with_stdio(false);

  string s;

  int x,y;

  cin>>s>>x>>y;

  vector<int> a,b;

  bool f=1;

  int tmp=0;

  for(auto itr=s.begin();itr !=s.end();itr++)

  {

    if(*itr=='F'){tmp++;}

    else {

      if(f){a.push_back(tmp);}

      else{b.push_back(tmp);}

      f=!f;

    tmp=0;

  }



  }

  if(f){a.push_back(tmp);}

  else{b.push_back(tmp);}

  x-=a[0];

  x=abs(x);

  y=abs(y);

  a.erase(a.begin());

  sort(a.begin(),a.end());

  sort(b.begin(),b.end());

  int suma=0,sumb=0;

  for(auto itr=a.begin();itr !=a.end();itr++)

  {

    //cout<<*itr<<endl;

    suma+=*itr;

  }

  for(auto itr=b.begin();itr !=b.end();itr++)

  {

    sumb+=*itr;

    //cout<<*itr<<endl;

  }

  int flag=0;

  //cout<<x<<' '<<y<<' '<<suma<<' '<<sumb;

  if((suma-x)%2 or (sumb-y)%2){flag=0;}

  else

  {

    if(suma<x or sumb<y){flag=-2;}

    x=(suma-x)/2;

    y=(sumb-y)/2;

    //cout<<x<<' '<<y;

    vector<int> dpx(24001),dpy(24001);

    for(int i=0;i<24001;i++){dpx[i]=0;dpy[i]=0;}

    dpx[0]=1;dpx[suma]=1;

    dpy[0]=1;dpy[sumb]=1;

    for(auto itr1=a.begin();itr1 !=a.end();itr1++)

    {

      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}

      for(int i=16000;i>-1;i--)

      {

        if(dpx[i]==1){dpx[i+*itr1]=1;}

      }

      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}



    }

    if(a.size()==0 and x==0){flag+=1;}

    //cout<<flag<<endl;

    for(auto itr2=b.begin();itr2 !=b.end();itr2++)

    {

      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}

      for(int i=16000;i>-1;i--)

      {

        if(dpy[i]==1){dpy[i+*itr2]=1;}

      }

      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}

    }

    if(b.size()==0 and x==0){flag+=1;}

  }

  cout<<yn(flag>=2)<<endl;









  return 0;



}

// Faster C++ solution for the same problem (measured speedup: 1.126527565980452x):
#include <iostream>

#include <string>

#include <vector>

#include <set>

#include <algorithm>

#include <cctype>

#include <cmath>

#include <queue>

#include <map>





using namespace std;

string yn(bool a)

{

  if (a){return "Yes";}

  else{return "No";}

}



int main()

{

  ios::sync_with_stdio(false);

  string s;

  int x,y;

  cin>>s>>x>>y;

  vector<int> a,b;

  bool f=1;

  int tmp=0;

  for(auto itr=s.begin();itr !=s.end();itr++)

  {

    if(*itr=='F'){tmp++;}

    else {

      if(f){a.push_back(tmp);}

      else{b.push_back(tmp);}

      f=!f;

    tmp=0;

  }



  }

  if(f){a.push_back(tmp);}

  else{b.push_back(tmp);}

  x-=a[0];

  x=abs(x);

  y=abs(y);

  a.erase(a.begin());

  int suma=0,sumb=0;

  for(auto itr=a.begin();itr !=a.end();itr++)

  {

    suma+=*itr;

  }

  for(auto itr=b.begin();itr !=b.end();itr++)

  {

    sumb+=*itr;

  }

  int flag=0;

  if((suma-x)%2 or (sumb-y)%2){flag=0;}

  else

  {

    if(suma<x or sumb<y){flag=-2;}

    x=(suma-x)/2;

    y=(sumb-y)/2;

    vector<int> dpx(8001),dpy(8001);

    for(int i=0;i<8001;i++){dpx[i]=0;dpy[i]=0;}

    dpx[0]=1;dpx[suma]=1;

    dpy[0]=1;dpy[sumb]=1;

    for(auto itr1=a.begin();itr1 !=a.end();itr1++)

    {

      for(int i=suma;i>-1;i--)

      {

        if(dpx[i]==1){dpx[i+*itr1]=1;}

      }

      if(dpx[x]!=0 or dpx[suma-x]!=0){flag+=1;break;}



    }

    if(a.size()==0 and x==0){flag+=1;}

    for(auto itr2=b.begin();itr2 !=b.end();itr2++)

    {

      for(int i=sumb;i>-1;i--)

      {

        if(dpy[i]==1){dpy[i+*itr2]=1;}

      }

      if(dpy[y]!=0 or dpy[sumb-y]!=0){flag+=1;break;}

    }

    if(b.size()==0 and x==0){flag+=1;}

  }

  cout<<yn(flag>=2)<<endl;

  return 0;

}