solved problem B