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

#if DEBUG
using System.Diagnostics;
#endif

namespace CompetitiveProgramming
{
    class Program
    {
        static bool s_IsMultipleTestCases = false;
        static void Main(string[] args)
        {
#if DEBUG
            var streamReader = new StreamReader("../../input.txt", Encoding.ASCII, false, 32768);
            var streamWriter = new StreamWriter("../../output.txt", false, Encoding.ASCII, 32768);
            var timer = new Stopwatch();
            timer.Start();
#else
            var streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            var streamWriter = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
#endif
            var reader = new InputReader(streamReader);

            var numberOfTest = 1;
            if (s_IsMultipleTestCases)
            {
                numberOfTest = reader.NextInt();
            }
            for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)
            {
                Task solver = new Task();
                solver.Solve(testNumber, reader, streamWriter);
            }
#if DEBUG
            streamWriter.WriteLine("\nEslapsed Time: " + timer.ElapsedMilliseconds + " ms");
#endif
            streamReader.Close();
            streamWriter.Close();
        }
    }

    class Task
    {
        public void Solve(int testNumber, InputReader reader, StreamWriter writer)
        {
            var n = reader.NextInt();
            var m = reader.NextInt();

            int cnt2 = 0, cnt3 = 0, cnt6 = 0;
            for (int i = 1; ; i++)
            {
                if (i % 6 == 0)
                {
                    cnt6++;
                }
                else if (i % 2 == 0)
                {
                    cnt2++;
                }
                else if (i % 3 == 0)
                {
                    cnt3++;
                }
                if (cnt2 + cnt3 + cnt6 >= m + n && Math.Max(0, (n - cnt2)) + Math.Max(0, (m - cnt3)) <= cnt6)
                {
                    writer.WriteLine(i);
                    break;
                }
            }
        }
    }

    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

        private bool IsSpaceChar(int c)
        {
            return !(c >= 33 && c <= 126);
        }

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            int num = 0, b;
            var minus = false;
            while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-')
            {
                minus = true;
                b = ReadByte();
            }

            while (true)
            {
                if (b >= '0' && b <= '9')
                {
                    num = num * 10 + (b - '0');
                }
                else
                {
                    return minus ? -num : num;
                }
                b = ReadByte();
            }
        }

        public long NextLong()
        {
            long num = 0, b;
            var minus = false;
            while ((b = ReadByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-')
            {
                minus = true;
                b = ReadByte();
            }

            while (true)
            {
                if (b >= '0' && b <= '9')
                {
                    num = num * 10 + (b - '0');
                }
                else
                {
                    return minus ? -num : num;
                }
                b = ReadByte();
            }
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }
    }

}


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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split(new char[] { ' ' }).Select(x => int.Parse(x)).ToArray();
            if (numbers[0] == 0)
                Console.WriteLine(numbers[1] * 3);
            if (numbers[1] == 0)
                Console.WriteLine(numbers[0] * 2);
            if (numbers[0] != 0 && numbers[1] != 0)
            {
                var problemsCount = Math.Min((numbers[0] * 2) / 6, (numbers[1] * 3) / 6);
                var firstMaxHeight = numbers[0] * 2;
                var secondMaxHeight = numbers[1] * 3;
                while (problemsCount > 0)
                {
                    if (firstMaxHeight <= secondMaxHeight)
                    {
                        firstMaxHeight += 2;
                        if (firstMaxHeight % 6 == 0 && firstMaxHeight <= secondMaxHeight)
                            problemsCount++;
                    } else
                    if (firstMaxHeight > secondMaxHeight)
                    {
                        secondMaxHeight += 3;
                        if (secondMaxHeight % 6 == 0 && firstMaxHeight >= secondMaxHeight)
                            problemsCount++;
                    }
                    problemsCount--;
                }
                Console.WriteLine(Math.Max(firstMaxHeight, secondMaxHeight));
            }
        }
    }
}


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();

        int l = 1, r = 10000000;
        while (l < r)
        {
            int mid = (l + r) / 2;
            int x6 = mid / 6;
            int x2 = mid / 2 - x6;
            int x3 = mid / 3 - x6;
            int xn = Math.Max(0, n - x2);
            int xm = Math.Max(0, m - x3);
            if (xn + xm > x6)
                l = mid + 1;
            else
                r = mid;
        }

        Write(l);
    }

    #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.IO;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Numerics;

