```\n         for (uint256 i = 0; i < balances.length; i++) {\n               if (i == indexOfReferenceToken) {\n                amtsNeeded[i] = amtIn;\n         } else {\n         // amtsNeeded[i] = (amtIn * balances[i]) / \n                  balances[indexOfReferenceToken];\n                     amtsNeeded[i] = Arithmetic.overflowResistantFraction(amtIn, \n                  balances[i], balances[indexOfReferenceToken]);\n               }\n            }\n```\n