San Francisco Mayor Daniel Lurie signed the city’s $16.9 billion budget Thursday, closing a $640 million budget deficit.

Lurie signed the budget at a senior community center alongside several members of the San Francisco Board of Supervisors.

The spending plan includes $34 million to help San Franciscans remain enrolled in Medi-Cal and CalFresh, $120 million for unhoused families, people living with HIV and AIDS, and LGBTQ+ community-based organizations, and $100 million set aside for potential state and federal cuts to housing and homelessness programs.

It also provides $20 million to upgrade equipment for first responders and $71 million for projects including street resurfacing, drug treatment programs and mental health services.

Lurie said the budget will help protect services as federal funding declines, while Supervisor Connie Chan said it reflects San Francisco’s values.

City officials said the budget closes a two-year deficit and avoids a scenario in which the city’s deficit would have reached $1 billion within five years.