namespace ConsoleApplication1
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;
        private int index = 0;
        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Get();
            p.Out(x);
        }
        class Cut
        {
            public int a;
            public int b;
            public int line;
        }

        object Get() {
            checked
            {
                var a = ReadInts();
                var n = a[0];
                var m = a[1];
                var nh = a[0] * 2;
                var mh = a[1] * 3;
                var i = 6;
                while (i <= Math.Min(nh, mh))
                {
                    if (nh <= mh)
                        nh += 2;
                    else
                        mh += 3;
                    i += 6;
                }
                return Math.Max(mh, nh);
            }
        }

        public string Besides(char a)
        {
            if (a == 'B')
                return "GR";
            if (a == 'G')
                return "BR";
            if (a == 'R')
                return "BG";
            throw new Exception("huj");
        }

        public string Other(char a, char b)
        {
            if (a == 'B' && b == 'G')
                return "R";
            if (a == 'G' && b == 'R')
                return "B";
            if (a == 'B' && b == 'R')
                return "G";
            throw new Exception("huj");
        }
        object GetC()
        {
            FileName = "space";
            checked
            {
                var s = Read();
                var first = GetNext(s);
                var second = GetNext(s);
                var single = new Dictionary<char, int>();
                var twin = new Dictionary<Tuple<char, char>, List<Tuple<int, int>>>();
                single[first.Item1] = first.Item2;
                if (second == null)
                    return first.Item2;

                do
                {
                    if (!single.ContainsKey(second.Item1) || single[second.Item1] < second.Item2)
                        single[second.Item1] = second.Item2;
                    var pair = Tuple.Create(first.Item1, second.Item1);
                    if (!twin.ContainsKey(pair))
                        twin[pair] = new List<Tuple<int, int>>();
                    twin[pair].Add(Tuple.Create(first.Item2, second.Item2));
                    first = second;
                    second = GetNext(s);
                } while (second != null);
                long result = single.Select(x => x.Value).Sum();
                foreach (var kv in single)
                    result += kv.Value;
                //foreach (var kv in twin)
                //{
                //    ProcessPair(kv.Value);
                //}

                return result;

            }
        }

        //public long ProcessPair(List<Tuple<int, int>> counts)
        //{
        //    counts.Sort()
        //}

        public Tuple<char, int> GetNext(string s)
        {
            if (index == s.Length)
                return null;
            var ch = s[index];
            var count = 0;
            while (index < s.Length && ch == s[index])
            {
                count++;
                index++;
            }
            return Tuple.Create(ch, count);
        }

        public double ProcessPair(long[] a, long[] b, int p)
        {
            return ((double)NumberOfDivs(a, p) * 2000) / Count(a) +
                ((double)NumberOfDivs(b, p) * 2000) / Count(b) -
                ((double)(NumberOfDivs(a, p) * NumberOfDivs(b, p))) * 2000 / (Count(a) * Count(b));
        }

        public long NumberOfDivs(long[] a, int p)
        {
            return a[1] / p - (a[0] - 1) / p;
        }

        public long Count(long[] a)
        {
            return a[1] - a[0] + 1;
        }

        bool DoubleEquals(double a, double b)
        {
            return Math.Abs(a - b) < 0.0000000001;
        }

        bool SameLine(double[] a, double[] b, double[] c)
        {
            var x = a[0];
            var y = a[1];
            var x1 = b[0];
            var y1 = b[1];
            var x2 = c[0];
            var y2 = c[1];
            return DoubleEquals((x - x1) * (y2 - y1), (y - y1) * (x2 - x1));
        }

        double Distance(double[] a, double[] b)
        {
            return Math.Sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));
        }

        object Get2()
        {
            checked
            {
                var m = ReadInt();
                var p = ReadLongs();
                var arr = p.GroupBy(x => x).Select(g => new { g.Key, Count = g.Count() }).ToArray();
                var even = arr.Where(x => (x.Count & 1) == 0).FirstOrDefault();
                if (even != null)
                {
                    var index = Array.IndexOf(arr, even);
                    //arr[index].Count = arr[index].Count / 2;
                }
                long divs = 1;
                long result = 1;
                foreach (var a in arr)
                {
                    var pi = a.Key;
                    var curr = pi;
                    var olddivs = divs;
                    var oldres = result;
                    for (int i = 0; i < a.Count; i++)
                    {
                        result = (result * oldres % commonMod) * FastPow(curr, olddivs, commonMod) % commonMod;
                        curr = curr * pi % commonMod;
                        divs = (divs + olddivs) % (commonMod - 1);
                    }
                }
                return result;
            }
        }

        public long FastPow(long x, BigInteger pow, long mod)
        {
            if (pow == 0)
                return 1;
            if ((pow & 1) == 0)
                return FastPow(x * x % mod, pow / 2, mod);
            return x * FastPow(x, pow - 1, mod) % mod;
        }

        //object Get3()
        //{
        //    FileName = "";
        //    checked
        //    {
        //        var n = ReadInt();
        //        var hor = new List<Cut>();
        //        var ver = new List<Cut>();
        //        for (int i = 0; i < n; i++)
        //        {
        //            var a = ReadInts();
        //            if (a[0] == a[2])
        //                ver.Add(new Cut() { a = Math.Min(a[1], a[3]), b = Math.Max(a[1], a[3]), line = a[0] });
        //            else
        //                hor.Add(new Cut() { a = Math.Min(a[0], a[2]), b = Math.Max(a[0], a[2]), line = a[1] });
        //        }
        //        ver = Merge(ver);
        //        hor = Merge(hor);

        //    }
        //}

        List<Cut> Merge(List<Cut> l)
        {
            var a = l.OrderBy(x => x.line).ThenBy(x => x.a).ToArray();
            Cut previous = null;
            var result = new List<Cut>();
            for (int i = 0; i < a.Length; i++)
                if (previous == null)
                    previous = a[i];
                else
                    if (previous.line == a[i].line && previous.b >= a[i].a)
                        previous.b = Math.Max(previous.b, a[i].b);
                    else
                    {
                        result.Add(previous);
                        previous = a[i];
                    }
            if (previous != null)
                result.Add(previous);
            return result;
        }

    }
    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (string.IsNullOrEmpty(FileName))
                return Console.ReadLine();
            if (f == null)
                f = new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName + ".in");
            return f.ReadLine();
        }

        protected int ReadInt()
        {
            return Convert.ToInt32(Read());
        }
        protected int[] ReadInts()
        {
            return Read().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
        }

        protected long ReadLong()
        {
            return Convert.ToInt64(Read());
        }

        protected long[] ReadLongs()
        {
            return Read().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName + ".out", r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {
            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-NB-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func)
        {
            T result = default(T);
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> source, string delimeter)
        {
            return string.Join(delimeter, source.ToArray());
        }
    }
}


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

