Flickr/Mike Mozart

Nutrisystem Inc. (NTRI) has agreed to be acquired by Tivity Health Inc. (TVTY - Get Report)  for about $1.4 billion. 

News of the deal on Monday bloated shares of Nutrisystem, which closed up nearly 28% to $43.68, while Tivity slimmed down by nearly 32% to end the day at $27.65.

The deal is in both cash and stock. Nutrisystem shareholders will receive $38.75 in cash and 21 cents a share of Tivity for every Nutrisystem share they own. Tivity shareholders will own about 87% of the combined entity. 

The revenue from both companies if combined would have been been roughly $1.3 billion for a full year ended Sept. 30.

Both companies aim to help customers manage their health and diets. Nutrisystem, which sells a meal-kit plan, frequently advertises on ESPN. 

Nutrisystem shares have declined about 14% year to date. Tivity Health's shares had beaten the broader market this year, rising 11.11% from January 1 to Monday morning.