1.
/**
 *
 * Problem #10198 - Counting
 * http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1139

 *
 * @author Mariya Vlaseva
 *
 * Status : Accepted
 * Runtime: 0.716
 */

import java.math.BigInteger;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input = new Scanner (System.in);
        BigInteger number [] = new BigInteger [1000 + 10];

        Arrays.fill(number, BigInteger.ZERO);

        number [0] = BigInteger.valueOf(1);
        number [1] = BigInteger.valueOf(2);
        number [2] = BigInteger.valueOf(5);
        number [3] = BigInteger.valueOf(13);

        for ( int i = 4; i <= 1000; i++ ) {
            number [i] = number [i].add(number [i - 1]);
            number [i] = number [i].add(number [i - 2]);
            number [i] = number [i].add(number [i - 3]);
            number [i] = number [i].add(number [i - 1]);
        }

        int n;

        while ( input.hasNextInt() ) {
            n = input.nextInt();
            System.out.println (number [n]);
        }
    }
}