namespace BlockTowers
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, m, a = 2;
            string[] input = Console.ReadLine().Split(' ');
            n = int.Parse(input[0]);
            m = int.Parse(input[1]);
            if (n == 0)
            {
                Console.WriteLine(m * 3);
            }
            else if (m == 0)
            {
                Console.WriteLine(n * 2);
            }
            else if (n != 0 && m != 0)
            {
                while (n != 0 || m != 0)
                {
                    if (a % 2 == 0 && a % 3 == 0)
                    {
                        if (n > m && n > 0)
                        {
                            n--;
                        }
                        else if (m > n && m > 0)
                        {
                            m--;
                        }
                        else if (n == m && m > 0)
                        {
                            m--;
                        }
                    }
                    else if (a % 2 == 0 && n > 0)
                    {
                        n--;
                    }
                    else if (a % 3 == 0 && m > 0)
                    {
                        m--;
                    }
                    a++;
                }
                Console.WriteLine(a - 1);
            }
        }
    }
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int r=3*(A+B+1);
		int l=0;
		int c=0;
		while(r-l>1){
			c=(r+l)/2;
			if(isOk(c)){
				r=c;
			}else{
				l=c;
			}
		}
		while(isOk(c))c--;
		while(!isOk(c))c++;
		Console.WriteLine(c);

	}

	bool isOk(int t){
		int n2=t/2;
		int n3=t/3;
		int n6=t/6;
		n2-=n6;
		n3-=n6;
		for(int i=0;i<=n6;i++){
			if(n2+i>=A && n3+(n6-i)>=B)return true;
		}
		return false;
	}

	int A,B;
	public Sol(){
		var d=ria();
		A=d[0];B=d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

namespace CodeForcesBlockTowers
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, m, a = 2;
            n = int.Parse(Console.ReadLine());
            m = int.Parse(Console.ReadLine());
            if (n == 0)
            {
                Console.WriteLine(m * 3);
            }
            else if (m == 0)
            {
                Console.WriteLine(n * 2);
            }
            else if (n != 0 && m != 0)
            {
                while (n!=0 || m!=0)
                {
                    if (a % 2 == 0 && a % 3 == 0)
                    {
                        if (n > m && n>0)
                        {
                            n--;
                        }
                        else if (m > n && m>0)
                        {
                            m--;
                        }
                        else if (n == m && m>0)
                        {
                            m--;
                        }
                    }
                    else if (a % 2 == 0 && n>0)
                    {
                        n--;
                    }
                    else if (a % 3 == 0 && m>0)
                    {
                        m--;
                    }
                    a++;
                }
                Console.WriteLine(a - 1);
            }
            Console.ReadLine();
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);

            int x = Math.Max(n * 2, Math.Max(m * 3, (int)Math.Floor(1.5 * (double)(n + m))));
            Console.WriteLine(x);
            Console.ReadLine();
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);

            int x = Math.Max(n * 2, Math.Max(m * 3, (int)Math.Ceiling(1.5 * (double)(n + m))));
            Console.WriteLine(x);
            Console.ReadLine();
        }
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]), tn = 0;
        int m = int.Parse(inp[1]), tm = 0;

        tm = m * 3;
        tn = n * 2;
        for (int i = 0; i < n && i < m; i += 6)
        {
            if (tn >= tm + 3)
                tm += 3;
            else
                tn += 2;
        }
        int max = Math.Max(tn, tm);

        Console.WriteLine(max);
        Console.ReadLine();
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]), tn = 0;
        int m = int.Parse(inp[1]), tm = 0;

        tm = m * 3;
        tn = n * 2;
        for (int i = 0; i < n && i < m; i += 3)
        {
            if (tn >= tm + 3)
                tm += 3;
            else
                tn += 2;
        }
        int max = Math.Max(tn, tm);

        Console.WriteLine(max);
        Console.ReadLine();
    }
}


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

class Program
{
    public class Pair : IComparable<Pair>
    {
        public int L;
        public int R;
        public int Index;
        public bool Inverted;
        public Pair Next;

        public void Invert(int h)
        {
            this.Inverted = !this.Inverted;
            int tmp = L;
            L = h - R;
            R = h - tmp;
        }
        public void Sort(int h)
        {
            if (L <= R && L > h - R)
            {
                this.Invert(h);
            }

            if (L > R && L < h - R)
            {
                this.Invert(h);
            }
        }

        public int CompareTo(Pair other)
        {
            return (this.R - this.L) * this.L.CompareTo(other.L);
        }

        public override string ToString()
        {
            return L + " " + R;
        }
    }

