public static void main(String [] args) {
		// dynamic programming, backtracking from lower right to top left
		// we'll do this carefully, in place, n the map array
		for (int i=SIZE-1; i>=0; i--) {
			for (int j=SIZE-1; j>=0; j--) {
				int downDist = Integer.MAX_VALUE;
				int rightDist = Integer.MAX_VALUE;
				if (i < SIZE-1) {
					downDist = map[i+1][j];
				}
				if (j < SIZE-1) {
					rightDist = map[i][j+1];
				}
				if (i==SIZE-1 && j==SIZE-1) {
					// leave lower right alone
				} else if (downDist < rightDist) {
					map[i][j] += downDist;
				} else {
					map[i][j] += rightDist;
				}
			}
		}
		System.out.println(map[0][0]);
	}