Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d = map(int,input().split())
cd = math.gcd(c, d)
lcmcd = c*d//cd
ans = 0
for i in range(a,b+1):
  if i % lcmcd != 0:
    ans += 1
print(ans)






Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d = map(int,input().split())
cd = math.gcd(c, d)
lcm(cd) = c*d//cd
ans = 0
for i in range(a,b+1):
  if i % lcm(cd) != 0:
    ans += 1
print(ans)






Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
ans = 0
cpn = 0
for i in range(a,b+1):
  if i % c == 0 or i % d == 0:
    cpn = 0
  else:  
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(4100000)

a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i % c != 0:
    if i % d != 0:
      ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i % c != 0:
    if i % d != 0:
      ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i % c != 0 and i % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i % c != 0 and i % d != 0:
    ans += 1
print(ans)

Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(int(a),int(b)+1,))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1,1))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a, b+1))


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(b))
ans = 0



Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(b))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)



Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a, b+1))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0
for i in range(len(l)):
  if l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0
for i in range(len(l)):
  l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)


Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = list(range(a,b+1))
ans = 0
for i in l:
  l[i] % c != 0 and l[i] % d != 0:
    ans += 1
print(ans)

Fixed submission:
A,B,C,D = map(int,input().split())

def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

def F(N,C,D):
  x = N
  x -= N//C
  x -= N//D
  lcm = C*D//gcd(C,D)
  x += N//lcm
  return x

answer = F(B,C,D) - F(A-1,C,D)
print(answer)