    static void Main(string[] args)
    {
        int n = ReadInt();
        int m = ReadInt();
        int x = 0;
        for (int i = 2; i < 5555; i++)
        {
            if (i % 2 == 0) n--;
            if (i % 3 == 0) m--;

            if (i % 6 == 0) x++;
            while (m < 0 && x > 0)
            {
                m++;
                x--;
            }
            while (n < 0 && x > 0)
            {
                n++;
                x--;
            }

            if (m <= 0 && n <= 0 && x<=0)
            {
                Console.WriteLine(i);
                return;
            }
        }
        /*
        int h = ReadInt();
        int n = ReadInt();

        Pair[] m  = new Pair[n];
        Pair[] used = new Pair[h + 1];
        for (int i = 0; i < n; i++)
        {
            m[i] = new Pair()
            {
                L = ReadInt(),
                R = ReadInt(),
                Index = i + 1
            };
            m[i].Sort(h);

            if ((m[0].R - m[0].L != m[i].R - m[i].L) ||
                (m[0].R == m[0].L && m[i].L != m[0].L))
            {
                Console.WriteLine(0);
                return;
            }

            if (m[0].R != m[0].L)
            {
                if (used[m[i].L] == null)
                {
                    used[m[i].L] = m[i];
                }
                else
                {
                    m[i].Invert(h);
                    if (used[m[i].L].Next != null)
                    {
                        Console.WriteLine(0);
                        return;
                    }

                    used[m[i].L].Next = m[i];
                }
            }
        }

        int[] ans = new int[n];
        int start = m[0].L;
        if (m[0].L < m[0].R) start = m.Min(x => x.L);
        if (m[0].L > m[0].R) start = m.Max(x => x.L);

        int d = m[0].R - m[0].L;
        int xx = 0;
        while (true)
        {
            Pair c = null;
            if (used[start] != null)
            {
                c = used[start];
                used[start] = used[start].Next;
            }
            else
            {
                int pos = h - start;
                c = used[pos];
                if (c == null)
                {
                    break;
                }
                used[pos] = used[pos].Next;
                c.Invert(h);
            }

            ans[xx++] = (c.Inverted ? -1 : 1) * c.Index;
            start = c.R;
        }

        if (xx != n)
        {
            Console.WriteLine(0);
            return;
        }

        Console.WriteLine(string.Join(" ", ans));*/
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n + 1];
        for (int i = 0; i <= n; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt();
            int b = ReadInt();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);

    private static int ReadInt()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong ReadULong()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long ReadLong()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] ReadIntArray(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadInt();
        return ans;
    }

    private static long[] ReadLongArray(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadLong();
        return ans;
    }

    private static char[] ReadString()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans < 'a' || ans > 'z');

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            ans = consoleReader.Read();
        } while (ans >= 'a' && ans <= 'z');

        return s;
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        while (true)
        {
            return ReadDigit() - (int)'0';
        }
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]), tn = 0;
        int m = int.Parse(inp[1]), tm = 0;

        tm = m * 3;
        tn = n * 2;
        for (int i = 6; i <= tn && i <= tm; i += 6)
        {
            if (tn >= tm + 3)
                tm += 3;
            else
                tn += 2;
        }
        int max = Math.Max(tn, tm);

        Console.WriteLine(max);
        Console.ReadLine();
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

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

namespace vc3
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
#if DEBUG
        static bool _useFileInput = false;
#else
        static bool _useFileInput = false;
#endif

        static void Main(string[] args)
        {
            StreamWriter file = null;
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }

#if DEBUG
			if (!_useFileInput)
			{
				Console.SetIn(getInput());
			}
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION
            var a = readIntArray();
            var n = a[0];
            var m = a[1];
            var h2 = 2;
            var h3 = 0;

            if (n == 0)
            {
                Console.WriteLine(3 * m);
                return;
            }

            if (m == 0)
            {
                Console.WriteLine(2 * n);
                return;
            }

            if (m >= n)
            {
                var rem = m - n;
                var h = (n / 2) * 6 + (n % 2) * 3 + rem * 3;
                Console.WriteLine(h);
                return;
            }
            else
            {
                var rem = n - m;
                var ct = rem / 2;
                var r = rem % 2;

                var rc = n - ct * 3;
                var h = (rc / 2) * 6 + (rc % 2) * 2 + ct * 6;
                Console.WriteLine(h);
                return;
            }

            //while (true)
            //{
            //    if (m > 0)
            //    {
            //        if (h3 < h2 || n == 0)
            //        {
            //            while (h3 < h2 && m > 0)
            //            {
            //                h3 += 3;
            //                m--;
            //            }

            //            continue;
            //        }
            //    }

            //    if (n > 0)
            //    {
            //        if (h2 < h3 || m == 0)
            //        {
            //            while (h2 < h3 && n > 0)
            //            {
            //                h2 += 2;
            //                n--;
            //            }

            //            continue;
            //        }
            //    }

            //    if (h2 == h3)
            //    {
            //        var p2 = (n + 1) * 2;
            //        var p3 = (m + 1) * 3;

            //        if (p2 > p3)
            //        {

            //        }
            //    }
            //}

            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]), tn1 = 0, tn2 = 0;
        int m = int.Parse(inp[1]), tm1 = 0, tm2 = 0;

        for (int i = 0; i < n; i++)
        {
            //tn1 += 2;
            tn2 += 2;
            if (tn2 % 3 == 0 && m * 3 >= tn2)
                tn2 += 2;
        }
        tm2 = m * 3;
        int max = -1;
        //max = (tn1 < max) ? tn1 : max;
        max = (tn2 > max) ? tn2 : max;
        //max = (tm1 < max) ? tm1 : max;
        max = (tm2 > max) ? tm2 : max;

        Console.WriteLine(max);
        Console.ReadLine();
    }
}


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

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }

    public int CompareTo(PairVariable other)
    {
        return other.a.CompareTo(this.a);
    }
}

