There is a game where you have an item and you can raise the level of the item from +0 to a higher value.
To do this you have to spend a Gem. First 6 upgrades are 100% successful. The 7th upgrade has a 50% chance of successfully raising the item 1 level and 50% chance of dropping it 1 level. The 8th upgrade is 50% successful just like the 7th, but it will drop the level to +0 on failure.
I'm trying to determine what is the average number of Gems I have to spend to raise the item from +0 to +8. Without loss of progress I think the average value would be 6+2*(1/50%) = 10 gems (six 100% upgrades and two 50% upgrades), but I don't know how to account for the level drop.