read {a..e} echo $[(a+c)/e<(b+=d)/e?e-1:b%e]