#include <stdio.h>
int f(int n){
if (n % 2 == 0){
return n / 2;
}
return n * 2;
}
int g(int n){
if (n % 2 == 0){
return n + 2;
}
return n - 2;
}
int func(int x, int n){
if (n == 1){
return f(x);
}
if (x % 2 == 0){
return g(x + func(x, n - 1));
}
else{
return f(x + func(x, n - 1));
}
}
int main(){
int x, n;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgZihpbnQgbil7CiAgICBpZiAobiAlIDIgPT0gMCl7CiAgICAgICAgcmV0dXJuIG4gLyAyOwogICAgfQogICAgcmV0dXJuIG4gKiAyOwogICAgCn0KCmludCBnKGludCBuKXsKICAgIGlmIChuICUgMiA9PSAwKXsKICAgICAgICByZXR1cm4gbiArIDI7CiAgICB9CiAgICByZXR1cm4gbiAtIDI7Cn0KCmludCBmdW5jKGludCB4LCBpbnQgbil7CiAgICBpZiAobiA9PSAxKXsKICAgICAgICByZXR1cm4gZih4KTsKICAgIH0KICAgIGlmICh4ICUgMiA9PSAwKXsKICAgICAgICByZXR1cm4gZyh4ICsgZnVuYyh4LCBuIC0gMSkpOwogICAgfQogICAgZWxzZXsKICAgICAgICByZXR1cm4gZih4ICsgZnVuYyh4LCBuIC0gMSkpOwogICAgfQp9CgppbnQgbWFpbigpewogICAgaW50IHgsIG47CiAgICBzY2FuZigiJWQgJWQiLCAmeCwgJm4pOwogICAgcHJpbnRmKCIlZCIsIGZ1bmMoeCwgbikpOwp9