Divide Gold

Divide Gold

Captain Red Eye and his sailors found a chest containing a large number of identical gold coins. To divide up the coins, everyone agreed to the Captain's suggestion:

  • each sailor except the Captain should receive exactly the same number of coins;
  • the captain should receive twice as many coins as a sailor.

It may be that the fact that the Captain was the only one with a pistol on board contributed to everyone's agreement, but so did the fact that in the proposed form the division was perfect, with no Coins left over or missing.

Given the number of coins in the chest and the number of sailors, write a program to determine how many coins Captain Red Eye received. For example, for 15, 1 input:

example

Input: Two integers (int)

Output: Integer.

Examples:

assert captain_share(15, 1) == 10
assert captain_share(28, 2) == 14
assert captain_share(54, 4) == 18