---
# System prepended metadata

title: 2/16 熱身找手感

---

f071. 2. 刮刮樂 (Lottery)
===
熱熱身
```python=
a, b, c=map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
bol = 0;ans = 0
for i in range(5):
    if A[i]==a:
        ans+=B[i]
    elif A[i]==b:
        ans+=B[i]
    elif A[i]==c:
        ans-=B[i]
        bol = 1
    else:
        continue
if ans<0:
    print(0)
elif bol == 1:
    print(ans)
else:
    print(ans*2)
```