#include <stdio.h>
#include <stdlib.h>

int main()
{
    int B, C;
    scanf("%d%d", &B, &C);
    while(B > 500 || B < 0 || C > 500 || C < 0){
        scanf("%d%d", &B, &C);
    }
    if(B + C < 256)
        if(B > C)
            printf("%d", 256 - B);
        else
            printf("%d", 256 - C);

    else
        printf("0");
    return 0;
}