import java.util.ArrayList;
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
java.util.Scanner in = new java.util.Scanner(System.in);
ArrayList<String> names = new ArrayList<String>();
String s = new String("");
while(true){
s=in.next();
if(s.equals("###")) {
break;
}
else {
names.add(s);
}
}
HashMap<String,Integer> mileage_table = new HashMap<String,Integer>();
int n = names.size();
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
s=names.get(i)+"&"+names.get(j);
mileage_table.put(s, in.nextInt());
}
}
s=in.next()+"&"+in.next();
in.close();
System.out.println(mileage_table.get(s));
}
}
|