EOF error in problem S10E

for problem S10E
My code is working fine but there is a problem on taking input
when i use input() to take input it is giving EOF error