#include<iostream>

using namespace std;

int main(void)
{
    int b, c, a;

    do{
        cin>>b;
    }while(b<0 || b>500);

    do{
        cin>>c;
    }while(c<0 || c>500);

    if((b+c)>=256)
        a=0;
    else if((256-b)<=(256-c))
        a=256-b;
    else
        a=256-c;

    cout<<a<<endl;

    return 0;
}