#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    int c1=256-a, c2=256-b;
    if (a+b>=256)
    {
        cout << 0;
        return 0;
    }   
    cout << min(c1,c2);
    return 0;
}