solved problem c.