Reference for Berakhot 4:2
רַבִּי נְחוּנְיָא בֶּן הַקָּנֶה הָיָה מִתְפַּלֵּל בִּכְנִיסָתוֹ לְבֵית הַמִּדְרָשׁ וּבִיצִיאָתוֹ תְּפִלָּה קְצָרָה. אָמְרוּ לוֹ, מַה מָּקוֹם לִתְפִלָּה זוֹ. אָמַר לָהֶם, בִּכְנִיסָתִי אֲנִי מִתְפַּלֵּל שֶׁלֹּא תֶאֱרַע תַּקָלָה עַל יָדִי, וּבִיצִיאָתִי אֲנִי נוֹתֵן הוֹדָיָה עַל חֶלְקִי:
R. Nechuniah b. Hakannah would recite a short prayer upon entering the house of study and upon leaving it. When asked: "What is the place [i.e., the nature] of this prayer?" he replied: "Upon entering I pray that no mischance occur because of me" [that I not create a stumbling-block, as explained in the baraitha: "that I not err in a halachah and my friends rejoice (in my discomfiture)" — whereby I become the cause of evil, my friends being punished because of me]; "and upon leaving, I give thanks for my portion." [I thank Him for the good that He bestowed upon me in placing my portion among those who sit in the house of study. These two prayers, upon entering the house of study and upon leaving it, are binding upon all men. For thus is it stated in the baraitha: "Upon entering what does he say?" and "Upon leaving what does he say?", the implication being that he must say them.]