Traffic management

Hi

I have a Mikrotik board connected to two WAN interface modems that might not always be connected to the internet.

I’d like to send all UDP traffic down link A when the modem has a connection or link B when it doesn’t.
All TCP traffic should be split across all links that have an internet connection.

Any ideas on where to start?