using System;


namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            int b, c;
            string input = Console.ReadLine();
            var d = input.Split(' ');
            b = int.Parse(d[0]);
            c = int.Parse(d[1]);
            if(b + c >= 256)
            {
                Console.WriteLine(0);
            }
            else
            {
                int deltaB = 256 - b;
                int deltaC = 256 - c;

                Console.WriteLine(Math.Min(deltaB, deltaC));
            }
        }
    }
}