Amazon Interview Question

Trying to answer the math question in a reasonable time