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

namespace MInimalan_trud
{
    class Program
    {
        static void Main(string[] args)
        {
            int b, c;
            b = Convert.ToInt16(Console.ReadLine());
            c = Convert.ToInt16(Console.ReadLine());
            if ((b >= 0 && b <= 500) && (c >= 0 && c <= 500))
            {
                if (b >= 256 || c >= 256)
                {
                    Console.Write("0");
                }
                else
                {
                    int min = 256 - b;
                    if (min > 256 - c)
                    {
                        min = 256 - c;
                    }
                    Console.Write(min.ToString());
                }
               
            }
        }
    }
}