fixing off-by-one RIB median bug
adding the 1d program for the future