Its a case analysis. All the detail of the question is given below

Mailadon21