#include <bits/stdc++.h>

using namespace std;

int B,C,minimum1,minimum2;

int main (){

    cin>>B>>C;

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

else {

   minimum1=256-B;
   minimum2=256-C;

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