Four people need to cross a bridge at night. They only have one flashlight and the bridge can only hold two people at a time.
Ana takes 1 minute to cross, Bea takes 2 minutes, Carlos takes 5 minutes and David takes 10 minutes. When two people cross together, they go at the speed of the slower person.
What is the minimum time everyone can cross the bridge?