#include <stdio.h>

int main(void) {
    int n = 4;
    int a, b = 3, c = 2; // b = a_2, c = a_1

    for (int i = 3; i <= n; i++) {
        a = 2 * b + c; // a_i = 2 * a_{i-1} + a_{i-2}
        c = b;         // 次のステップのため、古い a_{i-1} を a_{i-2} の位置へ退避
        b = a;         // 次のステップのため、新しい a_i を a_{i-1} の位置へ更新
    }

    printf("数列a%dの値は%d\n", n, a);
    return 0;
}