package main;import."fmt";func main(){for{s,t:="","";Scan(&s,&t);Print((s+t)[3+1/ ^(s[1]^s[2])]&15)}}