This program has been glitching for me so I was not able to check if this was logical before publishing it. I'm sorry if it has multiple solutions.