// OBčh2009 Day2 C : Dial Lock #include using namespace std; int k, ans; int cur[10], res[10]; void search(int depth, int count){ if(depth==k){ ans = min(ans, count); return ; } int diff = (res[depth]-cur[depth]+10)%10; int tmp[10]; for(int i=0;i> k, k){ long long c, a; cin >> c >> a; for(int i=0;i