purchases |> group_by(country) |> filter(amount <= median(amount) * 10) |> summarize(total = sum(amount - discount))