Remove duplicate values just once and then sum arr

arr=[1,2,3,3,4]
output 10
plz reply