using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();

        long ans = 0;
        long x = 0;
        foreach (string s in ReadLines(n).Reverse())
        {
            if (s.Length > 4)
                x = x * 2 + 1;
            else
                x = x * 2;
            ans += x * m / 2;
        }

        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AlgoTraining.Codeforces.A_s
{

    class FastScanner : StreamReader
    {
        private string[] _line;
        private int _iterator;

        public FastScanner(Stream stream) : base(stream)
        {
            _line = null;
            _iterator = 0;
        }
        public int NextInt()
        {
            if (_line == null || _iterator >= _line.Length)
            {
                _line = base.ReadLine().Split(' ');
                _iterator = 0;
            }
            if (_line.Count() == 0) throw new IndexOutOfRangeException("Input string is empty");
            return Convert.ToInt32(_line[_iterator++]);
        }
        public long NextLong()
        {
            if (_line == null || _iterator >= _line.Length)
            {
                _line = base.ReadLine().Split(' ');
                _iterator = 0;
            }
            if (_line.Count() == 0) throw new IndexOutOfRangeException("Input string is empty");
            return Convert.ToInt64(_line[_iterator++]);
        }
    }
    class GrandmaLauraAndApplesECR9
    {
        public static void Main(string[] args)
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt(), p = fs.NextInt();
                string[] buyers = new string[n];
                for (int i = n - 1; i >= 0; i--)
                {
                    buyers[i] = fs.ReadLine();
                }
                long revenue = p / 2;
                double prevVal = 1;
                for (int i = 1; i < n; i++)
                {
                    if (buyers[i] == "half") prevVal *= 2;
                    else prevVal = prevVal * 2 + 1;
                    revenue += (long)((prevVal / 2) * p);
                }
                writer.WriteLine(revenue);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(' ');
            var n = int.Parse(x[0]);
            var p = long.Parse(x[1]);

            Stack<long> paid = new Stack<long>();
            for (int i = 0; i < n; i++)
            {
                var temp = Console.ReadLine();
                if (temp == "half") paid.Push(0);
                else paid.Push(1);
            }

            long sum = 0;
            long apples = 0;

            while (paid.Count > 0)
            {
                var item = paid.Pop();
                sum += p*apples+(p/2)*item;
                apples = apples * 2 + item;
            }
            Console.WriteLine(sum);
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = MyConsoleInputStreamParser.GetInt, price = MyConsoleInputStreamParser.GetInt;
            Stack<string> stack = new Stack<string>(n);
            long halfCount = 0, count = 0;
            for (int i = 0; i < n; i++)
            {
                stack.Push(MyConsoleInputStreamParser.GetString);
            }
            for (int i = 0; i < n; i++)
            {
                var temp = stack.Pop();
                if (temp == "half")
                {
                    count *= 2;
                }
                else
                {
                    halfCount++;
                    count = count * 2 + 1;
                }
            }
            Console.WriteLine(price * count - halfCount * (price / 2));
        }

        public static class MyConsoleInputStreamParser
        {
            private static TextReader reader = new StreamReader(Console.OpenStandardInput());
            private static Queue<string> currentLineStrings = new Queue<string>();

            public static string GetLine { get { return reader.ReadLine(); } }

            public static string GetString { get { while (currentLineStrings.Count == 0) currentLineStrings = new Queue<string>(GetStringArray); return currentLineStrings.Dequeue(); } }

            public static int GetInt { get { return int.Parse(GetString); } }

            public static long GetLong { get { return long.Parse(GetString); } }

            public static double GetDouble { get { return double.Parse(GetString, CultureInfo.InvariantCulture); } }

            public static char[] GetCharArray { get { return GetLine.ToCharArray(); } }

            public static string[] GetStringArray { get { return GetLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } }

            public static int[] GetIntArray { get { return GetStringArray.Select(int.Parse).ToArray(); } }

            public static long[] GetLongArray { get { return GetStringArray.Select(long.Parse).ToArray(); } }

            public static double[] GetDoubleArray { get { return GetStringArray.Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); } }

            public static char[][] ReturnCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetCharArray; return matrix; }

            public static string[][] ReturnStringMatrix(int numberOfRows) { string[][] matrix = new string[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetStringArray; return matrix; }

            public static int[][] ReturnIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetIntArray; return matrix; }

            public static long[][] ReturnLongMatrix(int numberOfRows) { long[][] matrix = new long[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetLongArray; return matrix; }

            public static double[][] ReturnDoubleMatrix(int numberOfRows) { double[][] matrix = new double[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = GetDoubleArray; return matrix; }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF317
{
	internal class Program
	{
		private static void Main(string[] args)
		{
			var sr = new InputReader(Console.In);
			//var sr = new InputReader(new StreamReader("input.txt"));
			var task = new Task();
			using (var sw = Console.Out)
				//using (var sw = new StreamWriter("output.txt"))
			{
				task.Solve(1, sr, sw);
				//Console.ReadKey();
			}
		}
	}

	internal class Task
	{
		public void Solve(int testNumber, InputReader sr, TextWriter sw)
		{
			var input = sr.ReadArray(Int32.Parse);
			var n = input[0];
			var p = input[1];
			var array = new string[n];
			for (var i = 0; i < n; i++) {
				array[i] = sr.NextString();
			}
			var cost = 0L;
			var count = 0L;
			if (array[n - 1] == "half") {
				cost = 2 * p;
				count = 2;
			}
			else {
				cost = p / 2;
				count = 1;
			}
			for (var i = n - 2; i >= 0; i--) {
				var next = array[i];
				if (next == "half") {
					cost += count * p;
					count *= 2;
				}
				else {
					cost += count * p + p / 2;
					count = count * 2 + 1;
				}
			}

			sw.WriteLine(cost);
		}
	}

	internal class InputReader : IDisposable
	{
		private bool isDispose;
		private readonly TextReader sr;

		public InputReader(TextReader stream)
		{
			sr = stream;
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}

		public string NextString()
		{
			var result = sr.ReadLine();
			return result;
		}

		public int NextInt32()
		{
			return Int32.Parse(NextString());
		}

		public long NextInt64()
		{
			return Int64.Parse(NextString());
		}

		public string[] NextSplitStrings()
		{
			return NextString()
				.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
		}

		public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
		{
			return NextSplitStrings()
				.Select(s => func(s, CultureInfo.InvariantCulture))
				.ToArray();
		}

		protected void Dispose(bool dispose)
		{
			if (!isDispose) {
				if (dispose)
					sr.Close();
				isDispose = true;
			}
		}

		~InputReader()
		{
			Dispose(false);
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public void Solve(Scanner sc)
    {
        int N, P;
        sc.Make(out N, out P);
        var ct = 0L;var res = 0L;
        var S = Create(N, () => sc.Str);
        Array.Reverse(S);
        for(int i = 0; i < N; i++)
        {
            if (S[i] == "half")
            {
                res += ct*P;
                ct <<= 1;
            }
            else
            {
                res += ct * P + P / 2;
                ct <<= 1;ct++;
            }
        }
        WriteLine(res);
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


using System;

namespace prob1
{
    class Program
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            int p = int.Parse(input[1]);
            Array.Resize(ref input, n);
            for(int i = 0; i < n; i++)
            {
                input[i] = Console.ReadLine();
            }
            double ar = 1;
            double a = 0.5f;
            for(int i = n - 2; i > -1; i--)
            {
                if(input[i].Equals("half")) ar *= 2;
                else ar = ar * 2 + 1;
                a += ar / 2;
            }
            long money = (long)(a * p);
            Console.WriteLine(money);
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Grandma_Laura_and_Apples
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            string[] ss = reader.ReadLine().Split(' ');
            int n = int.Parse(ss[0]);
            int p = int.Parse(ss[1]);

            var nn = new bool[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = reader.ReadLine().EndsWith("plus");
            }

            long count = 0;
            long half = 0;

            for (int i = n - 1; i >= 0; i--)
            {
                if (nn[i])
                {
                    half++;
                    count = count*2 + 1;
                }
                else
                {
                    count *= 2;
                }
            }
            writer.WriteLine(count*p - half*p/2);
            writer.Flush();
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace Codeforces
{
    class Program
    {

        #region input

        static long readLong() {
            long num;
            long.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static ulong readULong() {
            ulong num;
            ulong.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static int readInt() {
            int num;
            int.TryParse(Console.ReadLine(),out num);
            return num;
        }

        static bool readBool() {
            int num;
            int.TryParse(Console.ReadLine(),out num);
            return num != 0;
        }

        static long[] readLongs() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            long[] parsed = new long[nums.Length];
            for(int i = 0; i < nums.Length; i++) {
                long.TryParse(nums[i],out parsed[i]);
            }
            return parsed;
        }

        static int[] readInts() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            int[] parsed = new int[nums.Length];
            for(int i = 0; i < nums.Length; i++) {
                int.TryParse(nums[i],out parsed[i]);
            }
            return parsed;
        }

        static void readInts(out int a,out int b) {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            int[] parsed = new int[nums.Length];
            int.TryParse(nums[0],out a);
            int.TryParse(nums[1],out b);
        }

        static BitArray readBools() {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            BitArray bits = new BitArray(nums.Length);
            for(int i = 0; i < nums.Length; i++) {
                if(nums[i] != "0") {
                    bits[i] = true;
                }
            }
            return bits;
        }

        static BitArray readBools(string off) {
            string[] nums = Console.ReadLine().Split(new char[] { ' ' });
            BitArray bits = new BitArray(nums.Length);
            for(int i = 0; i < nums.Length; i++) {
                if(nums[i] != off) {
                    bits[i] = true;
                }
            }
            return bits;
        }

        static void waist() {
            Console.ReadLine();
        }

        #endregion

        #region utility

        static int minIndex<T>(List<T> l) where T : IComparable {
            if(l == null || l.Count == 0) {
                return -1;
            }
            int min = 0;
            for(int i = 0; i < l.Count; i++) {
                if(l[i].CompareTo(l[min]) < 0) {
                    min = i;
                }
            }
            return min;
        }

        static int maxIndex<T>(List<T> l) where T : IComparable {
            if(l == null || l.Count == 0) {
                return -1;
            }
            int min = 0;
            for(int i = 0; i < l.Count; i++) {
                if(l[i].CompareTo(l[min]) > 0) {
                    min = i;
                }
            }
            return min;
        }

        static void print(List<int> l) {
            for(int i = 0; i < l.Count; i++) {
                if(i != 0) {
                    Console.Write(" ");
                }
                Console.Write((l[i]));
            }
            Console.WriteLine();
        }

        static long largeModolu(long a,long b,long m) {
            long prev = a;
            long sum = (b & 1) > 0 ? a : 1;
            int digits = (int)(Math.Ceiling(Math.Log(b,2)));
            for(int i = 1; i < digits; i++) {
                prev = (prev * prev) % (m);
                if((b & (1L << i)) > 0) {
                    sum = (sum * prev) % (m);
                }
            }
            return sum;
        }

        static long GCD(long a,long b) {
            long temp;
            if(a > b) {
                temp = b;
                b = a;
                a = temp;
            }
            while(b != 0) {
                temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }

        class SortableKVP<T> where T : IComparable
        {
            List<Tuple<int,T>> data { set; get; }

            public int count
            {
                get
                {
                    return data.Count;
                }
            }

            public T this[int index]
            {
                get
                {
                    return data[index].Item2;
                }
            }

            public int originalIndex(int sortedIndex) {
                return data[sortedIndex].Item1;
            }

            public void sort() {
                data.Sort((a,b) => a.Item2.CompareTo(b.Item2));
            }

            public void add(T item) {
                data.Add(new Tuple<int,T>(data.Count,item));
            }

            public void removeAt(int sortedIndex) {
                data.RemoveAt(sortedIndex);
            }

            public SortableKVP() {
                data = new List<Tuple<int,T>>();
            }

            public SortableKVP(T[] data) {
                this.data = new List<Tuple<int,T>>(data.Length);
                for(int i = 0; i < data.Length; i++) {
                    this.data.Add(new Tuple<int,T>(i,data[i]));
                }
            }
        }

        #endregion
        static void Main(string[] args) {
            int n, p;
            readInts(out n,out p);
            long count = 1;
            long money = p / 2;
            bool[] bools = new bool[n];
            for(int i = 0; i < n; i++) {
                string t = Console.ReadLine();
                bools[i] = t != "half";
            }
            for(int i = n - 2; i >= 0; i--) {
                if(bools[i]) {
                    money += count * p + p / 2;
                    count = count * 2 + 1;
                } else {
                    money += count * p;
                    count *= 2;
                }

            }
            Console.WriteLine( money );
        }

        /*static string work(char[] s, string ans, int c) {
            BitArray b = new BitArray(w.Length,true);
            int on = w.Length;
            for(; on > 0; c++) {
                for(int i = 0; i < w.Length; i++) {
                    if(b[i] && w[i].Length > c) {
                        if(s[c] == w[i][c]) {
                            string temp = work(s,ans +
                        } else {
                            on--;
                            b[c] = false;
                        }
                    }
                }
            }
        }*/

        static void seven() {
            int x = readInt();
            int y = readInt();
            if(y == 0) {
                Console.Write(1);
                return;
            }
            long[] dp = new long[(int)(Math.Log(y,2) + 1)];
            long mult = 1;
            dp[0] = x;
            if((y & 1) == 1) {
                mult = dp[0];
            }
            for(int i = 1; i < dp.Length; i++) {
                dp[i] = dp[i-1] * dp[i - 1];
                if((y & (1 << i)) != 0) {
                    mult *= dp[i];
                }
            }
            Console.WriteLine(mult);

        }

        static void twelve() {
            int[] a = readInts();
            int[] b = readInts();
            int x = readInt();
            Dictionary<int,int> h = new Dictionary<int,int>();
            for(int i = 0; i < b.Length; i++) {
                h.Add(b[i],i);
            }
            for(int i = 0; i < a.Length; i++) {
                if(h.ContainsKey(x - a[i])) {
                    Console.Write(i + " " + h[x - a[i]]);
                    break;
                }
            }
        }

        static void ten() {
            int[] a = readInts();
            int[] b = readInts();
            int k = readInt();
            int i = 0, j = 0;
            for(int c = 0; c < k; c++) {
                if(i == a.Length || (j != b.Length && a[i] < b[j])) {
                    if(c == k - 1) {
                        Console.WriteLine(a[i]);
                    }
                    ++i;
                } else {
                    if(c == k - 1) {
                        Console.WriteLine(b[j]);
                    }
                    ++j;
                }
            }
        }
    }
}


using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Threading;
using System.Diagnostics;
using System.Linq;
using System.Globalization;

class Solution
{
    public TextInput cin;
    public TextOutput cout;
    public TextOutput cerr;

    public bool Solve()
    {
        var n = cin.Read<int>();
        var k = cin.Read<int>();

        var q = new Stack<string>();
        for (var i = 0; i < n; i++) q.Push(cin.ReadToken());

        var ans = 1L;
        var cc = 1;
        q.Pop();

        while(q.Count > 0)
        {
            var cmd = q.Pop();
            ans <<= 1;
            if (cmd.Contains("plus"))
            {
                cc++;
                ans++;
            }
        }

        var price = ans * ((long)k);
        price -= ((long)cc) * ((long)k) / 2L;

        cout.WriteLine(price);

        return true;
    }
}

#region Core
static class Program
{
    public static readonly TextInput cin = new TextInput(Console.In);
    public static readonly TextOutput cout = new TextOutput(Console.Out);
    public static readonly TextOutput cerr = new TextOutput(Console.Error);
#if !DEBUG
    static void Main()
    {
        new Solution
        {
            cin = cin,
            cout = cout,
            cerr = cerr
        }.Solve();
    }
#endif
}
public class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
{
    public new TValue this[TKey key]
    {
        get
        {
            TValue res;
            base.TryGetValue(key, out res);
            return res;
        }
        set
        {
            base[key] = value;
        }
    }
}
public static class Ext
{

    #region Prewriten
    public static void Foreach<T>(this IEnumerable<T> elements, Action<T> action)
    {
        foreach(var element in elements)
        {
            action(element);
        }
    }
    public static void Foreach<T>(this IEnumerable<T> elements, Action<T, int> action)
    {
        var index = 0;
        foreach(var element in elements)
        {
            action(element, index++);
        }
    }
    public static void Do(int from, int n, Action<int> action)
    {
        for (var i = from; i < n; i++) action(i);
    }
    public static IEnumerable<T> Init<T>(int n) where T : new()
    {
        for (var i = 0; i < n; i++)
        {
            yield return new T();
        }
    }
    public static IEnumerable<T> Init<T>(int n, T defaultValue = default(T))
    {
        for (var i = 0; i < n; i++)
        {
            yield return defaultValue;
        }
    }
    public static IEnumerable<T> Init<T>(int n, Func<int, T> builder)
    {
        for (var i = 0; i < n; i++)
        {
            yield return builder(i);
        }
    }
    public static bool IsEmpty(this string s)
    {
        return string.IsNullOrEmpty(s);
    }
    public static string Safe(this string s)
    {
        return s.IsEmpty() ? string.Empty : s;
    }
    public static void Swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }
    public static long Gcd(long a, long b)
    {
        while (a > 0)
        {
            b %= a;
            Swap(ref a, ref b);
        }
        return b;
    }
    public static int[] ZFunction(string s)
    {
        var z = new int[s.Length];
        for (int i = 1, l = 0, r = 0; i < s.Length; ++i)
        {
            if (i <= r)
            {
                z[i] = Math.Min(r - i + 1, z[i - l]);
            }
            while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])
            {
                z[i]++;
            }
            if (i + z[i] - 1 > r)
            {
                l = i;
                r = i + z[i] - 1;
            }
        }
        return z;
    }
    public static long Pow(long a, long p)
    {
        var b = 1L;
        while (p > 0)
        {
            if ((p & 1) == 0)
            {
                a *= a;
                p >>= 1;
            }
            else
            {
                b *= a;
                p--;
            }
        }
        return b;
    }
    #endregion
}

public delegate bool TryParseDelegate<T>(string s, NumberStyles style, IFormatProvider format, out T value);
public class TextInput
{
    private static Dictionary<Type, Delegate> primitiveParsers = new Dictionary<Type, Delegate>
        {
            { typeof(sbyte), new TryParseDelegate<sbyte>(sbyte.TryParse) },
            { typeof(short), new TryParseDelegate<short>(short.TryParse) },
            { typeof(int),  new TryParseDelegate<int>(int.TryParse) },
            { typeof(long), new TryParseDelegate<long>(long.TryParse) },

            { typeof(byte), new TryParseDelegate<byte>(byte.TryParse) },
            { typeof(ushort), new TryParseDelegate<ushort>(ushort.TryParse) },
            { typeof(uint), new TryParseDelegate<uint>(uint.TryParse) },
            { typeof(ulong), new TryParseDelegate<ulong>(ulong.TryParse) },

            { typeof(float), new TryParseDelegate<float>(float.TryParse) },
            { typeof(double), new TryParseDelegate<double>(double.TryParse) },
            { typeof(decimal), new TryParseDelegate<decimal>(decimal.TryParse) },

            { typeof(char), new TryParseDelegate<char>(CharParser) },
            { typeof(string), new TryParseDelegate<string>(StringParser) }
        };
    private static bool CharParser(string s, NumberStyles style, IFormatProvider format, out char res)
    {
        res = char.MinValue;
        if (string.IsNullOrEmpty(s))
        {
            return false;
        }
        else
        {
            res = s[0];
            return true;
        }
    }
    private static bool StringParser(string s, NumberStyles style, IFormatProvider format, out string res)
    {
        res = s == null ? string.Empty : s;
        return true;
    }

    private string line = null;
    private int pos = 0;

    public IFormatProvider FormatProvider { get; set; }
    public NumberStyles NumberStyle { get; set; }
    public TextReader TextReader { get; set; }

    public TextInput(string path) : this(path, NumberStyles.Any, CultureInfo.InvariantCulture)
    {
    }
    public TextInput(string path, NumberStyles numberStyle, IFormatProvider formatProvider) : this(new StreamReader(path), numberStyle, formatProvider)
    {

    }
    public TextInput(TextReader textReader) : this(textReader, NumberStyles.Any, CultureInfo.InvariantCulture)
    {

    }
    public TextInput(TextReader textReader, NumberStyles numberStyle, IFormatProvider formatProvider)
    {
        TextReader = textReader;
        NumberStyle = numberStyle;
        FormatProvider = formatProvider;
    }

    public bool IsEof
    {
        get
        {
            return line == null && TextReader.Peek() == -1;
        }
    }
    public void SkipWhiteSpace()
    {
        while (!IsEof)
        {
            if (line != null && pos < line.Length && !char.IsWhiteSpace(line[pos]))
            {
                return;
            }
            if (line == null || pos >= line.Length)
            {
                Next();
                continue;
            }
            while (pos < line.Length && char.IsWhiteSpace(line[pos]))
            {
                pos++;
            }
        }
    }
    private void SkipWhiteSpace(bool force)
    {
        if (force)
        {
            SkipWhiteSpace();
        }
        else
        {
            SkipWhiteSpace();
        }
    }

    public T[] ReadArray<T>()
    {
        var length = Read<int>();
        return ReadArray<T>(length);
    }
    public T[] ReadArray<T>(int length)
    {
        var array = new T[length];

        var parser = GetParser<T>();
        var style = NumberStyle;
        var format = FormatProvider;

        for (var i = 0; i < length; i++)
        {
            array[i] = Read<T>(parser, style, format);
        }
        return array;
    }

    public bool TryReadArray<T>(out T[] array)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, out array);
    }
    public bool TryReadArray<T>(out T[] array, int length)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, out array, length);
    }
    public bool TryReadArray<T>(T[] array, int offset, int length)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, array, offset, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T[] array)
    {
        var length = 0;
        if (!TryRead<int>(out length))
        {
            array = null;
            return false;
        }
        array = new T[length];
        return TryReadArray<T>(parser, style, format, array, 0, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T[] array, int length)
    {
        array = new T[length];
        return TryReadArray<T>(parser, style, format, array, 0, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, T[] array, int offset, int length)
    {
        var result = true;
        for (var i = 0; i < length && result; i++)
        {
            result &= TryRead<T>(parser, style, format, out array[offset + i]);
        }
        return result;
    }

    private TryParseDelegate<T> GetParser<T>()
    {
        var type = typeof(T);
        return (TryParseDelegate<T>)primitiveParsers[type];
    }
    public T Read<T>()
    {
        return Read<T>(GetParser<T>());
    }
    public T Read<T>(NumberStyles style, IFormatProvider format)
    {
        return Read<T>(GetParser<T>(), style, format);
    }
    public T Read<T>(TryParseDelegate<T> parser)
    {
        return Read<T>(parser, NumberStyle, FormatProvider);
    }
    public T Read<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format)
    {
        T result;
        if (!TryRead(parser, style, format, out result))
        {
            throw new FormatException();
        }
        return result;
    }
    public bool TryRead<T>(out T value)
    {
        return TryRead(GetParser<T>(), out value);
    }
    public bool TryRead<T>(NumberStyles style, IFormatProvider format, out T value)
    {
        return TryRead(GetParser<T>(), style, format, out value);
    }
    public bool TryRead<T>(TryParseDelegate<T> parser, out T value)
    {
        return parser(ReadToken(), NumberStyle, FormatProvider, out value);
    }
    public bool TryRead<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T value)
    {
        return parser(ReadToken(), style, format, out value);
    }
    public string ReadToken()
    {
        SkipWhiteSpace(false);
        if (IsEof)
        {
            throw new EndOfStreamException();
        }

        if (pos >= line.Length || char.IsWhiteSpace(line[pos])) return string.Empty;

        var start = pos;
        while (pos < line.Length && !char.IsWhiteSpace(line[pos]))
        {
            pos++;
        }
        return line.Substring(start, pos - start);
    }
    public string ReadLine()
    {
        if (IsEof)
        {
            throw new EndOfStreamException();
        }
        if (line == null || pos >= line.Length)
        {
            Next();
        }

        var ans = line.Substring(pos);
        pos = line.Length;
        return ans;
    }

    private void Next()
    {
        line = TextReader.ReadLine();
        pos = 0;
    }
}

