Teva to buy Ratiopharm for nearly $5 billion