Convert a 5-bit base 2 number into a 2-digit base 6 number. 0 is salt, 1 is fire, the metals are however many quicksilver you need to promote lead into that metal (lead is 0, gold is 5). If the base 2 number is 16 or greater, add 2 before you convert it, because we interpret the leading bit as 18 instead of 16 because it makes the quicksilver less sad. The bits of the input are out of order, and will probably keep changing their order as I tinker.