@Override
	public long findAnswer() {
		long answer = 0;
		counts = new int[max];
		cns = new int[max];

		counts[1] = 0;
		cns[1] = 0;

		counts[2] = 1;
		cns[2] = 1;

		counts[3] = 1;
		cns[3] = 2;

		int position = 2;
		for (int i = 4; i < max; ++i) {
			int count1;
			int cost1;

			// Cost of staying at position
			int cost1L = costLeft(position);
			int cnt1L = countLeft(position);
			int cost1R = costRight(i, position);
			int cnt1R = countRight(i, position);

			if (cost1R == cost1L) {
				cost1 = cost1R;
				count1 = Math.min(cnt1L, cnt1R);
			} else if (cost1R > cost1L) {
				cost1 = cost1R;
				count1 = cnt1R;
			} else {
				cost1 = cost1L;
				count1 = cnt1L;
			}

			// Cost of going to position + 1
			int count2;
			int cost2;

			// Cost of staying at position
			int cost2L = costLeft(position + 1);
			int cnt2L = countLeft(position + 1);
			int cost2R = costRight(i, position + 1);
			int cnt2R = countRight(i, position + 1);
			if (cost2R == cost2L) {
				cost2 = cost2R;
				count2 = Math.min(cnt2L, cnt2R);
			} else if (cost2R > cost2L) {
				cost2 = cost2R;
				count2 = cnt2R;
			} else {
				cost2 = cost2L;
				count2 = cnt2L;
			}

			int cost;
			int cnt;
			if (cost2 == cost1) {
				cost = cost2;
				if (count2 < count1) {
					position++;
				}
				cnt = Math.min(count1, count2);
			} else if (cost2 < cost1) {
				cost = cost2;
				cnt = count2;
				position++;
			} else {
				cost = cost1;
				cnt = count1;
			}
			counts[i] = cnt;
			cns[i] = cost;
			System.out.println("cost1L=" + cost1L + " cost1R=" + cost1R
					+ " cost2L=" + cost2L + " cost2R=" + cost2R);
			System.out.println("cost1=" + cost1 + " cost2=" + cost2);
			System.out.println("cost=" + cost);

			System.out.println(i + ": " + cns[i] + " " + counts[i] + " "
					+ position);
		}

		return answer;
	}