int main(i){for(;i++<33;){char s[5];scanf("%s",s);puts((s[1]-s[0])&2?"0":"1");}}