using System; using System.Text; using System.Linq; using System.Collections.Generic; public class Program { public void Proc() { Reader.IsDebug = false; Reader.IsDebug = true; decimal baseNum = 100m/3; int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); this.p0 =inpt[0]; this.q = inpt[1]; decimal ans = this.GetAns( baseNum, (decimal)p0) + baseNum; Console.WriteLine(ans); } private decimal GetAns(decimal current, decimal p1) { if((current < 1/100000000000m)) { return current; } decimal useHissyo = current * p1 / 100; decimal ans = 0; if(useHissyo > 0) { ans += useHissyo / 2; ans += GetAns(useHissyo / 2, Math.Max(p1-q, 0)); } ans += (current - useHissyo) / 3; ans += GetAns((current-useHissyo)/3, Math.Min(p1+q, 100)); return ans; } private int p0; private int q; public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" 20 80 "; public static string ReadLine() { if(IsDebug) { if(SReader == null) { SReader = new System.IO.StringReader(InitText.Trim()); } return SReader.ReadLine(); } else { return Console.ReadLine(); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }