Okay Ammo can go from Pristine to damaged to ruined. We are taking the ruined and damaged to Pristine.
Take an ammo pile that has damaged ones into different piles. If you compile the damaged ammo it will make Pristine Ammo, and leave you with 1 ruined Ammo. Keep combining ammo and move the the individual ruined ammo into their own stack. Once you have all of the ruined ammo single stacks combine those and repeat the process. You will end up with all pristine ammo except 1 ruined and 0 damaged.