<|instruction|>
Solve the below problem. The solution should start with an abridged problem statement. Then key observations. Then full solution based on the observations. Then C++ and Python implementations with comments.

130. Circle

time limit per test: 0.25 sec.
memory limit per test: 4096 KB


On a circle border there are 2k different points A1, A2, ..., A2k, located contiguously. These points connect k chords so that each of points A1, A2, ..., A2k is the end point of one chord. Chords divide the circle into parts. You have to find N - the number of different ways to connect the points so that the circle is broken into minimal possible amount of parts P.


Input

The first line contains the integer k (1 <= k <= 30).


Output

The first line should contain two numbers N and P delimited by space.


Sample Input

2
Sample Output

2 3
Author	: Natalia L. Andreeva, Alex Y. Suslov, Alexander S. Ivanov
Resource	: 5th Southern Subregional Contest. Saratov 2002
Date	: 2002-10-10

<|response|>
1. Abridged Problem Statement  
Given an even number of points (2·k) labeled A1…A2k placed around a circle, you must draw k non‐directed chords that pair up all points. These chords partition the circle into some regions. Find:  
  • N – the number of ways to draw the k chords so that the total number of regions is as small as possible.  
  • P – that minimal number of regions.

2. Key Observations  
• Any crossing of two chords creates extra regions. To minimize regions, no two chords should cross.  
• The number of ways to draw k non‐crossing chords on 2·k points on a circle is the k-th Catalan number:  
    Cₖ = (1/(k+1))·binomial(2k, k)  
• A non‐crossing matching of k chords splits the disk into exactly k+1 regions.  

3. Full Solution Approach  
1. Read integer k (1 ≤ k ≤ 30).  
2. Compute the sequence of Catalan numbers C[0…k] via the standard DP recurrence:  
     C[0] = 1  
     For n = 1…k:  
       C[n] = Σ_{i=0…n−1} (C[i] · C[n−1−i])  
3. Then N = C[k], and P = k + 1.  
4. Print N and P.  

Time complexity is O(k²), which is trivial for k ≤ 30. The largest Catalan number here (C₃₀ ≈ 3.9·10¹⁴) fits in a 64‐bit signed integer.

4. C++ Implementation with Detailed Comments  
#include <iostream>  
using namespace std;  

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int k;
    cin >> k;               // Number of chord pairs

    // C[i] will hold the i-th Catalan number
    long long C[31] = {0};
    C[0] = 1;               // Base case

    // Build Catalan numbers via the recurrence
    // C[n] = sum_{i=0..n-1} C[i] * C[n-1-i]
    for (int n = 1; n <= k; n++) {
        C[n] = 0;
        for (int i = 0; i < n; i++) {
            C[n] += C[i] * C[n - 1 - i];
        }
    }

    long long N = C[k];     // Number of non-crossing matchings
    int P = k + 1;          // Minimal regions

    cout << N << " " << P << "\n";
    return 0;
}

5. Python Implementation with Detailed Comments  
def main():  
    import sys  
    data = sys.stdin.read().split()  
    k = int(data[0])        # Number of chord pairs

    # Prepare a list for Catalan numbers up to index k
    C = [0] * (k + 1)
    C[0] = 1               # Base case

    # Compute Catalan numbers via convolution DP
    for n in range(1, k + 1):
        total = 0
        for i in range(n):
            total += C[i] * C[n - 1 - i]
        C[n] = total

    N = C[k]               # Number of ways
    P = k + 1              # Minimal number of regions

    # Output the result
    print(N, P)

if __name__ == "__main__":
    main()