public class TextOutput
{
    public IFormatProvider FormatProvider { get; set; }
    public TextWriter TextWriter { get; set; }

    public TextOutput(string path) : this(path, CultureInfo.InvariantCulture)
    {
    }
    public TextOutput(string path, IFormatProvider formatProvider) : this(new StreamWriter(path), formatProvider)
    {

    }
    public TextOutput(TextWriter textWriter) : this(textWriter, CultureInfo.InvariantCulture)
    {

    }
    public TextOutput(TextWriter textWriter, IFormatProvider formatProvider)
    {
        TextWriter = textWriter;
        FormatProvider = formatProvider;
    }

    public TextOutput WriteArray<T>(params T[] array)
    {
        return WriteArray(array, true);
    }
    public TextOutput WriteArray<T>(T[] array, bool appendLine)
    {
        return WriteArray(array, 0, array.Length, appendLine);
    }
    public TextOutput WriteArray<T>(T[] array, int offset, int length, bool appendLine = true)
    {
        var sb = new StringBuilder();
        for (var i = 0; i < length; i++)
        {
            sb.Append(Convert.ToString(array[offset + i], FormatProvider));
            if (i + 1 < length)
            {
                sb.Append(' ');
            }
        }
        return appendLine ? WriteLine(sb.ToString()) : Write(sb.ToString());
    }

