#include #include #include //#include using namespace std; int ucty[100000]; int N; char command; int a,b, a2, b2, c,d; bool end; int main() { while (1) { scanf(" %d", &N); if (N == 0) break; for (int i = 0; i < 100000; i++) ucty[i] = -1; for (int i = 0; i < N; i++) { scanf("%d/%d %d.%d\n", &a, &b, &c, &d); ucty[a*10+b] = c*100+d; } end = false; while (end == false) { scanf("%c", &command); switch(command) { case 'c': scanf("reate %d/%d", &a, &b); if (ucty[a*10+b] != -1) printf("create: already exists\n"); else { printf("create: ok\n"); ucty[a*10+b] = 0; } break; case 'd': scanf("eposit %d/%d %d.%d", &a, &b, &c, &d); if (ucty[a*10+b] == -1) printf("deposit %d.%02d: no such account\n", c, d); else { printf("deposit %d.%02d: ok\n", c, d); ucty[a*10+b] += 100*c+d; } break; case 'w': scanf("ithdraw %d/%d %d.%d", &a, &b, &c, &d); if (ucty[a*10+b] == -1) printf("withdraw %d.%02d: no such account\n", c, d); else { if (ucty[a*10+b] < 100*c+d) printf("withdraw %d.%02d: insufficient funds\n", c, d); else { printf("withdraw %d.%02d: ok\n", c, d); ucty[a*10+b] -= 100*c+d; } } break; case 't': scanf("ransfer %d/%d %d/%d %d.%d", &a, &b, &a2, &b2, &c, &d); if (ucty[a*10+b] == -1 || ucty[a2*10+b2] == -1) printf("transfer %d.%02d: no such account\n", c, d); else if (a*10+b == a2*10+b2) printf("transfer %d.%02d: same account\n", c, d); else { if (ucty[a*10+b] < 100*c+d) printf("transfer %d.%02d: insufficient funds\n", c, d); else { if (b == b2) printf("transfer %d.%02d: ok\n", c, d); else printf("transfer %d.%02d: interbank\n", c, d); ucty[a*10+b] -= 100*c+d; ucty[a2*10+b2] += 100*c+d; } } break; case 'e': scanf("nd"); printf("end\n\n"); end = true; break; } } } printf("goodbye\n"); return 0; }