```
int maxA(int N) {
if (N <= 6) return N;
if (N == 10) return 20;
int n = N / 5 + 1, n3 = n * 5 - 1 - N;
return pow(3, n3) * pow(4, n - n3);
}
```

Pure math. This problem is to partition number N into 3's and 4's and get their product. ** n = N / 5 + 1** is to compute the number of factors(the total number of 3's and 4's). With n, it's easy to know how many out of them are 3's by computing

**. We minus 1 here because adding a single factor requires one step more than the factor itself, e.g. x4 takes 5 steps (select all, copy, paste, paste, paste). 10 is special here because it's the only > 6 number where there is no enough factors to share cuts from decrement of the number of 3's which means a 5 has to be introduced.**

*n3 = n * 5 - 1 - N*