#include <bits/stdc++.h>

using namespace std;

int B, C;
int ost1, ost2;

int main()
{
    cin>> B>> C;
    
    if(B>=256 || C>=256)
    cout<<0;
    
    else {
        ost1=256-B;
    ost2=256-C;
    
    if(ost1>=ost2)
    cout<<ost2;
    
    else cout<<ost1;
        
    }
    
}