Wow, cool!! However, can you enlighten me a bit more why $r_a=d$ follows? $a$ and $b$ are set, $l$ and $k$ can be chosen in any way from $\mathbb{Z}$, but they must make $d$ the smallest possible $d$. I don't really see how $1-l_a\cdot l$ and $l_a\cdot k$ are minimal... Or can we just say "Choose $l_a,l,k$ such that $a(1-l_a\cdot l)+l_a\cdot k\cdot b$ gets minimal, then it equals $d$"? But what if it isn't minimal?