while(0<1)println((BigInt(0)/:(readLine split'^'map(_.toInt)grouped 2))((z,a)=>z^BigInt(a(0)).pow(a:+1 apply 1)))