A compound of formula, or a pharmaceutically acceptable salt, prodrug, solvate, hydrate, or stereoisomer thereof, wherein the prodrug is an (alkoxycarbonyloxy)alkyl carbamate, (acyloxy)alkyl carbamate, (oxodioxolenyl)alkyl carbamate, amide or ester of the formula, wherein: R 1 is phenyl or 5- to 10-membered heteroaryl, wherein the phenyl or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-a alkyl, CN, hydroxyC 1-6 alkyl, aminoC 1-6 alkyl, -C 1-6 alkyl-O-C 1-6 alkyl, -C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-N-(C 1-6 alkyl) 2, -C 1-6 alkyl-NH-C 1-6 alkyl-OH, -C 1-6 alkyl-NH-C 1-6 alkyl-C 3-10 cycloalkyl, -C 1-6 alkyl-NH-C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-NH-C -C 1-6 alkyl, -C 1-6 alkyl-O-C -C 1-6 alkyl, -C 1-6 alkyl-NH-C 0-6 alkyl-(4- to 6-membered heterocyclyl), or -C 1-6 alkyl-NH-C 0-6 alkyl-(5- to 6-membered heteroaryl), wherein the C 1-a alkyl, cycloalkyl, heterocyclyl, and/or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-6 alkyl, NH 2, hydroxyC 1-6 alkyl, or aminoC 1-6 alkyl; R 2 is C 1-6 alkyl, hydroxyC 1-6 alkyl, aminoC 1-6 alkyl, -C 1-6 alkyl-O-C 1-6 alkyl, -C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-N-(C 1-6 alkyl) 2, -C 1-6 alkyl-NH-C 1-6 alkyl-OH, -C 1-6 alkyl-NH-C 1-6 alkyl-C 3-10 cycloalkyl, -C 1-6 alkyl-NH-C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-NH-C -C 1-6 alkyl, -C 1-6 alkyl-O-C -C 1-6 alkyl, -C 1-6 alkyl-NH-C 0-6 alkyl-(4- to 6-membered heterocyclyl), -C -NH 2, -C -NH-C 1-6 alkyl, -C -N(C 1-6 alkyl) 2, or -C 1-6 alkyl-NH-C 0-6 alkyl-(5- to 6-membered heteroaryl), wherein the C 1-a alkyl, heterocyclyl, or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-6 alkyl, cycloalkyl, NH 2, hydroxyC 1-6 alkyl, or aminoC 1-6 alkyl; and R 8 is H or C 1-6 alkyl; alternatively, R 2, R 8, and the C atom that both R 2 and R 8 are attached join together to form a 3- to 10- membered cycloalkyl or 4- to 10-membered heterocyclyl ring, wherein the cycloalkyl or heterocyclyl is unsubstituted or substituted with 1-3 substituents selected from hydroxyl, halogen, or C 1-6 alkyl; n is 0 to 6; R 3 is H or C 1-6 alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; M is a bond or NH; X and Y are each independently CH, C-R 7, or N; Z is CH or N; R 5 is H, halogen, C 1-a alkyl, or O-C 1-6 alkyl, wherein C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; R 6 is H or C 1-a alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; R 7 is C 1-a alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; and R 4 is R 1 is phenyl or 5- to 10-membered heteroaryl, wherein the phenyl or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-a alkyl, CN, hydroxyC 1-6 alkyl, aminoC 1-6 alkyl, -C 1-6 alkyl-O-C 1-6 alkyl, -C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-N-(C 1-6 alkyl) 2, -C 1-6 alkyl-NH-C 1-6 alkyl-OH, -C 1-6 alkyl-NH-C 1-6 alkyl-C 3-10 cycloalkyl, -C 1-6 alkyl-NH-C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-NH-C -C 1-6 alkyl, -C 1-6 alkyl-O-C -C 1-6 alkyl, -C 1-6 alkyl-NH-C 0-6 alkyl-(4- to 6-membered heterocyclyl), or -C 1-6 alkyl-NH-C 0-6 alkyl-(5- to 6-membered heteroaryl), wherein the C 1-a alkyl, cycloalkyl, heterocyclyl, and/or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-6 alkyl, NH 2, hydroxyC 1-6 alkyl, or aminoC 1-6 alkyl; R 2 is C 1-6 alkyl, hydroxyC 1-6 alkyl, aminoC 1-6 alkyl, -C 1-6 alkyl-O-C 1-6 alkyl, -C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-N-(C 1-6 alkyl) 2, -C 1-6 alkyl-NH-C 1-6 alkyl-OH, -C 1-6 alkyl-NH-C 1-6 alkyl-C 3-10 cycloalkyl, -C 1-6 alkyl-NH-C 1-6 alkyl-NH-C 1-6 alkyl, -C 1-6 alkyl-NH-C -C 1-6 alkyl, -C 1-6 alkyl-O-C -C 1-6 alkyl, -C 1-6 alkyl-NH-C 0-6 alkyl-(4- to 6-membered heterocyclyl), -C -NH 2, -C -NH-C 1-6 alkyl, -C -N(C 1-6 alkyl) 2, or -C 1-6 alkyl-NH-C 0-6 alkyl-(5- to 6-membered heteroaryl), wherein the C 1-a alkyl, heterocyclyl, or heteroaryl is unsubstituted or substituted with 1-3 substituents selected from halogen, C 1-6 alkyl, cycloalkyl, NH 2, hydroxyC 1-6 alkyl, or aminoC 1-6 alkyl; and R 8 is H or C 1-6 alkyl; alternatively, R 2, R 8, and the C atom that both R 2 and R 8 are attached join together to form a 3- to 10- membered cycloalkyl or 4- to 10-membered heterocyclyl ring, wherein the cycloalkyl or heterocyclyl is unsubstituted or substituted with 1-3 substituents selected from hydroxyl, halogen, or C 1-6 alkyl; n is 0 to 6; R 3 is H or C 1-6 alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; M is a bond or NH; X and Y are each independently CH, C-R 7, or N; Z is CH or N; R 5 is H, halogen, C 1-a alkyl, or O-C 1-6 alkyl, wherein C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; R 6 is H or C 1-a alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; R 7 is C 1-a alkyl, wherein the C 1-6 alkyl is unsubstituted or substituted with 1-5 halogens; and R 4 is