A laboratory operates two independent energy channels. An experiment consists of N phases. During each phase, each channel performs either:
Freshly generated energy in a phase may be routed to either channel. Energy already present in a channel cannot later be transferred.
Initially both channels contain exactly 1 unit of energy.
Determine the maximum total energy after all phases.
Input Format
Sample Input 1: 3
I 8 A 2
A 3 I 9
I 4 A 2
Sample Output 1:
74
Sample Input 2:
3
I 5 A 2
A 2 A 3
I 4 I 8
Sample Output 2: 35
1 <= N <= 30
1 <= Inject <= 1000
2 <= Amplify <= 3
Phonepay • Pending
Phonepay • Pending
Adobe • Pending
Adobe • Pending
Salesforce • Pending