 So,

So if we began in modulo class –4 nuts then we will remain in modulo class –4.Since ultimately we have to divide the pile 5 times or 5^5, the original pile was 5^5 – 4 = 3121 coconuts.The remainder of 1020 coconuts conveniently divides evenly by 5 in the morning.