#include <bits/stdc++.h>
using namespace std;
int main(){
cout<<setprecision(2)<<fixed;
char c;
cin>>c;
double initial;
cin>>initial;
map<char,double> mpp;
mpp[c]=initial;
int n;
cin>>n;
int skip;
cin>>skip;
for(int i=0;i<n;i++){
char u,v;
cin>>u>>v;
int pt;
cin>>pt;
if(i==skip){
continue;
}
double balance=mpp[u];
double to_give = double(balance*pt)/(100.00);
mpp[v]+=to_give;
mpp[u]=balance-to_give;
}
for(auto it:mpp){
cout<<it.first<<" will have "<<it.second<<endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKaW50IG1haW4oKXsKIAogICAgY291dDw8c2V0cHJlY2lzaW9uKDIpPDxmaXhlZDsKIAogICAgIGNoYXIgYzsKICAgIGNpbj4+YzsKIAogIGRvdWJsZSBpbml0aWFsOwogIGNpbj4+aW5pdGlhbDsKIAogCiAgbWFwPGNoYXIsZG91YmxlPiBtcHA7CiAgbXBwW2NdPWluaXRpYWw7CiAKICBpbnQgbjsKICBjaW4+Pm47CiAKIGludCBza2lwOwogY2luPj5za2lwOwogIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgY2hhciB1LHY7CiAgICBjaW4+PnU+PnY7CiAgICBpbnQgcHQ7CiAgICBjaW4+PnB0OwogICAgaWYoaT09c2tpcCl7CiAgICAJY29udGludWU7CiAgICB9CiAKIAogICAgIGRvdWJsZSBiYWxhbmNlPW1wcFt1XTsKICAgICBkb3VibGUgdG9fZ2l2ZSA9IGRvdWJsZShiYWxhbmNlKnB0KS8oMTAwLjAwKTsKICAgIG1wcFt2XSs9dG9fZ2l2ZTsKICAgIG1wcFt1XT1iYWxhbmNlLXRvX2dpdmU7CiAKICB9CiAKIAogIGZvcihhdXRvIGl0Om1wcCl7CiAgICBjb3V0PDxpdC5maXJzdDw8IiB3aWxsIGhhdmUgIjw8aXQuc2Vjb25kPDxlbmRsOwogIH0KIAogICAgICByZXR1cm4gMDsKICAgIH0=