הכל בידי שמים - כל הבא על האדם ביד הקב"ה כגון ארוך קצר עני עשיר חכם שוטה לבן שחור הכל בידי שמים הוא אבל צדיק ורשע אינו בא על ידי שמים את זו מסר בידו של אדם ונתן לפניו שני דרכים והוא יבחר לו יראת שמים:
Everything that comes to a person, is by way of הקב"ה, for example, someone who is tall, short, poor, rich, wise, impaired, white, black. All if from Heaven, but the choice to be a צדיק or רשע does not come from Heaven, this a person acquires for himself. And he is given two paths and he is supposed to choose with Fear of Heaven
Believe it or not, the only sort of free will a person has, that to make the right or wrong decision. Notice, that Rashi says there are 2 paths put in front of a person
does this mean that one path is essentially good? and one is bad?
The answer is yes. However, as we know things are never black and white, a person could have 2 perfectly viable decisions, yet one of them is going to ultimately be "less good" than the other.
It is a person's job and responsibility to as it were "put himself in Hashem's shoes" and in that way, make a decision for himself.
(ט) רַבִּי חֲנִינָא בֶן דּוֹסָא אוֹמֵר, כָּל שֶׁיִּרְאַת חֶטְאוֹ קוֹדֶמֶת לְחָכְמָתוֹ, חָכְמָתוֹ מִתְקַיֶּמֶת. וְכָל שֶׁחָכְמָתוֹ קוֹדֶמֶת לְיִרְאַת חֶטְאוֹ, אֵין חָכְמָתוֹ מִתְקַיֶּמֶת.
(9) Rabbi Chanina ben Dosa says: Anyone whose fear of sin precedes his wisdom, his wisdom endures. And anyone whose wisdom precedes his fear of sin, his wisdom does not endure.
(א) רבי חנינא בן דוסא אומר כל שיראת חטאו קודמת לחכמתו חכמתו מתקיימת. לענין השתדלות נאמר הדבר. המשתדל לדעת חכמה כדי שידע לשמור את נפשו מן החטא ונחכם. חכמתו מתקיימת בידו ונמצא פורש מן העבירות ועושה מצוה כאשר למד והשכיל: לא השתדל מתחלה לדעת החכמה כדי לקיימה כי אם להבין ולהשכיל ולא תקיים בידו. והדין נותן.
ד"א בזמן שיראת חטאו של אדם קודמת לחכמתו נמצא כשהוא למד משמרתו ומאשרתו לילך בדרך שהורגל ללכת בה מכמה ימים כשהוא ירא חטא ולבו מוסיף בה אהבה רבה ומתאוה להוסיף ממנה לפי שהיא מאשרתו למה שהורגל. אבל בזמן שחכמתו של אדם קודמת ליראת חטאו נמצאת החכמה מונעת אותו מעבירות שהורגל בהם וסופו לבעוט בה לפי שדומה עליו כמשוי:
(1) Rabbi Chanina ben Dosa says: Anyone whose fear of sin precedes his wisdom, his wisdom endures: The matter is said regarding the effort a person must have: One who makes efforts to know wisdom in order to guard his soul from sin - and he becomes wise; his wisdom endures in his hand. And it comes out that when the studies and becomes enlightened, he removes himself from sins and does a commandment. He did not make efforts from the beginning to know wisdom in order to observe it, but rather to understand and be enlightened; and [so] it will not endure in his hand. And this is in line with justice.
Another explanation: When a person's fear of sin precedes his wisdom, it comes out that when he studied, it guarded him and strengthened him to go on the path that he is accustomed to from many days; since when he fears sin and his heart adds great love for it and desires to add to it, it strengthens him to do that to which he is accustomed. But when the wisdom of a person precedes his fear of sin, it comes out that his wisdom [tries to] prevent him from sins that he is accustomed to. And in the end, he will rebel against it - as it will appear like a burden to him.
1) proper fear touches the inner workings of a person and crafts a person's being into something greater, that is why learning to fear strengthens you
wisdom doesn't probe the depths of what a person is, it is often superficial, therefore you are learning without taking the deep ideas to heart, and your yetzer ends up rationalizing ways to rebel against them.
2) Fear of Heaven is founded in something divine, therefore a person would logically receive Divine Assistance in his path for acquiring wisdom, thus he has created a path for himself with neverending growth.
However, Wisdom is grounded (often) as a physical persual and therefore, his potential is stunted because he does not beckon for anything outside of this world.
(א) רְשׁוּת לְכָל אָדָם נְתוּנָה. אִם רָצָה לְהַטּוֹת עַצְמוֹ לְדֶרֶךְ טוֹבָה וְלִהְיוֹת צַדִּיק הָרְשׁוּת בְּיָדוֹ. וְאִם רָצָה לְהַטּוֹת עַצְמוֹ לְדֶרֶךְ רָעָה וְלִהְיוֹת רָשָׁע הָרְשׁוּת בְּיָדוֹ. הוּא שֶׁכָּתוּב בַּתּוֹרָה (בראשית ג כב) "הֵן הָאָדָם הָיָה כְּאַחַד מִמֶּנּוּ לָדַעַת טוֹב וָרָע". כְּלוֹמַר הֵן מִין זֶה שֶׁל אָדָם הָיָה יָחִיד בָּעוֹלָם וְאֵין מִין שֵׁנִי דּוֹמֶה לוֹ בְּזֶה הָעִנְיָן שֶׁיְּהֵא הוּא מֵעַצְמוֹ בְּדַעְתּוֹ וּבְמַחֲשַׁבְתּוֹ יוֹדֵעַ הַטּוֹב וְהָרַע וְעוֹשֶׂה כָּל מַה שֶּׁהוּא חָפֵץ וְאֵין מִי שֶׁיְּעַכֵּב בְּיָדוֹ מִלַּעֲשׂוֹת הַטּוֹב אוֹ הָרַע. וְכֵיוָן שֶׁכֵּן הוּא פֶּן יִשְׁלַח יָדוֹ:
(1) Free-will is granted to every man. If he desires to incline himself towards the good way, and to become a righteous man, he has the power to do so; and if he desires to incline himself towards the wicked way, and to become a wicked man, he has also the power to do so. This is what is written in the law: Behold! the man is become as one of Us, to know good and evil, (Gen. 3. 22); which signifies that the human race have become unique in this world; inasmuch as there is not another kind of living creature equal to them in this respect, namely, in knowing by itself, by its own knowledge and by its own reflection, what is good and what is evil; and moreover in being able to do all that it wishes, without there being any one to prevent it from doing that which is good or that which is evil
אמר רבא בשעה שמכניסין אדם לדין אומרים לו נשאת ונתת באמונה קבעת עתים לתורה עסקת בפו"ר צפית לישועה פלפלת בחכמה הבנת דבר מתוך דבר ואפ"ה אי יראת ה' היא אוצרו אין אי לא לא.
משל לאדם שאמר לשלוחו העלה לי כור חיטין לעלייה. הלך והעלה לו. א"ל, עירבת לי בהן קב חומטון א"ל לאו א"ל מוטב אם לא העליתה
Rava said: After departing from this world, when a person is brought to judgment for the life he lived in this world, they say to him in the order of that verse: Did you conduct business faithfully? Did you designate times for Torah study? Did you engage in procreation? Did you await salvation? Did you engage in the dialectics of wisdom or understand one matter from another? And, nevertheless, beyond all these, if the fear of Hashem is his treasure, yes, he is worthy, and if not, no, none of these accomplishments have any value.
There is a parable that illustrates this. A person who said to his emissary: Bring a kor of wheat up to the attic for me to store there. The messenger went and brought it up for him. He said to the emissary: Did you mix a kav of ḥomton, a preservative to keep away worms, into it for me? He said to him: No. He said to him: If so, it would have been preferable had you not brought it up. Of what use is worm-infested wheat? Likewise, Torah and mitzvot without the fear of God are of no value.
(ג) קָשְׁרֵ֥ם עַל־אֶצְבְּעֹתֶ֑יךָ כָּ֝תְבֵ֗ם עַל־ל֥וּחַ לִבֶּֽךָ׃
(3) Bind them on your fingers; Write them on the tablet of your mind.
I think this is a posible answer to explain this Pasuk ^^.
What is pshat in כָּ֝תְבֵ֗ם עַל־ל֥וּחַ לִבֶּֽךָ? Of course it is referring to the Torah and Mitzvos, but as we learn those can only be properly utilized with Fear of Heaven (as Gemara in Shabbos said). So as we bind, etch, and engrave this fear-struck wisdom to our hearts, it's the combination of these two aspects, the חכמה and יראה together that allow Torah to be glued to a person's heart and never forget it.

