Can anyone please help to find a formula for this case?

This is a table of shared monthly fee for a rented house. I can't make a proper formula (from C8 to C11 cells) which will calculate the rent fee for each student according to stayed days and share among them (B5) respectively.

Pre-conditions:

-Monthly rent fee is always fixed;

-Daily fee varies according to current month;

-A student who didn't stay a single day should be excluded from the list (in this example there are 4 student, but Tom is excluded in B5).

A | B | C | |

1 | Month: | APRIL | |

2 | Total Days: | 30 | |

3 | Rent Fee: | 5000 | |

4 | Per Day: | 167 | |

5 | Students stayed: | 3 | |

6 | |||

7 | Name: | Days stayed: | Need to Pay: |

8 | Adam | 30 | =? |

9 | Bob | 30 | =? |

10 | John | 15 | =? |

11 | Tom | 0 | 0 |

Thank you in advance.