I found a solution to my problem. Instead of trying to calculate how much of a package gets deducted, I just have to say that every item's 'Pack' has only 1 unit and divide the cost of each pack with the actual amount that I'm ordering.

SOLVED.