CS117
Coconuts
4/2/2007

Once upon a time, there were five people and a monkey on a ship bound for Australia. They didn't make it, however, and were shipwrecked on a desert island. All five people spent the first night on the island gathering coconuts, and they placed them in a big pile in the center of the camp. During the night, one person woke up and decided to take his share of the coconuts. He divided them evenly into one pile for each person (five piles), and gave the remainder to the monkey. He then took his pile out, buried it, and combined the remaining coconuts back together.

Soon a second person woke up and did the same thing. She divided her coconuts into a pile for each person (five piles), and gave the remainder to the monkey. She then hid her share and went back to bed. The third, fourth, and fifth people followed exactly the same procedure. Later on during the night, all the buried coconuts were eaten by a desert island beast. The main pile that was left in the camp was safe since the monkey was guarding it.

The next morning, after they all woke up, they divided the remaining coconuts into five equal shares. Any remaining coconuts were given to the monkey.

Write a program that will take as input the initial number of coconuts, and will print out to the screen the number of coconuts that each person gets in the morning and how many the monkey gets.