    public TextOutput WriteLine(object obj)
    {
        return WriteLine(Convert.ToString(obj, FormatProvider));
    }
    public TextOutput WriteLine(string text, params object[] args)
    {
        return WriteLine(string.Format(FormatProvider, text, args));
    }
    public TextOutput WriteLine(string text)
    {
        TextWriter.WriteLine(text);
        return this;
    }
    public TextOutput WriteLine(char[] buffer)
    {
        TextWriter.WriteLine(buffer);
        return this;
    }
    public TextOutput WriteLine(char[] buffer, int offset, int length)
    {
        TextWriter.WriteLine(buffer, offset, length);
        return this;
    }
    public TextOutput WriteLine()
    {
        TextWriter.WriteLine();
        return this;
    }

    public TextOutput Write(object obj)
    {
        return Write(Convert.ToString(obj, FormatProvider));
    }
    public TextOutput Write(string text, params object[] args)
    {
        return Write(string.Format(FormatProvider, text, args));
    }
    public TextOutput Write(string text)
    {
        TextWriter.Write(text);
        return this;
    }
    public TextOutput Write(char[] buffer)
    {
        TextWriter.Write(buffer);
        return this;
    }
    public TextOutput Write(char[] buffer, int offset, int length)
    {
        TextWriter.Write(buffer, offset, length);
        return this;
    }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Numerics;
using E = System.Linq.Enumerable;

namespace ProbA {
    class Program {
        protected IOHelper io;