namespace ConsoleApplication254
{

    class Program
    {

        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int m = int.Parse(ss[1]);
            List<int> l = new List<int>();
            bool f = false;
            for (int i = 1; i <= n; i++)
            {
                if (i * 2 <= m * 3 && (i * 2) % 3 == 0)
                {
                    f = true;
                    l.Add(i * 2);
                }
            }
            if (f)
            {
                int max1 = 0;
                int max2 = 0;
                l.Sort();
                int[] l2 = new int[l.Count];
                for (int i = 0; i < l.Count; i++)
                {
                    l2[i] = (l[i]);
                }
                l[0] = n * 2 + 2;
                for (int i = 1; i < l.Count; i++)
                {
                    l[i] = l[i - 1] + 2;
                }
                l2[0] = m * 3 + 3;
                for (int i = 1; i < l2.Length; i++)
                {
                    l2[i] = l2[i - 1] + 2;
                }
                Console.WriteLine(Math.Min(l.Max(), l2.Max()));

            }
            else
            {
                long x = (long)n * 2;
                long y = (long)m * 3;
                if (x > y)
                {
                    Console.WriteLine(x);
                }
                else if (y > x)
                {
                    Console.WriteLine(y);
                }
                else
                {
                    Console.WriteLine(x + 2);
                }
            }
        }
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        var inp = Console.ReadLine().Split(' ');
        int n = int.Parse(inp[0]), tn1 = 0, tn2 = 0;
        int m = int.Parse(inp[1]), tm1 = 0, tm2 = 0;

        for (int i = 0; i < n; i++)
        {
            //tn1 += 2;
            tn2 += 2;
            if (tn2 % 3 == 0 && m * 3 >= tn2)
                tn2 += 2;
        }
        for (int i = 0; i < m; i++)
        {
            //tm1 += 3;
            tm2 += 3;
            //if (tm2 % 2 == 0 && n * 2 >= tm2)
                //tm2 += 3;
        }
        int max = -1;
        //max = (tn1 < max) ? tn1 : max;
        max = (tn2 > max) ? tn2 : max;
        //max = (tm1 < max) ? tm1 : max;
        max = (tm2 > max) ? tm2 : max;

        Console.WriteLine(max);
        Console.ReadLine();
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var v = sc.Long();
            var K = sc.Integer();
            double p = sc.Integer() / 100.0;
            var q = 1 - p;
            var dp = new double[256, 2, 300];
            if (v < 256) dp[(int)v, 0, 0] = 1.0;
            else
            {
                for (int i = 9; i < 32; i++)
                    if ((v >> i) % 2 == (v >> 8) % 2) continue;
                    else
                    {
                        dp[v % 256, (v >> 8) % 2, i - 8] = 1.0;
                        break;
                    }
            }

            /*var a = new long[10];
            for (int i = 0; i < 10; i++)
                a[i] = (v >> i) % 2;
            IO.Printer.Out.WriteLine(a.AsJoinedString());*/
            for (int _ = 0; _ < K; _++)
            {
                var next = new double[256, 2, 300];

                for (int i = 0; i < 256; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        for (int k = 0; k < 250; k++)
                        {
                            if (dp[i, j, k] == 0) continue;

                            if (((i * 2) >> 8) % 2 == j)
                                next[(i * 2) % 256, j, k + 1] += dp[i, j, k] * p;
                            else next[(i * 2) % 256, j ^ 1, 1] += dp[i, j, k] * p;

                            if (i == 255)
                            {
                                if (j == 1)
                                    next[0, 0, k] += dp[i, j, k] * q;
                                else next[0, 1,1 ] += dp[i, j, k] * q;
                            }
                            else
                                next[i + 1, j, k] += dp[i, j, k] * q;
                        }
                    }
                }
                dp = next;
            }

            var E = 0.0;
            for (int i = 0; i < 256; i++)
                for (int j = 0; j < 2; j++)
                    for (int k = 0; k < 250; k++)
                    {
                        if (dp[i, j, k] == 0) continue;
                        if (i == 0)
                        {
                            var u = (j == 1) ? 8 : 8 + k;
                            E += dp[i, j, k] * u;
                        }
                        else
                        {
                            for (int l = 0; l < 8; l++)
                                if ((i >> l) % 2 == 1)
                                {
                                    E += l * dp[i, j, k];
                                    break;
                                }
                        }

                    }
            IO.Printer.Out.WriteLine("{0:F12}", E);

        }
        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion


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

