scoreboard players set min times_appeared 0

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

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

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

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

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

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