```
class Solution(object):
def canMeasureWater(self, x, y, z):
dmax = max(x, y)
dmin = min(x, y)
if dmin ==0 and dmax ==z or z ==0:
return True
elif dmin == 0 and dmax != z or x+y<z:
return False
resid = self.gcd(dmax, dmin)
return True if z % resid == 0 else False
def gcd(self, x, y):
return x if y == 0 else self.gcd(y, x%y)
```