Nagai problem statement... Easy but also easy to miss some points of requirements...