```
class Solution {
public int maxA(int N) {
int[] result = new int[N];
for(int i = 0; i < 3 && i < N; i++)
result[i] = i+1;
int i = 4;
while(i <= N){
result[i-1] = i;
int j = i;
while(j > 3){
result[i-1] = Math.max(result[i-1], (i - j + 2) * result[j - 3 -1]);
j--;
}
i++;
}
return result[N-1];
}
}
```