Finish SPOJ online problem #4. Transform the Expression.