// (づ*ω*)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int TrailingZeroes(int x)
    {
        int ret = 0;
        while (x % 2 == 0)
        {
            ret++;
            x >>= 1;
        }
        return ret;
    }

    public object Solve()
    {
        int x = ReadInt();
        int k = ReadInt();
        double p = ReadInt() / 100.0;
        double q = 1 - p;

        const int MASK = 1 << 8;
        const int MAX_ONES = 250;
        var dp = new double[MASK, MAX_ONES];

        int rep;
        if (x % MASK == 0)
            rep = TrailingZeroes(x) - 8;
        else
        {
            rep = 0;
            int xx = x >> 8;
            while (xx % 2 == 1)
            {
                rep++;
                xx >>= 1;
            }
        }
        dp[x % MASK, rep] = 1;

        for (int step = 0; step < k; step++)
        {
            var ndp = new double[MASK, MAX_ONES];
            for (int i = 0; i < MASK; i++)
                for (int j = 0; j < MAX_ONES; j++)
                    if (dp[i,j] > 0)
                    {
                        if (i == 0)
                        {
                            ndp[0, j + 1] += dp[0, j] * p;
                            ndp[1, 0] += dp[0, j] * q;
                        }
                        else
                        {
                            int ii = (i << 1) % MASK;
                            int jj;
                            if (ii == 0)
                                jj = 0;
                            else
                                jj = (i >> 7 & 1) == 1 ? j + 1 : 0;
                            ndp[ii, jj] += dp[i, j] * p;

                            ii = i + 1;
                            if (ii == MASK)
                                ndp[0, j] += dp[i, j] * q;
                            else
                                ndp[ii, j] += dp[i, j] * q;
                        }
                    }
            dp = ndp;
        }

        double ans = 0;

        for (int i = 0; i < MASK; i++)
            for (int j = 0; j < MAX_ONES; j++)
                if (i == 0)
                    ans += (8 + j) * dp[0, j];
                else
                    ans += TrailingZeroes(i) * dp[i, j];

        return ans.ToString(CultureInfo.InvariantCulture);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = Console.In;
        writer = new StreamWriter(Console.OpenStandardOutput());
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#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));
    }

    #endregion
}


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

// (づ*ω*)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int TrailingZeroes(int x)
    {
        int ret = 0;
        while (x % 2 == 0)
        {
            ret++;
            x >>= 1;
        }
        return ret;
    }

    public object Solve()
    {
        int x = ReadInt();
        int k = ReadInt();
        double p = ReadInt() / 100.0;
        double q = 1 - p;

        const int MASK = 1 << 8;
        const int MAX_ONES = 250;
        var dp = new double[MASK, MAX_ONES];

        int rep;
        if (x % MASK == 0)
            rep = TrailingZeroes(x) - 8;
        else
        {
            rep = 0;
            int xx = x >> 8;
            while (xx % 2 == 1)
            {
                rep++;
                xx >>= 1;
            }
        }
        dp[x % MASK, rep] = 1;

        for (int step = 0; step < k; step++)
        {
            var ndp = new double[MASK + 1, MAX_ONES];
            for (int i = 0; i < MASK; i++)
                for (int j = 0; j < MAX_ONES; j++)
                    if (dp[i,j] > 0)
                    {
                        if (i == 0)
                        {
                            ndp[0, j + 1] += dp[0, j] * p;
                            ndp[1, 0] += dp[0, j] * q;
                        }
                        else
                        {
                            int ii = (i << 1) % MASK;
                            int jj;
                            if (ii == 0)
                                jj = 0;
                            else
                                jj = (i >> 7 & 1) == 1 ? j + 1 : 0;
                            ndp[ii, jj] += dp[i, j] * p;

                            ii = i + 1;
                            if (ii == MASK)
                                ndp[0, j + 1] += dp[i, j] * q;
                            else
                                ndp[ii, j] += dp[i, j] * q;
                        }
                    }
            dp = ndp;
        }

        double ans = 0;

        for (int i = 0; i < MASK; i++)
            for (int j = 0; j < MAX_ONES; j++)
                if (i == 0)
                    ans += (8 + j) * dp[0, j];
                else
                    ans += TrailingZeroes(i) * dp[i, j];

        return ans.ToString(CultureInfo.InvariantCulture);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = Console.In;
        writer = new StreamWriter(Console.OpenStandardOutput());
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#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));
    }

    #endregion
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var v = sc.Long();
            var K = sc.Integer();
            double p = sc.Integer() / 100.0;
            var q = 1 - p;
            var dp = new double[256, 2, 300];
            var b = v % 256;
            var c = (v >> 8) % 2;
            for (int i = 9; i < 64; i++)
                if ((v >> i) % 2 == 0)
                {
                    dp[v % 256, (v >> 8) % 2, i - 9] = 1.0;
                    break;
                }
            for (int _ = 0; _ < K; _++)
            {
                var next = new double[256, 2, 300];

                for (int i = 0; i < 256; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        for (int k = 0; k < 250; k++)
                        {
                            if (dp[i, j, k] == 0) continue;
                            if (j == 1)
                                next[i * 2 % 256, ((i * 2) >> 8) % 2, k + 1] += dp[i, j, k] * p;
                            else next[i * 2 % 256, ((i * 2) >> 8) % 2, 0] += dp[i, j, k] * p;
                            if (i == 255)
                            {
                                if (j == 1)
                                    next[0, 0, k + 1] += dp[i, j, k] * q;
                                else next[0, 1, 0] += dp[i, j, k] * q;
                            }
                            else
                                next[i + 1, j, k] += dp[i, j, k] * q;
                        }
                    }
                }
                dp = next;
            }

            var E = 0.0;
            for (int i = 0; i < 256; i++)
                for (int j = 0; j < 2; j++)
                    for (int k = 0; k < 250; k++)
                    {
                        if (i == 0)
                        {
                            E += dp[i, j, k] * (j + k);
                        }
                        else
                        {
                            for (int l = 0; l < 8; l++)
                                if ((i >> l) % 2 == 1)
                                {
                                    E += l * dp[i, j, k];
                                    break;
                                }
                        }

                    }
            IO.Printer.Out.WriteLine("{0:F12}", E);

        }
        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var v = sc.Long();
            var K = sc.Integer();
            double p = sc.Integer() / 100.0;
            var q = 1 - p;
            var dp = new double[256, 2, 300];
            var b = v % 256;
            var c = (v >> 8) % 2;
            var t = 0;
            for (int i = 9; i < 32; i++)
                if ((v >> i) % 2 == 1)
                {
                    t = i - 8;
                    break;
                }
            dp[v % 256, (v >> 8) % 2, t] = 1.0;
            /*var a = new long[10];
            for (int i = 0; i < 10; i++)
                a[i] = (v >> i) % 2;
            IO.Printer.Out.WriteLine(a.AsJoinedString());*/
            for (int _ = 0; _ < K; _++)
            {
                var next = new double[256, 2, 300];

                for (int i = 0; i < 256; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        for (int k = 0; k < 250; k++)
                        {
                            if (dp[i, j, k] == 0) continue;
                            if (j == 1)
                            {
                                if (((i * 2) >> 8) % 2 == 1)
                                    next[(i * 2) % 256, 1, 0] += dp[i, j, k] * p;
                                else next[(i * 2) % 256, 0, k + 1] += dp[i, j, k] * p;
                            }
                            else
                            {
                                if (((i * 2) >> 8) % 2 == 1)
                                    next[(i * 2) % 256, 1, 0] += dp[i, j, k] * p;
                                else next[(i * 2) % 256, 0, k + 1] += dp[i, j, k] * p;
                            }

                            if (i == 255)
                            {
                                if (j == 1)
                                    next[0, 0, 1] += dp[i, j, k] * q;
                                else next[0, 1, 0] += dp[i, j, k] * q;
                            }
                            else
                                next[i + 1, j, k] += dp[i, j, k] * q;
                        }
                    }
                }
                dp = next;
            }

            var E = 0.0;
            for (int i = 0; i < 256; i++)
                for (int j = 0; j < 2; j++)
                    for (int k = 0; k < 250; k++)
                    {
                        if (dp[i, j, k] == 0) continue;
                        if (i == 0)
                        {
                            var u = (j == 1) ? 8 : 8 + k;
                            E += dp[i, j, k] * u;
                        }
                        else
                        {
                            for (int l = 0; l < 8; l++)
                                if ((i >> l) % 2 == 1)
                                {
                                    E += l * dp[i, j, k];
                                    break;
                                }
                        }

                    }
            IO.Printer.Out.WriteLine("{0:F12}", E);

        }
        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion


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

