Divergent regioselectivity in photoredox-catalyzed hydrofunctionalization reactions of unsaturated amides and thioamides