        public Program(string inputFile, string outputFile) {
            io = new IOHelper(inputFile, outputFile, Encoding.Default);

            int n=io.NextInt(), p=io.NextInt();
            string[] cmd = new string[n];
            for (int i = 0; i < n; i++) cmd[i] = io.NextToken();
            long has = 0, half = 0;
            for (int i = n - 1; i >= 0; i--) {
                if (cmd[i] == "half") {
                    has *= 2;
                } else {
                    has = has * 2 + 1;
                    half++;
                }
            }
            io.WriteLine(has * p - p / 2 * half);
            io.Dispose();
        }

        static void Main(string[] args) {
            Program myProgram = new Program(null, null);
        }
    }

    class IOHelper : IDisposable {
        public StreamReader reader;
        public StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding) {
            if (inputFile == null)
                reader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                reader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                writer = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                writer = new StreamWriter(outputFile, false, encoding);

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public bool hasNext() {
            if (curTokenIdx >= curLine.Length) {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            return curTokenIdx < curLine.Length;
        }

        public string NextToken() {
            return hasNext() ? curLine[curTokenIdx++] : null;
        }

        public int NextInt() {
            return int.Parse(NextToken());
        }

        public double NextDouble() {
            string tkn = NextToken();
            return double.Parse(tkn, System.Globalization.CultureInfo.InvariantCulture);
        }

        public void Write(double val, int precision) {
            writer.Write(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void Write(object stringToWrite) {
            writer.Write(stringToWrite);
        }

        public void WriteLine(double val, int precision) {
            writer.WriteLine(val.ToString("F" + precision, System.Globalization.CultureInfo.InvariantCulture));
        }

        public void WriteLine(object stringToWrite) {
            writer.WriteLine(stringToWrite);
        }

        public void Dispose() {
            try {
                if (reader != null) {
                    reader.Dispose();
                }
                if (writer != null) {
                    writer.Flush();
                    writer.Dispose();
                }
            } catch { };
        }

        public void Flush() {
            if (writer != null) {
                writer.Flush();
            }
        }
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int b = int.Parse(inp[0]);
        int c = int.Parse(inp[1]);
        string[] s = new string[b];
        int i = 0, halfes = 0;
        for (; i < b; i++)
        {
            s[i] = Console.ReadLine();
            if (s[i] == "halfplus") halfes++;
        }
        long a = 1;
        i -= 2;

        for (; i >= 0; i--)
        {
            if (s[i] == "half") a *= 2;
            else a = a * 2 + 1;
        }
        long m = a * c - (halfes * c) / 2;
        Console.WriteLine(m);
        Console.ReadLine();
    }
}


using System;
using System.Linq;

namespace _632A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var n = s[0]; var p = s[1];
            long ans = 0;
            double apples = 0;
            string[] customers = new string[n];
            for (int i = 0; i < n; i++)
            {
                customers[i] = Console.ReadLine();
            }
            Array.Reverse(customers);
            for (int i = 0; i < n; i++)
            {
                if (customers[i] == "half") apples = apples * 2;
                else apples = 2 * (apples + 0.5);
                ans += (long)(apples * p / 2);
            }
            Console.WriteLine(ans);
        }
    }
}


using System;

namespace prob1
{
    class Program
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            int p = int.Parse(input[1]);
            Array.Resize(ref input, n);
            for(int i = 0; i < n; i++)
            {
                input[i] = Console.ReadLine();
            }
            float ar = 1;
            float a = 0.5f;
            for(int i = n - 2; i > -1; i--)
            {
                if(input[i].Equals("half")) ar *= 2;
                else ar = ar * 2 + 1;
                a += ar / 2;
            }
            long money = (long)(a * p);
            Console.WriteLine(money);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        //WriteLine(Solve());
    }
    static void Solve()
    { var num = Input.num;
        var str = new[] { "D", "A", "B", "C" };
        WriteLine($"{Min(2,(num+3) % 4)} {str[num % 4]}");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static T[] create<T>(int n, Func<int, T> f)
        => Enumerable.Repeat(0, n).Select(f).ToArray();
    public static char[][] gred(int h)
        => create(h, _ => read.ToCharArray());
    public static int[] ar1D(int n)
        => create(n, _ => num);
    public static long[] arL1D(int n)
        => create(n, _ => numL);
    public static string[] strs(int n)
        => create(n, _ => read);
    public static int[][] ar2D(int n)
        => create(n, _ => ar);
    public static long[][] arL2D(int n)
        => create(n, _ => arL);
    public static List<T>[] edge<T>(int n)
        => create(n, _ => new List<T>());
    public static T GetValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static void Make<T1, T2>(out T1 v1, out T2 v2)
    {
        v1 = Next<T1>();
        v2 = Next<T2>();
    }
    public static void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        Make(out v1, out v2);
        v3 = Next<T3>();
    }
    public static void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4)
    {
        Make(out v1, out v2, out v3);
        v4 = Next<T4>();
    }
    public static void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)
    {
        Make(out v1, out v2, out v3, out v4);
        v5 = Next<T5>();
    }
    public static void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)
    {
        Make(out v1, out v2, out v3, out v4, out v5);
        v6 = Next<T6>();
    }
    private static Queue<string> sc = new Queue<string>();
    public static T Next<T>(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue<T>(sc.Dequeue()); }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using static System.Math;
