import java.io.;
import java.util.;
public class test {
public static void main(String [] args) throws FileNotFoundException {
Scanner console= new Scanner( new File("transactions.txt"));
PrintStream outPut = new PrintStream( new File("put.txt"));
double c=0;
double x = console.nextDouble();
while ( console.hasNextLine()) {
String token= console.next();
for (int i=1; i<=4;i++) {
if (token.equals("Deposit")){
c += x;
outPut.print("Balance "+i+": $"+c);
}else {
c -= x;
outPut.print("Balance "+i+": $"+c);
}
}
}
}
}