min R is pretty easy here, I should probably optimize a bit hm