using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace AtcoderExpress
{


    class Program2
    {
        static String S;
        static void Main(string[] args)
        {
            S = Console.ReadLine();
            var XY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var X = XY[0];
            var Y = XY[1];
            var UpDown = new List<long>();
            var LeftRight = new List<long>();
            var DirectionIsX = true;
            //最初に何個Fが続くか
            var SumOfFirstFs = GetSumOfFs(0);
            //X座標を左に動かす
            X -= SumOfFirstFs;

            for (int i = SumOfFirstFs; i < S.Length;)
            {
                var CurrentChar = S[i];
                if(CurrentChar == 'F')
                {
                    var LenOfFs = GetSumOfFs(i);
                    if (DirectionIsX)
                    {
                        LeftRight.Add(LenOfFs);
                    }
                    else
                    {
                        UpDown.Add(LenOfFs);
                    }
                    i += LenOfFs;
                }
                else
                {
                    var LenOfTs = GetSumOfTs(i);
                    if(LenOfTs%2 == 1)
                    {
                        DirectionIsX = !DirectionIsX;
                    }
                    i += LenOfTs;
                }
            }

            var AbsX = Abs(X);
            var AbsY = Abs(Y);
            var UpDownArr = UpDown.ToArray();
            var LeftRightArr = LeftRight.ToArray();

            if (MakeSum(LeftRightArr, AbsX) && MakeSum(UpDownArr, AbsY))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            }

        static bool MakeSum(long[] Idou,long aim)
        {
            var sum = Idou.Sum();
            var rest = (sum - aim);
            var N = Idou.Length;
            var dp = new bool[N + 1, sum - rest / 2 + 1];
            dp[0, 0] = true;
            //どうやっても到達できないかもしくは、移動回数が奇数となるか
            if (sum < aim || rest%2 == 1)
            {
                return false;
            }
            else
            {
                

                for (int i = 1; i <= N; i++)
                {
                    for (int j = 0; j <= sum - rest / 2; j++)
                    {
                        if (j-Idou[i-1] >= 0)
                        {
                            dp[i, j] = dp[i - 1, j] || dp[i - 1, j - Idou[i - 1]];
                        }
                        else
                        {
                            dp[i, j] = dp[i - 1, j];
                        }
                    }
                }
            }
            return dp[N, sum - rest / 2];
        }

        //pointからスタートしてFが続く個数を返す
        static int GetSumOfFs(int point)
        {
            var FromPoint = point;
            while(point < S.Length && S[point] == 'F')
            {
                point++;
            }
            return point - FromPoint;
        }

        static int GetSumOfTs(int point)
        {
            var FromPoint = point;
            while (point < S.Length && S[point] == 'T')
            {
                point++;
            }
            return point - FromPoint;
        }

        

    }
}


Measured memory_bytes: 19424