scoreboard players set min times_appeared 0

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

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

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

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

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

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