calculate global min/max using folds