---
# System prepended metadata

title: h660. 躲避球 (DodgeBall)

---

## 題目連結:[660](https://zerojudge.tw/ShowProblem?problemid=h660)
我遇到的困難是一開始的如果條件有漏掉，花的點時間才解決。
```python=
x, r, v = map(int,input().split())
n = int(input())
for i in range(n):
    p, s = map(int,input().split())
    if p < x-r and p > x+r:
        pass
    elif p >= x-r and p <= x+r and s<=v:
        x = p
    elif p >= x-r and p <= x+r and p<x:
        x += 15
    elif  p >= x-r and p <= x+r and p>x:
        x -= 15
    elif  p >= x-r and p <= x+r and p == x:
        x -= 15
print(x)
        
```