長い物には巻かれよ(ながいものにはまかれよ)

Japanese vocabulary

Meaning: if you can't beat them; join them; you can't fight city hall; if your adversaries are stronger than you, it is better to join their side than to fight them

See it used in real works