Amazon interview question

Basic calculation