using System.Text;

namespace Program
{
    public static class CODEFORCES1
    {
        static public void Solve()
        {
            var x = NN;
            var mod = x % 4;
            if (mod == 1)
            {
                Console.WriteLine("0 A");
                return;
            }
            else if (mod == 2)
            {
                Console.WriteLine("1 B");
                return;
            }
            else if (mod == 3)
            {
                Console.WriteLine("1 A");
                return;
            }
            else
            {
                Console.WriteLine("1 A");
                return;
            }
        }

        static public void Main(string[] args)
        {
            if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); }
            Solve();
            Console.Out.Flush();
        }
        static Random rand = new Random();
        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => rand.Next());
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void RevSort<T>(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void RevSort<T>(T[] l, Comparison<T> comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<long> Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<long> Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static IEnumerable<long> Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; }
        static long LCM(long a, long b) => a * b / GCD(a, b);
        class PQ<T> where T : IComparable
        {
            private List<T> h;
            private Comparison<T> c;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(int cap, Comparison<T> c, bool asc = true) { h = new List<T>(cap); this.c = asc ? c : (x, y) => c(y, x); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(Comparison<T> c, bool asc = true) { h = new List<T>(); this.c = asc ? c : (x, y) => c(y, x); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; }
            public T Peek => h[0];
            public int Count => h.Count;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; }
        }
        class PQ<TKey, TValue> where TKey : IComparable
        {
            private PQ<Tuple<TKey, TValue>> q;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(int cap, Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>(cap, (x, y) => c(x.Item1, y.Item1), asc); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>((x, y) => c(x.Item1, y.Item1), asc); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) { }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) { }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public void Push(TKey k, TValue v) => q.Push(Tuple.Create(k, v));
            public Tuple<TKey, TValue> Peek => q.Peek;
            public int Count => q.Count;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public Tuple<TKey, TValue> Pop() => q.Pop();
        }
        struct Mod : IEquatable<object>
        {
            static public long _mod = 1000000007;
            private long _val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; }
            static public implicit operator Mod(long x) => new Mod(x);
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public implicit operator long(Mod x) => x._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mod operator +(Mod x, Mod y) => x._val + y._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mod operator -(Mod x, Mod y) => x._val - y._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mod operator *(Mod x, Mod y) => x._val * y._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val);
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public bool operator ==(Mod x, Mod y) => x._val == y._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public bool operator !=(Mod x, Mod y) => x._val != y._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            bool IEquatable<object>.Equals(object obj) => obj == null ? false : Equals((Mod)obj);
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj);
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public bool Equals(Mod obj) => obj == null ? false : _val == obj._val;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public override int GetHashCode() => _val.GetHashCode();
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public override string ToString() => _val.ToString();
            static private List<Mod> _fact = new List<Mod>() { 1 };
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static private void Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mod Comb(long n, long k) { Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
        }
        struct Mat<T>
        {
            private T[,] m;
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public Mat(T[,] v) { m = (T[,])v.Clone(); }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public implicit operator Mat<T>(T[,] v) => new Mat<T>(v);
            public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator +(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator +(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator -(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator -(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator *(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> operator *(Mat<T> a, Mat<T> b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; }
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            static public Mat<T> Pow(Mat<T> x, long y) { var n = x.m.GetLength(0); var t = (Mat<T>)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static Mat<T> Pow<T>(Mat<T> x, long y) => Mat<T>.Pow(x, y);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static T Pow<T>(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; }
        static List<long> _fact = new List<long>() { 1 };
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static void _Build(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        static long Comb(long n, long k) { _Build(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        if (n % 4 == 0)
        {
            Console.WriteLine("2 C");
        }
        if (n % 4 == 1)
        {
            Console.WriteLine("0 A");
        }
        if (n % 4 == 2)
        {
            Console.WriteLine("1 B");
        }
        if (n % 4 == 3)
        {
            Console.WriteLine("2 A");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp37
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int rem = x % 4;
            if (rem == 1)
                Console.WriteLine("0 A");
            if (rem == 2)
                Console.WriteLine("1 B");
            if (rem == 3)
                Console.WriteLine("0 B");
            if (rem==0)
                Console.WriteLine("1 A");
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            if (n % 4 == 1) Console.WriteLine(0 + " A");
            else if (n % 4 == 2) Console.WriteLine(1 + " B");
            else if (n % 4 == 3) Console.WriteLine(2 + "A");
            else if (n % 4 == 0) Console.WriteLine(1 + "A");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        //WriteLine(Solve());
    }
    static void Solve()
    { var num = Input.num;
        var str = new[] { "D", "A", "B", "C" };
        WriteLine($"{num % 4} {str[num % 4]}");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static T[] create<T>(int n, Func<int, T> f)
        => Enumerable.Repeat(0, n).Select(f).ToArray();
    public static char[][] gred(int h)
        => create(h, _ => read.ToCharArray());
    public static int[] ar1D(int n)
        => create(n, _ => num);
    public static long[] arL1D(int n)
        => create(n, _ => numL);
    public static string[] strs(int n)
        => create(n, _ => read);
    public static int[][] ar2D(int n)
        => create(n, _ => ar);
    public static long[][] arL2D(int n)
        => create(n, _ => arL);
    public static List<T>[] edge<T>(int n)
        => create(n, _ => new List<T>());
    public static T GetValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static void Make<T1, T2>(out T1 v1, out T2 v2)
    {
        v1 = Next<T1>();
        v2 = Next<T2>();
    }
    public static void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        Make(out v1, out v2);
        v3 = Next<T3>();
    }
    public static void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4)
    {
        Make(out v1, out v2, out v3);
        v4 = Next<T4>();
    }
    public static void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)
    {
        Make(out v1, out v2, out v3, out v4);
        v5 = Next<T5>();
    }
    public static void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)
    {
        Make(out v1, out v2, out v3, out v4, out v5);
        v6 = Next<T6>();
    }
    private static Queue<string> sc = new Queue<string>();
    public static T Next<T>(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue<T>(sc.Dequeue()); }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1191_TokitsukazeAndEnhancement
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            char ch = 'x';
            int t = n % 4;
            switch(n % 4)
            {
                case 0: ch = 'A';
                        t = 1;
                    break;
                case 1: ch = 'A';
                        t = 0;
                    break;
                case 2: ch = 'B';
                        t = 1;
                    break;
                default: ch = 'D';
                         t = 2;
                    break;
            }

            Console.WriteLine("{0} {1}",t,ch);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        if (n % 4 == 0)
        {
            Console.WriteLine("2 B");
        }
        if (n % 4 == 1)
        {
            Console.WriteLine("0 A");
        }
        if (n % 4 == 2)
        {
            Console.WriteLine("1 B");
        }
        if (n % 4 == 3)
        {
            Console.WriteLine("2 A");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num;
        var str = new[] { "D", "A", "B", "C" };
        var a = new[] { 2, 0, 1, 2 };
        WriteLine($"{a[num%4]} {str[num % 4]}");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static T[] create<T>(int n, Func<int, T> f)
        => Enumerable.Repeat(0, n).Select(f).ToArray();
    public static char[][] gred(int h)
        => create(h, _ => read.ToCharArray());
    public static int[] ar1D(int n)
        => create(n, _ => num);
    public static long[] arL1D(int n)
        => create(n, _ => numL);
    public static string[] strs(int n)
        => create(n, _ => read);
    public static int[][] ar2D(int n)
        => create(n, _ => ar);
    public static long[][] arL2D(int n)
        => create(n, _ => arL);
    public static List<T>[] edge<T>(int n)
        => create(n, _ => new List<T>());
    public static T GetValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static void Make<T1, T2>(out T1 v1, out T2 v2)
    {
        v1 = Next<T1>();
        v2 = Next<T2>();
    }
    public static void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        Make(out v1, out v2);
        v3 = Next<T3>();
    }
    public static void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4)
    {
        Make(out v1, out v2, out v3);
        v4 = Next<T4>();
    }
    public static void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)
    {
        Make(out v1, out v2, out v3, out v4);
        v5 = Next<T5>();
    }
    public static void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)
    {
        Make(out v1, out v2, out v3, out v4, out v5);
        v6 = Next<T6>();
    }
    private static Queue<string> sc = new Queue<string>();
    public static T Next<T>(){ if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue<T>(sc.Dequeue()); }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int a = n;
            char l = ' ', ln = ' ';
            if (n % 4 == 1)
                Console.WriteLine("0 A");
            else
            {
                switch (n % 4)
                {
                    case 0: l = 'D'; break;
                    case 2: l = 'C'; break;
                    case 3: l = 'B'; break;
                }
                for (int i = 1; i < 4; i++)
                {
                    a++;
                    switch (a % 4)
                    {
                        case 0: ln = 'D';break;
                        case 2:ln = 'C';break;
                        case 3:ln = 'B';break;
                    }
                    if (ln < l)
                        break;
                }
                Console.WriteLine((a - n) + " " + ln.ToString());
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int hp = n % 4;
            if (hp == 0) Console.WriteLine(1 + " A");
            else if (hp == 1) Console.WriteLine(0 + " A");
            else if (hp == 2) Console.WriteLine(1 + " B");
            else if (hp == 3) Console.WriteLine(2 + " A");
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());

        int n = t % 4;
        switch (n)
        {
            case 0:
                Console.WriteLine("1 A");
                break;
            case 1:
                Console.WriteLine("0 A");
                break;
            case 2:
                Console.WriteLine("1 B");
                break;
            case 3:
                Console.WriteLine("2 A");
                break;
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;

public class Class2
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var res = $"{Math.Abs(n % 4 - 1)} {(n % 4 == 2 ? "B" : "A")}";
        Console.WriteLine(res);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            if (n % 4 == 1)
            {
                Console.WriteLine("0 A");
            }
            else if (n % 4 == 3)
            {
                Console.WriteLine("2 A");
            }
            else if (n % 4 == 2)
            {
                Console.WriteLine("1 B");
            }
            else
            {
                Console.WriteLine("1 A");
            }
        }
    }
}


/* Date: 12.07.2019  *  Time: 21:45 */
//
// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\040\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\040\\OUTPUT.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int n;

# if ( ONLINE_JUDGE )
		n = int.Parse (Console.ReadLine ());
# else
		n = int.Parse (sr.ReadLine ());
		sw.WriteLine ("*** n = " + n);
# endif

		int a = 0;
		n %= 4;
		char c = 'A';
		if ( n == 1 )
		{
			a = 0; c = 'A';
		}
		else if ( n == 2 )
		{
			a = 1; c = 'B';
		}
		else if ( n == 3 )
		{
			a = 2; c = 'A';
		}
		else
		{
			a = 1; c = 'A';
		}

# if ( ONLINE_JUDGE )
		Console.WriteLine (a + " " + c);
# else
		sw.WriteLine (a + " " + c);
		sw.Close ();
# endif

	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            if (n % 4 == 2) Console.WriteLine("1 B");
            if (n % 4 == 0) Console.WriteLine("1 A");
            if (n % 4 == 1) Console.WriteLine("0 A");
            if (n % 4 == 3) Console.WriteLine("2 A");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        if (n % 4 == 0)
        {
            Console.WriteLine("1 A");
        }
        if (n % 4 == 1)
        {
            Console.WriteLine("0 A");
        }
        if (n % 4 == 2)
        {
            Console.WriteLine("1 B");
        }
        if (n % 4 == 3)
        {
            Console.WriteLine("2 A");
        }
    }
}