#include <bits/stdc++.h>

using namespace std;

int B,C,minimum1,minimum2;

int main (){

    cin>>B>>C;

     if (B+C>=256){cout<<0<<endl;}
   else  if (B>=256){cout<<0<<endl;}
    else if (C>=256){cout<<0<<endl;}

else {

   if (B<256){minimum1=256-B;}
   if (C<256){minimum2=256-C;}

    cout<<min(minimum1,minimum2)<<endl;}
return  0;
}