How to calculate the qaza time of magrib and isha prayers

For isha midnight is the last time and before that for 4 rakat is last time of maghrib