#include <stdio.h>

int a = 4;

int h (int c) {
  return c*c;
}

int f (int b) {
  int c = b + a;
  
  int g (int b) {
    if (b > c) {
      a = b;
      return h (b-1);
    }
    else {
      int a = f(b/2-2);
      return a+c;
    }
  }

  int h (int c) {
    int a = b+2;
    while (a < c) {
      a = a + g(b);
    }
    return a;
  }

  return (b > 0 ? h(g(c)) : c);
}

int main() {
  // This just prints the result on a line.
  printf("%d\n", f(5));
  return 0;
}