solved problemB 2013 roundB solution