# Include <iostream> # include <cstdio> using namespace STD; long F (INT temp [], int I, int aim) {If (! I) Return 0;/* I just on the aim I don't need to move, otherwise I first move the I-1 above the transit, moving I to aim (1 time), finally moving all I-1 to aim :( (1 <(I-1)-1) times */If (temp [I] = aim) return F (temp, I-1, aim); else return F (temp, I-1, 6-temp [I]-aim) + (long) 1 <(I-1);} int main () {int N, I, K, Case = 0, start [65], goal [65]; long ans; while (CIN> N & N) {Case ++; for (I = 1; I <= N; I ++) cin> Start [I]; for (I = 1; I <= N; I ++) CIN> goal [I]; k = N; while (k> 0 & start [k] = goal [k]) k --; // find the largest and Number of Plates with different positions in the face K; If (! K) ans = 0; else ans = f (START, K-1, 6-start [k]-goal [k]) + f (goal, K-1, 6-start [k]-goal [k]) + 1; printf ("case % d: % LLD \ n", Case, ANS);} return 0 ;}