You have probably heard of code golfing? There the task is to find the shortest computer program that produces the required output. Here we want to perform math golfing - find the shortest formula that produces a given number. The length of a formula is measured as the number of characters. The format must be as follows:
- Contain only digits '0' to '9' and characters '+' (addition), '-' (subtraction), '*' (multiplication), '^' (exponentiation), brackets '(' and ')'.
- Digits can be concatenated such as 567.
- Operations have precedence, like in BODMAS. Brackets are done first, followed by exponentiation, followed by multiplication, followed by addition/subtraction (from left to right).
- For example (10^2+1)*2^5 is equivalent to (100+1)*32 = 3232. The formula uses 12 characters, so it is not a compact representation of the result that has 4 characters.
Find the shortest formulas that represent the following numbers: