scoreboard players set min times_appeared 0

execute if score #devils_book shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = devils_book times_appeared
execute if score #devils_book shop matches 1 if score devils_book times_appeared < min times_appeared run scoreboard players operation min times_appeared = devils_book times_appeared

execute if score #mana_barrel shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = mana_barrel times_appeared
execute if score #mana_barrel shop matches 1 if score mana_barrel times_appeared < min times_appeared run scoreboard players operation min times_appeared = mana_barrel times_appeared

execute if score #pure_rage shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = pure_rage times_appeared
execute if score #pure_rage shop matches 1 if score pure_rage times_appeared < min times_appeared run scoreboard players operation min times_appeared = pure_rage times_appeared

execute if score #sharpening_stone shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = sharpening_stone times_appeared
execute if score #sharpening_stone shop matches 1 if score sharpening_stone times_appeared < min times_appeared run scoreboard players operation min times_appeared = sharpening_stone times_appeared

execute if score #void_beast shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = void_beast times_appeared
execute if score #void_beast shop matches 1 if score void_beast times_appeared < min times_appeared run scoreboard players operation min times_appeared = void_beast times_appeared

execute if score #flying_daggers shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = flying_daggers times_appeared
execute if score #flying_daggers shop matches 1 if score flying_daggers times_appeared < min times_appeared run scoreboard players operation min times_appeared = flying_daggers times_appeared

execute if score #holy_book shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = holy_book times_appeared
execute if score #holy_book shop matches 1 if score holy_book times_appeared < min times_appeared run scoreboard players operation min times_appeared = holy_book times_appeared

execute if score #soul_splitter shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = soul_splitter times_appeared
execute if score #soul_splitter shop matches 1 if score soul_splitter times_appeared < min times_appeared run scoreboard players operation min times_appeared = soul_splitter times_appeared

execute if score #spinning_ice_stone shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = spinning_ice_stone times_appeared
execute if score #spinning_ice_stone shop matches 1 if score spinning_ice_stone times_appeared < min times_appeared run scoreboard players operation min times_appeared = spinning_ice_stone times_appeared
execute if score min times_appeared matches -1 run scoreboard players set min times_appeared 0