The optimality of age-based lockdown policies