eolymp
Competitions

залік_26_2021

Function 9

Write a program that finds the value of the function

prb2214.gif

Input

Two positive integers n and m (1n, m1018).

Output

Print the value of the function f(m, n).

Time limit 1 second
Memory limit 128 MiB
Input example #1
6 3
Output example #1
3
Input example #2
12 12
Output example #2
12