let rec tak =
    fun x -> fun y -> fun z ->
        if x < y + 1 then
            z
        else
            tak (tak (x - 1) y z)
                (tak (y - 1) z x)
                (tak (z - 1) x y)
in

let x = read_int () in
let y = read_int () in
let z = read_int () in
print (tak x y z)