// (づ*ω*)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int TrailingZeroes(int x)
    {
        int ret = 0;
        while (x % 2 == 0)
        {
            ret++;
            x >>= 1;
        }
        return ret;
    }

    public object Solve()
    {
        int x = ReadInt();
        int k = ReadInt();
        double p = ReadInt() / 100.0;
        double q = 1 - p;

        const int MASK = 1 << 8;
        const int MAX_ONES = 250;
        var dp = new double[MASK, MAX_ONES];

        int rep;
        if (x % MASK == 0)
            rep = TrailingZeroes(x) - 8;
        else
        {
            rep = 0;
            int xx = x >> 8;
            while (xx % 2 == 1)
            {
                rep++;
                xx >>= 1;
            }
        }
        dp[x % MASK, rep] = 1;

        for (int step = 0; step < k; step++)
        {
            var ndp = new double[MASK + 1, MAX_ONES];
            for (int i = 0; i < MASK; i++)
                for (int j = 0; j < MAX_ONES; j++)
                    if (dp[i,j] > 0)
                    {
                        if (i == 0)
                        {
                            ndp[MASK, j + 1] += dp[0, j] * p;
                            ndp[1, 0] += dp[0, j] * q;
                        }
                        else
                        {
                            int ii = (i << 1) % MASK;
                            int jj;
                            if (ii == 0)
                                jj = 0;
                            else
                                jj = (i >> 7 & 1) == 1 ? j + 1 : 0;
                            ndp[ii, jj] += dp[i, j] * p;

                            ii = i + 1;
                            if (ii == MASK)
                                ndp[0, j + 1] += dp[i, j] * q;
                            else
                                ndp[ii, j] += dp[i, j] * q;
                        }
                    }
            dp = ndp;
        }

        double ans = 0;

        for (int i = 0; i < MASK; i++)
            for (int j = 0; j < MAX_ONES; j++)
                if (i == 0)
                    ans += (8 + j) * dp[0, j];
                else
                    ans += TrailingZeroes(i) * dp[i, j];

        return ans.ToString(CultureInfo.InvariantCulture);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = Console.In;
        writer = new StreamWriter(Console.OpenStandardOutput());
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#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));
    }

    #endregion
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var v = sc.Integer();
            var k = sc.Integer();
            double p = sc.Integer() / 100.0;
            var q = 1 - p;
            var dp = new double[256, 255];
            for (int i = 0; i < 32; i++)
                if ((v >> i) % 2 == 1)
                {
                    dp[v % 256, i] = 1.0;
                    break;
                }
            for (int _ = 0; _ < k; _++)
            {
                var next = new double[256, 255];
                for (int i = 0; i < 256; i++)
                    for (int j = 0; j < 250; j++)
                    {
                        if (dp[i, j] == 0.0) continue;
                        next[(i * 2) % 256, j + 1] += dp[i, j] * p;

                        if (i == 255)
                            next[0, 8] += dp[i, j] * q;
                        else
                        {
                            var nf = (i + 1) % 256;
                            for (int l = 0; l < 8; l++)
                                if ((nf >> l) % 2 == 1)
                                {
                                    next[nf, l] += dp[i, j] * q;
                                    break;
                                }
                        }
                    }
                dp = next;
            }
            var sum = 0.0;
            for (int i = 0; i < 256; i++)
                for (int j = 0; j < 250; j++)
                    sum += j * dp[i, j];
            IO.Printer.Out.WriteLine(sum);

        }
        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion


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

