let
pos n =
let
i = n / bpi
and
j = n
mod
bpi
in
if
j < 0
then
(i - 1, j + bpi)
else
(i,j)