import java.io.*; import java.util.*; public class fuses { static int maxConsumption=0, cc=0, n, m, c, deviceState[], seqNr=0; static String powerConsumption[], deviceToggle[]; public static void toggleDevice(int x) { if (deviceState[x]==0) { deviceState[x]=1; cc+=(new Integer(powerConsumption[x])).intValue(); } else { deviceState[x]=0; cc-=(new Integer(powerConsumption[x])).intValue(); } if (cc>maxConsumption) maxConsumption=cc; } public static void main(String[] argv) { ReadFile rf=new ReadFile("fuses.in"); loop: while(true) { cc=0; maxConsumption=0; String s=rf.getNextLine(); StringTokenizer st=new StringTokenizer(s); n=(new Integer(st.nextToken())).intValue(); m=(new Integer(st.nextToken())).intValue(); c=(new Integer(st.nextToken())).intValue(); if ((n==0) && (m==0) && (c==0)) break loop; powerConsumption=new String[n]; powerConsumption=rf.getNextBlock(n); deviceToggle=new String[m]; deviceToggle=rf.getNextBlock(m); deviceState=new int[n]; for (int i=0 ; i