I'm not sure what your formula is supposed to represent but I do know that you can simply solve this problem using three
free body diagrams.
If this still doesn't help you, come back and we'll give you more detailed help but, really, you should be able to take it from here...