Ma Tovu (Hebrew for "O How Good" or "How Goodly") is a prayer in Judaism, expressing reverence and awe for synagogues and other places of worship.
The prayer begins with Numbers 24:5, where Balaam, sent to curse the Israelites, is instead overcome with awe at God and the Israelites' houses of worship. Its first line of praise is a quote of Balaam's blessing and is thus the only prayer commonly used in Jewish services that was written by a non-Jew. The remainder of the text is derived from passages in Psalms relating to entering the house of worship and preparation for further prayer (Psalms 5:8; 26:8; 95:6; and 69:14). In this vein is the prayer recited by Jews upon entering the synagogue.
מַה טֹּבוּ אֹהָלֶיךָ, יַעֲקֹב; מִשְׁכְּנֹתֶיךָ, יִשְׂרָאֵל. (1 Numbers 24:5
וַאֲנִי בְּרב חַסְדְּךָ אָבא בֵיתֶךָ אֶשְׁתַּחֲוֶה אֶל הֵיכַל קָדְשְׁךָ בְּיִרְאָתֶךָ. (2 Psalms 5:8
3) .ה׳ אָהַבְתִּי מְעון בֵּיתֶךָ וּמְקום מִשְׁכַּן כְּבודֶךָPsalms 26:8
וַאֲנִי אֶשְׁתַּחֲוֶה וְאֶכְרָעָה אֶבְרְכָה לִפְנֵי ה׳ עשִׂי. (4 Psalms 95:6 (adapted)