[step:Use the argument principle on a regularized boundary and record the angular weights]Let $\mathcal{Z}_T$ denote the finite set of zeros of $f$ in $F_T$. For each $z_0 \in \mathcal{Z}_T$, let $\alpha_T(z_0) \in (0,2\pi]$ be the interior angle of $F_T$ at $z_0$, counting both identified corner representatives when they represent the same point of $SL_2(\mathbb{Z})\backslash\mathbb{H}$. Choose $\varepsilon>0$ so small that the closed disks $\overline{B}(z_0,\varepsilon)$, for $z_0 \in \mathcal{Z}_T$, are pairwise disjoint and contain no zeros of $f$ other than their centres.
Define $\Gamma_{T,\varepsilon}$ to be the positively oriented boundary of
\begin{align*}
F_{T,\varepsilon}
=
F_T \setminus \bigcup_{z_0 \in \mathcal{Z}_T} \bigl(B(z_0,\varepsilon)\cap F_T\bigr),
\end{align*}
where each circular indentation is oriented as part of the boundary of $F_{T,\varepsilon}$. The function $g$ is holomorphic on a neighbourhood of $F_{T,\varepsilon}$, so the residue theorem applied to $g$ on $F_{T,\varepsilon}$ gives zero total integral. Moving the indentation integrals to the other side gives
\begin{align*}
\frac{1}{2\pi i}\int_{\Gamma_{T,\varepsilon,\mathrm{out}}}g(z)\,dz
=
\sum_{z_0\in \mathcal{Z}_T}\frac{\alpha_T(z_0)}{2\pi}v_{z_0}(f),
\end{align*}
where $\Gamma_{T,\varepsilon,\mathrm{out}}$ denotes the outer boundary pieces of $F_T$ with the small deleted arcs removed. Indeed, near a zero $z_0$ of order $r=v_{z_0}(f)$, write $f(z)=(z-z_0)^r h(z)$ with $h$ holomorphic and $h(z_0)\neq0$; then $g(z)=r/(z-z_0)+h'(z)/h(z)$. The indentation arc has clockwise orientation around $z_0$ and angular size $\alpha_T(z_0)$, so its contribution tends to $-i\alpha_T(z_0)r$ as $\varepsilon\to0$, while the holomorphic term contributes $0$ in the limit.
Let $\operatorname{ht}_F(p)$ denote the imaginary part of the representative of the orbit $p\in SL_2(\mathbb{Z})\backslash\mathbb{H}$ lying in $F$. Passing to the limit $\varepsilon\to0$ therefore yields
\begin{align*}
\frac{1}{2\pi i}\int_{\Gamma_{T,\mathrm{reg}}} g(z)\,dz
=
\sum_{\substack{p \in SL_2(\mathbb{Z})\backslash \mathbb{H} \\ p \neq [i],\, [\rho] \\ \operatorname{ht}_F(p) \leq T}}
v_p(f)
+
\frac{1}{2}v_i(f)
+
\frac{1}{3}v_\rho(f).
\end{align*}
Here $\int_{\Gamma_{T,\mathrm{reg}}}$ means the limit of the integrals over the regularized outer boundary. The factor $1/2$ at $i$ is the ratio of the angle $\pi$ of $F$ at $i$ to the full angle $2\pi$. At the orbit of $\rho$, the two boundary representatives $\rho$ and $\rho+1$ each contribute angle $\pi/3$, so their total contribution is
\begin{align*}
\frac{\pi/3+\pi/3}{2\pi}v_\rho(f)=\frac{1}{3}v_\rho(f).
\end{align*}
For non-elliptic boundary points, the side-pairing transformations identify two representatives with complementary angular fractions; their total angular coefficient is $1$, so the quotient zero is counted once.[/step]