2021 WSMO Team Round/Problem 7

Problem

A frog makes one hop every minute on the first quadrant of the coordinate plane (this means that the frog's $x$ and $y$ coordinates are positive). The frog can hop up one unit, right one unit, left one unit, down one unit, or it can stay in place, and will always randomly choose a valid hop from these 5 directions (a valid hop is a hop that does not place the frog outside the first quadrant). Given that the frog starts at $(1,1)$, the expected number of minutes until the frog reaches the line $x+y=5$ can be expressed as $\frac{m}{n}$, where $m$ and $n$ are relatively prime positive integers. Find $m+n$.

Solution