Pergunta de entrevista da empresa Jane Street

A question related to evaluating arithmetic expressions with a twist.