LearnPy Hub
← Functions problems
Hard

Function as Argument

Write apply_n(f, x, n) that applies function f to x, n times. Read x and n and print the result of applying double (x → 2x) n times, then add3 (x → x + 3) n times.

Input

Two integers.

Output

Two lines.

Sample 1

Input
1
10
Output
1024
31

Sample 2

Input
5
0
Output
5
5
solution.py
Output appears here
Function as Argument · Python practice problem · LearnPy Hub