import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
long arr[] = new long[31];
long arr2[] = new long[31];
arr[0] = arr2[1] = 1;
for (int i = 2; i < arr.length; i++) {
arr[i] = arr[i - 2] + 2 * arr2[i - 1];
arr2[i] = arr[i - 1] + arr2[i - 2];
}
while (true) {
int x = Integer.parseInt(br.readLine());
if (x < 0) {
break;
}
if (x % 2 == 1) {
sb.append("0\n");
} else {
sb.append(arr2[x] + arr[x]).append("\n");
}
}
System.out.print(sb);
}
}
No comments:
Post a Comment