// (づ*ω*)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int TrailingZeroes(int x)
    {
        int ret = 0;
        while (x % 2 == 0)
        {
            ret++;
            x >>= 1;
        }
        return ret;
    }

    public object Solve()
    {
        int x = ReadInt();
        int k = ReadInt();
        double p = ReadInt() / 100.0;
        double q = 1 - p;

        const int MASK = 1 << 8;
        const int MAX_ONES = 20;
        var dp = new double[MASK, MAX_ONES];

        int rep;
        if (x % MASK == 0)
            rep = TrailingZeroes(x) - 8;
        else
        {
            rep = 0;
            int xx = x >> 8;
            while (xx % 2 == 1)
            {
                rep++;
                xx >>= 1;
            }
        }
        dp[x % MASK, rep] = 1;

        for (int step = 0; step < k; step++)
        {
            var ndp = new double[MASK + 1, MAX_ONES];
            for (int i = 0; i < MASK; i++)
                for (int j = 0; j < MAX_ONES; j++)
                    if (dp[i,j] > 0)
                    {
                        if (i == 0)
                        {
                            ndp[0, j + 1] += dp[0, j] * p;
                            ndp[1, 0] += dp[0, j] * q;
                        }
                        else
                        {
                            int ii = (i << 1) % MASK;
                            int jj;
                            if (ii == 0)
                                jj = 0;
                            else
                                jj = (i >> 7 & 1) == 1 ? j + 1 : 0;
                            ndp[ii, jj] += dp[i, j] * p;

                            ii = i + 1;
                            if (ii == MASK)
                                ndp[0, j] += dp[i, j] * q;
                            else
                                ndp[ii, j] += dp[i, j] * q;
                        }
                    }
            dp = ndp;
        }

        double ans = 0;

        for (int i = 0; i < MASK; i++)
            for (int j = 0; j < MAX_ONES; j++)
                if (i == 0)
                    ans += (8 + j) * dp[0, j];
                else
                    ans += TrailingZeroes(i) * dp[i, j];

        return ans.ToString(CultureInfo.InvariantCulture);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = Console.In;
        writer = new StreamWriter(Console.OpenStandardOutput());
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#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));
    }

    #endregion
}


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var v = sc.Long();
            var K = sc.Integer();
            double p = sc.Integer() / 100.0;
            var q = 1 - p;
            var dp = new double[256, 2, 300];
            var b = v % 256;
            var c = (v >> 8) % 2;
            for (int i = 9; i < 64; i++)
                if ((v >> i) % 2 == 0)
                {
                    dp[v % 256, (v >> i), i - 9] = 1.0;
                    break;
                }
            for (int _ = 0; _ < K; _++)
            {
                var next = new double[256, 2, 300];

                for (int i = 0; i < 256; i++)
                {
                    for (int j = 0; j < 2; j++)
                    {
                        for (int k = 0; k < 250; k++)
                        {
                            if (dp[i, j, k] == 0) continue;
                            if (j == 1)
                                next[i * 2 % 256, ((i * 2) >> 8) % 2, k + 1] += dp[i, j, k] * p;
                            else next[i * 2 % 256, ((i * 2) >> 8) % 2, 0] += dp[i, j, k] * p;
                            if (i == 255)
                            {
                                if (j == 1)
                                    next[0, 0, k + 1] += dp[i, j, k] * q;
                                else next[0, 1, 0] += dp[i, j, k] * q;
                            }
                            else
                                next[i + 1, j, k] += dp[i, j, k] * q;
                        }
                    }
                }
                dp = next;
            }

            var E = 0.0;
            for (int i = 0; i < 256; i++)
                for (int j = 0; j < 2; j++)
                    for (int k = 0; k < 250; k++)
                    {
                        if (i == 0)
                        {
                            E += dp[i, j, k] * (j + k);
                        }
                        else
                        {
                            for (int l = 0; l < 8; l++)
                                if ((i >> l) % 2 == 1)
                                {
                                    E += l * dp[i, j, k];
                                    break;
                                }
                        }

                    }
            IO.Printer.Out.WriteLine("{0:F12}", E);

        }
        internal IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; }
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
    }
}

#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
            Error = new Printer(System.IO.Stream.Null);
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
        public void Flush() { str.Flush(); }

    }
}
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion