public class Euler100 {
    public static void main(String[] args) {
        long blue = 15, total = 21, limit = 1000000000000L;
        while (total <= limit) {
            long nb = 3 * blue + 2 * total - 2, nt = 4 * blue + 3 * total - 3;
            blue = nb;
            total = nt;
        }
        System.out.println(blue);
    }
}
