#include<stdio.h>#include<stdlib.h>int main(){ int a,b,c; while(scanf("%d%d",&a,&b)) { if((a==-1)&&(b==-1)) break; c=abs(a-b); (c>50)?printf("%d\n",100-c):printf("%d\n",c);}}