Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

K=int(eval(input()))

if K%2==0:

    print((-1))

    exit(0)

ans=[0]*(pow(10,6)+1)

ans[0]=0

for i in range(1,pow(10,6)):

    ans[i]=(ans[i-1]*10+7)%K

    if ans[i]==0:

        print(i)

        exit(0)

print((-1))

# optimized version of the same code:

import functools

K=int(eval(input()))

if K%2==0:

    print((-1))

    exit(0)

mod=0

for i in range(1,pow(10,6)):

    mod=(mod*10+7)%K

    if mod==0:

        print(i)

        exit(0)

print((-1))

import functools

K = int(eval(input()))
if K % 2 == 0:
    print((-1))
    exit(0)
mod = 0
for i in range(1, pow(10, 6)):
    mod = (mod * 10 + 7) % K
    if mod == 0:
        print(i)
        exit(0)
print((-1))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def segfunc(x, y): return max(x, y)

class SegmentTree:

    def __init__(self, arr):

        size = len(arr)

        n = 2 ** (size - 1).bit_length()

        self.n = n

        self.node = [0] * (2*n)

        for i in range(size):

            self.node[i+n-1] = arr[i]

        for i in reversed(list(range(n-2))):

            self.node[i] = segfunc(self.node[2*i+1], self.node[2*i+2])

    def update(self, i, x):

        i += self.n - 1

        self.node[i] = x

        while i > 0:

            i = (i - 1) // 2

            self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])

    def update(self, x, val):

        x += (self.n - 1)

        self.node[x] = val

        while x > 0:

            x = (x - 1) // 2

            self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])

    def query(self, a, b):

        res = 0

        l = self.n - 1 + a

        r = self.n - 1 + (b - 1)

        while l <= r:

            if l == r:

                res = segfunc(res, self.node[l])

                break

            if l % 2 == 0:

                res = segfunc(res, self.node[l])

            if r % 2 == 1:

                res = segfunc(res, self.node[r])

            l = l // 2

            r = r // 2 - 1

        return res

N, K = list(map(int, input().split()))

INF = 0

seg = SegmentTree([0] * 300000)

for i in range(N):

    a = int(eval(input()))

    tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1

    seg.update(a, tmp)

print((seg.query(0, 300000)))

# optimized version of the same code:

def segfunc(x, y): return max(x, y)

def update(i, x):

    i += MAX_N-1

    node[i] = x

    while i:

        i = (i-1)//2

        node[i] = segfunc(node[i*2+1], node[i*2+2])

def query(l, r):

    L = l + MAX_N

    R = r + MAX_N

    s = INF

    while L < R:

        if R & 1:

            R -= 1

            s = segfunc(s, node[R - 1])

        if L & 1:

            s = segfunc(s, node[L - 1])

            L += 1

        L >>= 1

        R >>= 1

    return s

N, K = list(map(int, input().split()))

MAX_N = 2**(300005).bit_length()

a = [int(eval(input())) for _ in range(N)]

node = [0] * (2 * MAX_N)

INF = 0

ans = 0

#for i in range(N):

#    update(i, a[i])

for i in a:

    tmp = query(max(i - K, 0), min(300005, i + K) + 1)

    update(i, tmp + 1)

    ans = max(ans, tmp + 1)

print(ans)

def segfunc(x, y):
    return max(x, y)

class SegmentTree:
    def __init__(self, arr):
        size = len(arr)
        n = 2 ** (size - 1).bit_length()
        self.n = n
        self.node = [0] * (2 * n)
        for i in range(size):
            self.node[i + n - 1] = arr[i]
        for i in reversed(list(range(n - 2))):
            self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])

    def update(self, i, x):
        i += self.n - 1
        self.node[i] = x
        while i > 0:
            i = (i - 1) // 2
            self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])

    def update(self, x, val):
        x += self.n - 1
        self.node[x] = val
        while x > 0:
            x = (x - 1) // 2
            self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])

    def query(self, a, b):
        res = 0
        l = self.n - 1 + a
        r = self.n - 1 + (b - 1)
        while l <= r:
            if l == r:
                res = segfunc(res, self.node[l])
                break
            if l % 2 == 0:
                res = segfunc(res, self.node[l])
            if r % 2 == 1:
                res = segfunc(res, self.node[r])
            l = l // 2
            r = r // 2 - 1
        return res

N, K = list(map(int, input().split()))
INF = 0
seg = SegmentTree([0] * 300000)
for i in range(N):
    a = int(eval(input()))
    tmp = seg.query(max(a - K, 0), min(a + K, 300000) + 1) + 1
    seg.update(a, tmp)
print((seg.query(0, 300000)))

def segfunc(x, y):
    return max(x, y)

def update(i, x):
    i += MAX_N - 1
    node[i] = x
    while i:
        i = (i - 1) // 2
        node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])

def query(l, r):
    L = l + MAX_N
    R = r + MAX_N
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = segfunc(s, node[R - 1])
        if L & 1:
            s = segfunc(s, node[L - 1])
            L += 1
        L >>= 1
        R >>= 1
    return s

N, K = list(map(int, input().split()))
MAX_N = 2 ** (300005).bit_length()
a = [int(eval(input())) for _ in range(N)]
node = [0] * (2 * MAX_N)
INF = 0
ans = 0
# for i in range(N):
#    update(i, a[i])
for i in a:
    tmp = query(max(i - K, 0), min(300005, i + K) + 1)
    update(i, tmp + 1)
    ans = max(ans, tmp + 1)
print(ans)

-        n = 2 ** (size - 1).bit_length()

-            self.node[i + n - 1] = arr[i]

-        for i in reversed(list(range(n - 2))):

-            self.node[i] = segfunc(self.node[2 * i + 1], self.node[2 * i + 2])

+        node[i] = segfunc(node[i * 2 + 1], node[i * 2 + 2])

-            self.node[i] = segfunc(self.node[i * 2 + 1], self.node[i * 2 + 2])

-            self.node[x] = segfunc(self.node[2 * x + 1], self.node[2 * x + 2])

-                res = segfunc(res, self.node[l])

-                res = segfunc(res, self.node[l])

-                res = segfunc(res, self.node[r])

+            s = segfunc(s, node[R - 1])

+            s = segfunc(s, node[L - 1])

+a = [int(eval(input())) for _ in range(N)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N = int(eval(input()))

A = [int(x) for x in input().split()]

tmp = [x for x in zip(A, list(range(1, N+1)))]

tmp = np.array(sorted(tmp))

print((*tmp[:,1]))

# optimized version of the same code:

N = int(eval(input()))

A = [int(x) for x in input().split()]

B = [0 for _ in range(N)]

for i in range(N):

    B[A[i]-1] = i+1

print((*B))

import numpy as np

N = int(eval(input()))
A = [int(x) for x in input().split()]
tmp = [x for x in zip(A, list(range(1, N + 1)))]
tmp = np.array(sorted(tmp))
print((*tmp[:, 1]))

N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [0 for _ in range(N)]
for i in range(N):
    B[A[i] - 1] = i + 1
print((*B))

-tmp = [x for x in zip(A, list(range(1, N + 1)))]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N,M = list(map(int, input().split()))

L = []

R = []

for _ in range(M):

  l,r = list(map(int, input().split()))

  L.append(l)

  R.append(r)

ans = min(R)-max(L)+1

if ans < 0:

  print((0))

else:

  print(ans)

# optimized version of the same code:

n,m = list(map(int, input().split()))

max_l = float("-inf")

min_r = float("inf")

for _ in range(m):

  l,r = list(map(int, input().split()))

  max_l = max(max_l, l)

  min_r = min(min_r, r)

ans = min_r - max_l + 1

if ans > 0:

  print(ans)

else:

  print((0))

N, M = list(map(int, input().split()))
L = []
R = []
for _ in range(M):
    l, r = list(map(int, input().split()))
    L.append(l)
    R.append(r)
ans = min(R) - max(L) + 1
if ans < 0:
    print((0))
else:
    print(ans)

n, m = list(map(int, input().split()))
max_l = float("-inf")
min_r = float("inf")
for _ in range(m):
    l, r = list(map(int, input().split()))
    max_l = max(max_l, l)
    min_r = min(min_r, r)
ans = min_r - max_l + 1
if ans > 0:
    print(ans)
else:
    print((0))

-N, M = list(map(int, input().split()))
-L = []
-R = []
-for _ in range(M):
+n, m = list(map(int, input().split()))
+max_l = float("-inf")
+min_r = float("inf")
+for _ in range(m):
-    L.append(l)
-    R.append(r)
-ans = min(R) - max(L) + 1
-if ans < 0:
+    max_l = max(max_l, l)
+    min_r = min(min_r, r)
+ans = min_r - max_l + 1
+if ans > 0:
+    print(ans)
+else:
-else:
-    print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

h,w=input().split()

h,w=int(h),int(w)

x3=[]

for i in range(h):

    x1=input()

    if x1 !=  w*".":

        x3.append(list(x1))

x3=np.array(x3).T.tolist()

x4=[]

for i in range(w):

    if x3[i] != ["." for i in range(len(x3[i]))]:

        x4.append(x3[i])

x4=np.array(x4).T.tolist()

for i in range(len(x4)):

    for j in range(len(x4[0])):

        print(x4[i][j],end="")

    print()

# optimized version of the same code:

h,w=list(map(int,input().split()))

a=[]

for i in range(h):

    k=eval(input())

    if k!="."*w:

        a.append(k)

l=len(a)

#print(a)

ans=[[] for i in range(l)]

for i in range(w):

    for j in range(l):

        if a[j][i]=="#":

            for k in range(l):

                ans[k].append(a[k][i])

            break

for i in range(l):

    print(("".join(ans[i])))

import numpy as np

h, w = input().split()
h, w = int(h), int(w)
x3 = []
for i in range(h):
    x1 = input()
    if x1 != w * ".":
        x3.append(list(x1))
x3 = np.array(x3).T.tolist()
x4 = []
for i in range(w):
    if x3[i] != ["." for i in range(len(x3[i]))]:
        x4.append(x3[i])
x4 = np.array(x4).T.tolist()
for i in range(len(x4)):
    for j in range(len(x4[0])):
        print(x4[i][j], end="")
    print()

h, w = list(map(int, input().split()))
a = []
for i in range(h):
    k = eval(input())
    if k != "." * w:
        a.append(k)
l = len(a)
# print(a)
ans = [[] for i in range(l)]
for i in range(w):
    for j in range(l):
        if a[j][i] == "#":
            for k in range(l):
                ans[k].append(a[k][i])
            break
for i in range(l):
    print(("".join(ans[i])))

-    if x3[i] != ["." for i in range(len(x3[i]))]:


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from decimal import *

getcontext().prec = 14

N, D = list(map(int, input().split()))

def distance(x1, x2, y1, y2):

    dx = x2-x1

    dy = y2-y1

    return (dx*dx + dy*dy).sqrt()

X = [0] * N

Y = [0] * N

ans = 0

for i in range(N):

    X[i], Y[i] = list(map(Decimal, input().split()))

    if (distance(0, X[i], 0, Y[i]) <= D):

        ans += 1

print(ans)

# optimized version of the same code:

from decimal import *

getcontext().prec = 14  # あんまり大きいと計算遅いかも

N, D = list(map(int, input().split()))

def distance(x1, x2, y1, y2):

    dx = x2-x1

    dy = y2-y1

    return (dx*dx + dy*dy).sqrt()

ans = 0

for i in range(N):

    X, Y = list(map(Decimal, input().split()))

    if (distance(0, X, 0, Y) <= D):

        ans += 1

print(ans)

from decimal import *

getcontext().prec = 14
N, D = list(map(int, input().split()))

def distance(x1, x2, y1, y2):
    dx = x2 - x1
    dy = y2 - y1
    return (dx * dx + dy * dy).sqrt()

X = [0] * N
Y = [0] * N
ans = 0
for i in range(N):
    X[i], Y[i] = list(map(Decimal, input().split()))
    if distance(0, X[i], 0, Y[i]) <= D:
        ans += 1
print(ans)

from decimal import *

getcontext().prec = 14  # あんまり大きいと計算遅いかも
N, D = list(map(int, input().split()))

def distance(x1, x2, y1, y2):
    dx = x2 - x1
    dy = y2 - y1
    return (dx * dx + dy * dy).sqrt()

ans = 0
for i in range(N):
    X, Y = list(map(Decimal, input().split()))
    if distance(0, X, 0, Y) <= D:
        ans += 1
print(ans)

+getcontext().prec = 14  # あんまり大きいと計算遅いかも

-    X[i], Y[i] = list(map(Decimal, input().split()))

-    if distance(0, X[i], 0, Y[i]) <= D:

+    X, Y = list(map(Decimal, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N = int(eval(input()))

seq = list(map(int, input().split()))

cnt = 0

for num in seq:

    while num % 2 == 0:

        cnt += 1

        num /= 2

print(cnt)

# optimized version of the same code:

n = int(eval(input()))

a = list(map(int, input().split()))

ans = 0

for num in a:

    ans += format(num, 'b')[::-1].find('1')

print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for num in a:
    ans += format(num, "b")[::-1].find("1")
print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

def II(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def MI1(): return list(map(int1, input().split()))

def LI(): return list(map(int, input().split()))

def LI1(): return list(map(int1, input().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print((k.join(list(map(str, lst)))))

INF = float('inf')

def solve():

    a, b, c, x, y = MI()

    ans = INF

    for k in range(100001):

        yen = 2 * c * k + max(0, x-k) * a + max(0, y-k) * b

        ans = min(ans, yen)

    print(ans)

if __name__ == '__main__':

    solve()

# optimized version of the same code:

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

def II(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def MI1(): return list(map(int1, input().split()))

def LI(): return list(map(int, input().split()))

def LI1(): return list(map(int1, input().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print((k.join(list(map(str, lst)))))

INF = float('inf')

def solve():

    a, b, c, x, y = MI()

    ans = 0

    if a + b <= 2 * c:

        mn = min(x, y)

        ans = a * mn + b * mn + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)

    else:

        mn = min(x, y)

        ans = mn * 2 * c + max(0, x-mn) * min(a, 2*c) + max(0, y-mn) * min(b, 2*c)

    print(ans)

if __name__ == '__main__':

    solve()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1

def II():
    return int(eval(input()))

def MI():
    return list(map(int, input().split()))

def MI1():
    return list(map(int1, input().split()))

def LI():
    return list(map(int, input().split()))

def LI1():
    return list(map(int1, input().split()))

def LLI(rows_number):
    return [LI() for _ in range(rows_number)]

def printlist(lst, k="\n"):
    print((k.join(list(map(str, lst)))))

INF = float("inf")

def solve():
    a, b, c, x, y = MI()
    ans = INF
    for k in range(100001):
        yen = 2 * c * k + max(0, x - k) * a + max(0, y - k) * b
        ans = min(ans, yen)
    print(ans)

if __name__ == "__main__":
    solve()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1

def II():
    return int(eval(input()))

def MI():
    return list(map(int, input().split()))

def MI1():
    return list(map(int1, input().split()))

def LI():
    return list(map(int, input().split()))

def LI1():
    return list(map(int1, input().split()))

def LLI(rows_number):
    return [LI() for _ in range(rows_number)]

def printlist(lst, k="\n"):
    print((k.join(list(map(str, lst)))))

INF = float("inf")

def solve():
    a, b, c, x, y = MI()
    ans = 0
    if a + b <= 2 * c:
        mn = min(x, y)
        ans = (
            a * mn
            + b * mn
            + max(0, x - mn) * min(a, 2 * c)
            + max(0, y - mn) * min(b, 2 * c)
        )
    else:
        mn = min(x, y)
        ans = (
            mn * 2 * c + max(0, x - mn) * min(a, 2 * c) + max(0, y - mn) * min(b, 2 * c)
        )
    print(ans)

if __name__ == "__main__":
    solve()


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

n = int(eval(input()))

print((math.factorial(n)%(10**9+7)))

# optimized version of the same code:

n = int(eval(input()))

ans = 1

mod = 10**9+7

for i in range(1, n+1):

    ans *= i

    ans %= mod

ans %= mod

print(ans)

import math

n = int(eval(input()))
print((math.factorial(n) % (10**9 + 7)))

n = int(eval(input()))
ans = 1
mod = 10**9 + 7
for i in range(1, n + 1):
    ans *= i
    ans %= mod
ans %= mod
print(ans)

-print((math.factorial(n) % (10**9 + 7)))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

n,t=int(input()),list(map(int,input().split()));T=sum(t)

print(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\n')

# optimized version of the same code:

input();t=list(map(int,input().split()));T=sum(t)

print(*[T-t[i-1]+j for i,j in [list(map(int,input().split())) for _ in range(int(input()))]],sep='\n')

n, t = int(input()), list(map(int, input().split()))
T = sum(t)
print(
    *[
        T - t[i - 1] + j
        for i, j in [list(map(int, input().split())) for _ in range(int(input()))]
    ],
    sep="\n"
)

input()
t = list(map(int, input().split()))
T = sum(t)
print(
    *[
        T - t[i - 1] + j
        for i, j in [list(map(int, input().split())) for _ in range(int(input()))]
    ],
    sep="\n"
)

-n, t = int(input()), list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

n = int(eval(input()))

A = [int(i) for i in input().split()]

S = [0]*(n+1)

num={}

for i in range(n):

    S[i+1] = S[i] + A[i]

for i in S:

    if str(i) in list(num.keys()):

        num[str(i)] += 1

    else:

        num[str(i)] = 1

out = [i*(i-1)//2 for i in list(num.values()) if i>1]

print((sum(out)))

# optimized version of the same code:

n = int(eval(input()))

A = [int(i) for i in input().split()]

S = [0]*(n+1)

num = {}

for i in range(n):

    S[i+1] = S[i] + A[i]

for i in S:

    s = str(i)

    num[s] = 1 if s not in list(num.keys()) else num[s]+1

out = [i*(i-1)//2 for i in list(num.values()) if i > 1]

print((sum(out)))

n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (n + 1)
num = {}
for i in range(n):
    S[i + 1] = S[i] + A[i]
for i in S:
    if str(i) in list(num.keys()):
        num[str(i)] += 1
    else:
        num[str(i)] = 1
out = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]
print((sum(out)))

n = int(eval(input()))
A = [int(i) for i in input().split()]
S = [0] * (n + 1)
num = {}
for i in range(n):
    S[i + 1] = S[i] + A[i]
for i in S:
    s = str(i)
    num[s] = 1 if s not in list(num.keys()) else num[s] + 1
out = [i * (i - 1) // 2 for i in list(num.values()) if i > 1]
print((sum(out)))

+    num[s] = 1 if s not in list(num.keys()) else num[s] + 1


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def resolve():

  base = 10**9+7

  S = int(eval(input()))

  dp = [0] * (S+1)

  dp[0] = 1

  for i in range(1, S+1):

    for u in range(i-2):

      dp[i] += dp[u]

      dp[i] %= base

  # print(dp)

  print((dp[S]%base))

if __name__ == "__main__":

  resolve()

# optimized version of the same code:

def resolve():

  base = 10**9+7

  S = int(eval(input()))

  dp = [0] * (S+1)

  dp[0] = 1

  for i in range(3, S+1):

    dp[i] = dp[i-1] + dp[i-3]

  # print(dp)

  print((dp[S]%base))

if __name__ == "__main__":

  resolve()

def resolve():
    base = 10**9 + 7
    S = int(eval(input()))
    dp = [0] * (S + 1)
    dp[0] = 1
    for i in range(1, S + 1):
        for u in range(i - 2):
            dp[i] += dp[u]
            dp[i] %= base
    # print(dp)
    print((dp[S] % base))

if __name__ == "__main__":
    resolve()

def resolve():
    base = 10**9 + 7
    S = int(eval(input()))
    dp = [0] * (S + 1)
    dp[0] = 1
    for i in range(3, S + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
    # print(dp)
    print((dp[S] % base))

if __name__ == "__main__":
    resolve()

-    for i in range(1, S + 1):
-        for u in range(i - 2):
-            dp[i] += dp[u]
-            dp[i] %= base
+    for i in range(3, S + 1):
+        dp[i] = dp[i - 1] + dp[i - 3]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import os

import sys

import numpy as np

def solve(n, precalc_x, precalc_y):

    ans = np.full(n + 1, 10 ** 18, dtype=np.int64)

    def get_cost(v, bit):

        cost = 0

        pcx = precalc_x[v]

        pcy = precalc_y[v ^ bit]

        for i in range(n):

            if v & (1 << i):

                continue

            cost += min(pcx[i], pcy[i])

        return cost

    for bit in range(1 << n):

        k = (bit & 0x5555) + (bit >> 1 & 0x5555)

        k = (k & 0x3333) + (k >> 2 & 0x3333)

        k = (k & 0x0f0f) + (k >> 4 & 0x0f0f)

        k = (k & 0x00ff) + (k >> 8 & 0x00ff)

        v = bit

        while v:

            ans[k] = min(ans[k], get_cost(v, bit))

            v = (v - 1) & bit

        ans[k] = min(ans[k], get_cost(0, bit))

    return ans

if sys.argv[-1] == 'ONLINE_JUDGE':

    from numba.pycc import CC

    cc = CC('my_module')

    cc.export('solve', '(i8, i8[:,:], i8[:,:])')(solve)

    cc.compile()

    exit()

if os.name == 'posix':

    # noinspection PyUnresolvedReferences

    from my_module import solve

else:

    from numba import njit

    solve = njit('(i8, i8[:,:], i8[:,:])', cache=True)(solve)

    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')

n = inp[0]

xxx = inp[1::3]

yyy = inp[2::3]

ppp = inp[3::3]

bit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)

precalc_x = abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1) * ppp[None, :]

precalc_y = abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1) * ppp[None, :]

ans = solve(n, precalc_x, precalc_y)

print('\n'.join(map(str, ans)))

# optimized version of the same code:

import os

import sys

import numpy as np

def solve(n, precalc_x, precalc_y):

    ans = np.full(n + 1, 10 ** 18, dtype=np.int64)

    def get_cost(v, bit):

        cost = 0

        pcx = precalc_x[v]

        pcy = precalc_y[v ^ bit]

        for i in range(n):

            cost += min(pcx[i], pcy[i])

        return cost

    for bit in range(1 << n):

        k = (bit & 0x5555) + (bit >> 1 & 0x5555)

        k = (k & 0x3333) + (k >> 2 & 0x3333)

        k = (k & 0x0f0f) + (k >> 4 & 0x0f0f)

        k = (k & 0x00ff) + (k >> 8 & 0x00ff)

        v = bit

        while v:

            ans[k] = min(ans[k], get_cost(v, bit))

            v = (v - 1) & bit

        ans[k] = min(ans[k], get_cost(0, bit))

    return ans

if sys.argv[-1] == 'ONLINE_JUDGE':

    from numba.pycc import CC

    cc = CC('my_module')

    cc.export('solve', '(i8, i8[:,:], i8[:,:])')(solve)

    cc.compile()

    exit()

if os.name == 'posix':

    # noinspection PyUnresolvedReferences

    from my_module import solve

else:

    from numba import njit

    solve = njit('(i8, i8[:,:], i8[:,:])', cache=True)(solve)

    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')

n = inp[0]

xxx = inp[1::3]

yyy = inp[2::3]

ppp = inp[3::3]

bit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)

precalc_x = abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1) * ppp[None, :]

precalc_y = abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1) * ppp[None, :]

ans = solve(n, precalc_x, precalc_y)

print('\n'.join(map(str, ans)))

import os
import sys
import numpy as np

def solve(n, precalc_x, precalc_y):
    ans = np.full(n + 1, 10**18, dtype=np.int64)

    def get_cost(v, bit):
        cost = 0
        pcx = precalc_x[v]
        pcy = precalc_y[v ^ bit]
        for i in range(n):
            if v & (1 << i):
                continue
            cost += min(pcx[i], pcy[i])
        return cost

    for bit in range(1 << n):
        k = (bit & 0x5555) + (bit >> 1 & 0x5555)
        k = (k & 0x3333) + (k >> 2 & 0x3333)
        k = (k & 0x0F0F) + (k >> 4 & 0x0F0F)
        k = (k & 0x00FF) + (k >> 8 & 0x00FF)
        v = bit
        while v:
            ans[k] = min(ans[k], get_cost(v, bit))
            v = (v - 1) & bit
        ans[k] = min(ans[k], get_cost(0, bit))
    return ans

if sys.argv[-1] == "ONLINE_JUDGE":
    from numba.pycc import CC

    cc = CC("my_module")
    cc.export("solve", "(i8, i8[:,:], i8[:,:])")(solve)
    cc.compile()
    exit()
if os.name == "posix":
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit("(i8, i8[:,:], i8[:,:])", cache=True)(solve)
    print("compiled", file=sys.stderr)
inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=" ")
n = inp[0]
xxx = inp[1::3]
yyy = inp[2::3]
ppp = inp[3::3]
bit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)
precalc_x = (
    abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1)
    * ppp[None, :]
)
precalc_y = (
    abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1)
    * ppp[None, :]
)
ans = solve(n, precalc_x, precalc_y)
print("\n".join(map(str, ans)))

import os
import sys
import numpy as np

def solve(n, precalc_x, precalc_y):
    ans = np.full(n + 1, 10**18, dtype=np.int64)

    def get_cost(v, bit):
        cost = 0
        pcx = precalc_x[v]
        pcy = precalc_y[v ^ bit]
        for i in range(n):
            cost += min(pcx[i], pcy[i])
        return cost

    for bit in range(1 << n):
        k = (bit & 0x5555) + (bit >> 1 & 0x5555)
        k = (k & 0x3333) + (k >> 2 & 0x3333)
        k = (k & 0x0F0F) + (k >> 4 & 0x0F0F)
        k = (k & 0x00FF) + (k >> 8 & 0x00FF)
        v = bit
        while v:
            ans[k] = min(ans[k], get_cost(v, bit))
            v = (v - 1) & bit
        ans[k] = min(ans[k], get_cost(0, bit))
    return ans

if sys.argv[-1] == "ONLINE_JUDGE":
    from numba.pycc import CC

    cc = CC("my_module")
    cc.export("solve", "(i8, i8[:,:], i8[:,:])")(solve)
    cc.compile()
    exit()
if os.name == "posix":
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit("(i8, i8[:,:], i8[:,:])", cache=True)(solve)
    print("compiled", file=sys.stderr)
inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=" ")
n = inp[0]
xxx = inp[1::3]
yyy = inp[2::3]
ppp = inp[3::3]
bit_d = (((np.arange(1 << n)[:, None] & (1 << np.arange(n)))) > 0).astype(np.int64)
precalc_x = (
    abs((xxx[None, :] * bit_d)[..., None] - xxx[None, None, :]).min(axis=1)
    * ppp[None, :]
)
precalc_y = (
    abs((yyy[None, :] * bit_d)[..., None] - yyy[None, None, :]).min(axis=1)
    * ppp[None, :]
)
ans = solve(n, precalc_x, precalc_y)
print("\n".join(map(str, ans)))

-            if v & (1 << i):
-                continue


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N = int(eval(input()))

A = list(map(int, input().split()))

A = np.array(A)

count = 0

while 1:

    x = 0

    for i in range(N):

        if A[i] % 2 == 1:

            x = 1

    if x == 1:

        break

    else:

        A = A / 2

        count+=1

print(count)

# optimized version of the same code:

import math

n = eval(input())

a = list(map(int, input().split()))

ans = float('inf')

for i in a:

    ans = min(ans, len(bin(i)) - bin(i).rfind('1') - 1)

print((round(ans)))

import numpy as np

N = int(eval(input()))
A = list(map(int, input().split()))
A = np.array(A)
count = 0
while 1:
    x = 0
    for i in range(N):
        if A[i] % 2 == 1:
            x = 1
    if x == 1:
        break
    else:
        A = A / 2
        count += 1
print(count)

import math

n = eval(input())
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print((round(ans)))

+    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N = int(eval(input()))

table = [[0]*10 for i in range(10)]

for i in range(1, N+1):

  s = str(i)

  id1 = int(s[0])

  id2 = int(s[-1])

  table[id1][id2] += 1

ans = 0

for i in range(10):

  for j in range(10):

    ans += table[i][j]*table[j][i]

print(ans)

# optimized version of the same code:

N = int(eval(input()))
table = [[0] * 10 for i in range(10)]
for i in range(1, N + 1):
    s = str(i)
    id1 = int(s[0])
    id2 = int(s[-1])
    table[id1][id2] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += table[i][j] * table[j][i]
print(ans)

-        ans += table[i][j] * table[j][i]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

n = int(eval(input()))

res = 1

for num in range(1, n+1):

  res = res * num

  res = res % (pow(10,9) + 7)

print(res)

# optimized version of the same code:

n = int(eval(input()))

res = 1

for num in range(1, n+1):

    res = res * num

    res = res % (10**9 + 7)

print(res)

n = int(eval(input()))
res = 1
for num in range(1, n + 1):
    res = res * num
    res = res % (pow(10, 9) + 7)
print(res)

n = int(eval(input()))
res = 1
for num in range(1, n + 1):
    res = res * num
    res = res % (10**9 + 7)
print(res)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

#!/usr/bin/env python3

import sys, math, fractions, itertools

def solve(A: int, B: int, C: int, X: int, Y: int):

    mn = 1e9

    for i in range(0, 2*(max(X, Y)+1), 2):

        mn = min(mn, C*i+A*max(X-i//2, 0)+B*max(Y-i//2, 0))

    print((int(mn)))

    return

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    A = int(next(tokens))  # type: int

    B = int(next(tokens))  # type: int

    C = int(next(tokens))  # type: int

    X = int(next(tokens))  # type: int

    Y = int(next(tokens))  # type: int

    solve(A, B, C, X, Y)

if __name__ == '__main__':

    main()

# optimized version of the same code:

#!/usr/bin/env python3

import sys

def solve(A: int, B: int, C: int, X: int, Y: int):

    c = 0

    if (A + B < 2 * C):

        c += min(X, Y) * (A + B)

    else:

        c += min(X, Y) * 2 * C

    if X > Y:

        c += (X - Y) * min(A, 2 * C)

    else:

        c += (Y - X) * min(B, 2 * C)

    print(c)

    return

# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    A = int(next(tokens))  # type: int

    B = int(next(tokens))  # type: int

    C = int(next(tokens))  # type: int

    X = int(next(tokens))  # type: int

    Y = int(next(tokens))  # type: int

    solve(A, B, C, X, Y)

if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys, math, fractions, itertools

def solve(A: int, B: int, C: int, X: int, Y: int):
    mn = 1e9
    for i in range(0, 2 * (max(X, Y) + 1), 2):
        mn = min(mn, C * i + A * max(X - i // 2, 0) + B * max(Y - i // 2, 0))
    print((int(mn)))
    return

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(A, B, C, X, Y)

if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys

def solve(A: int, B: int, C: int, X: int, Y: int):
    c = 0
    if A + B < 2 * C:
        c += min(X, Y) * (A + B)
    else:
        c += min(X, Y) * 2 * C
    if X > Y:
        c += (X - Y) * min(A, 2 * C)
    else:
        c += (Y - X) * min(B, 2 * C)
    print(c)
    return

# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(A, B, C, X, Y)

if __name__ == "__main__":
    main()

-# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

+# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

from operator import itemgetter

n, m = list(map(int, input().split()))

a = list(map(int, sys.stdin.readline().split()))

bc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]

bc.sort(key = itemgetter(1), reverse=True)

bc.append((n,0))

diff = []

for b, c in bc:

    diff += [c] * b

    if len(diff) > n:

        break

a += diff

a.sort()

print((sum(a[-n:])))

# optimized version of the same code:

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

from operator import itemgetter

n, m = list(map(int, readline().split()))

a = list(map(int, readline().split()))

m = list(map(int, read().split()))

bc = list(zip(m,m))

bc.sort(key = itemgetter(1), reverse=True)

bc.append((n,0))

diff = []

for b, c in bc:

    diff += [c] * b

    if len(diff) > n:

        break

a += diff

a.sort()

print((sum(a[-n:])))

import sys
from operator import itemgetter

n, m = list(map(int, input().split()))
a = list(map(int, sys.stdin.readline().split()))
bc = [tuple(map(int, x.split())) for x in sys.stdin.readlines()]
bc.sort(key=itemgetter(1), reverse=True)
bc.append((n, 0))
diff = []
for b, c in bc:
    diff += [c] * b
    if len(diff) > n:
        break
a += diff
a.sort()
print((sum(a[-n:])))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
from operator import itemgetter

n, m = list(map(int, readline().split()))
a = list(map(int, readline().split()))
m = list(map(int, read().split()))
bc = list(zip(m, m))
bc.sort(key=itemgetter(1), reverse=True)
bc.append((n, 0))
diff = []
for b, c in bc:
    diff += [c] * b
    if len(diff) > n:
        break
a += diff
a.sort()
print((sum(a[-n:])))

-a = list(map(int, sys.stdin.readline().split()))

-bc = [tuple(map(int, x.split())) for x in sys.stdin.readlines()]

+n, m = list(map(int, readline().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N = int(eval(input()))

B =list(map(int,input().split()))

A=[0]*N

A[0]=B[0]

for i in range(1,N-1):

    A[i]=min(B[i],B[i-1])

A[-1]=B[-1]

print((sum(A)))

# optimized version of the same code:

import sys

input = sys.stdin.readline

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

def main():

    mod=10**9+7

    N=I()

    B=LI()

    A=[0]*N

    A[0]=B[0]

    A[-1]=B[-1]

    for i in range(N-2):

        A[i+1]=min(B[i],B[i+1])

    print((sum(A)))

main()

N = int(eval(input()))
B = list(map(int, input().split()))
A = [0] * N
A[0] = B[0]
for i in range(1, N - 1):
    A[i] = min(B[i], B[i - 1])
A[-1] = B[-1]
print((sum(A)))

import sys

input = sys.stdin.readline

def I():
    return int(eval(input()))

def MI():
    return list(map(int, input().split()))

def LI():
    return list(map(int, input().split()))

def main():
    mod = 10**9 + 7
    N = I()
    B = LI()
    A = [0] * N
    A[0] = B[0]
    A[-1] = B[-1]
    for i in range(N - 2):
        A[i + 1] = min(B[i], B[i + 1])
    print((sum(A)))

main()

+    return list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

input = sys.stdin.readline

from collections import *

A, B, C, D = list(map(int, input().split()))

while True:

    C -= B

    if C<=0:

        print('Yes')

        exit()

    A -= D

    if A<=0:

        print('No')

        exit()

# optimized version of the same code:

A, B, C, D = list(map(int, input().split()))

c1 = (C+B-1)//B

c2 = (A+D-1)//D

if c1<=c2:

    print('Yes')

else:

    print('No')

import sys

input = sys.stdin.readline
from collections import *

A, B, C, D = list(map(int, input().split()))
while True:
    C -= B
    if C <= 0:
        print("Yes")
        exit()
    A -= D
    if A <= 0:
        print("No")
        exit()

A, B, C, D = list(map(int, input().split()))
c1 = (C + B - 1) // B
c2 = (A + D - 1) // D
if c1 <= c2:
    print("Yes")
else:
    print("No")

-import sys
-input = sys.stdin.readline
-from collections import *
-while True:
-    C -= B
-    if C <= 0:
-        print("Yes")
-        exit()
-    A -= D
-    if A <= 0:
-        print("No")
-        exit()
+c1 = (C + B - 1) // B
+c2 = (A + D - 1) // D
+if c1 <= c2:
+    print("Yes")
+else:
+    print("No")


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

icase=0

if icase==0:

    n,m=list(map(int, input().split()))

    a=[]

    b=[]

    for i in range(m):

        ai,bi=list(map(int, input().split()))

        a.append(ai)

        b.append(bi)

elif icase==1:

    n=6

    m=5

#    a=[[1],[2],[3],[4],[5]]

#    b=[[2],[3],[4],[5],[6]]

    a=[1,2,3,4,5]

    b=[2,3,4,5,6]

elif icase==2:

    n=7

    m=7

    a=[1,2,3,4,4,5,6]

    b=[3,7,4,5,6,6,7]

vtx=[]

for i in range(n):

    vtx.append([i+1])

icnt=0

for j in range(m):

    vtx1=vtx.copy()

    a1=a.copy()

    b1=b.copy()

    del a1[j]

    del b1[j]

    for i in range(m-1):

        for v1 in vtx1:

            if a1[i] in v1:

                if not b1[i] in v1:

                    for v2 in vtx1:

                        if v1!=v2:

                            if b1[i] in v2:

                                break

                    vtx1.remove(v1)

                    vtx1.remove(v2)

                    v3=v1+v2

                    vtx1.append(v3)

#        print(a[i],b[i],len(vtx1),vtx1)

#    print(len(vtx1),vtx1)

    if len(vtx1)!=1:

        icnt=icnt+1

print(icnt)

# optimized version of the same code:

limit=50

graph=[[False]*limit for i in range(limit)]

visited=[]*limit

def dfs(v,n,graph,visited):

    visited[v]=True

    for v2 in range(n):

        if graph[v][v2]==False:

            continue

        if visited[v2]==True:

            continue

        dfs(v2,n,graph,visited)

n,m=list(map(int,input().split()))

a=[0]*m

b=[0]*m

for i in range(m):

    ai,bi=list(map(int,input().split()))

    a[i]=ai-1

    b[i]=bi-1

    graph[a[i]][b[i]]=True

    graph[b[i]][a[i]]=True

ans=0

for i in range(m):

    graph[a[i]][b[i]]=False

    graph[b[i]][a[i]]=False

    visited=[False]*n

    dfs(0,n,graph,visited)

    bridge=False

    for j in range(n):

        if visited[j]==False:

            bridge=True

    if bridge:

        ans+=1

    graph[a[i]][b[i]]=True

    graph[b[i]][a[i]]=True

print(ans)

icase = 0
if icase == 0:
    n, m = list(map(int, input().split()))
    a = []
    b = []
    for i in range(m):
        ai, bi = list(map(int, input().split()))
        a.append(ai)
        b.append(bi)
elif icase == 1:
    n = 6
    m = 5
    #    a=[[1],[2],[3],[4],[5]]
    #    b=[[2],[3],[4],[5],[6]]
    a = [1, 2, 3, 4, 5]
    b = [2, 3, 4, 5, 6]
elif icase == 2:
    n = 7
    m = 7
    a = [1, 2, 3, 4, 4, 5, 6]
    b = [3, 7, 4, 5, 6, 6, 7]
vtx = []
for i in range(n):
    vtx.append([i + 1])
icnt = 0
for j in range(m):
    vtx1 = vtx.copy()
    a1 = a.copy()
    b1 = b.copy()
    del a1[j]
    del b1[j]
    for i in range(m - 1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1 != v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3 = v1 + v2
                    vtx1.append(v3)
    #        print(a[i],b[i],len(vtx1),vtx1)
    #    print(len(vtx1),vtx1)
    if len(vtx1) != 1:
        icnt = icnt + 1
print(icnt)

limit = 50
graph = [[False] * limit for i in range(limit)]
visited = [] * limit

def dfs(v, n, graph, visited):
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:
            continue
        if visited[v2] == True:
            continue
        dfs(v2, n, graph, visited)

n, m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    ai, bi = list(map(int, input().split()))
    a[i] = ai - 1
    b[i] = bi - 1
    graph[a[i]][b[i]] = True
    graph[b[i]][a[i]] = True
ans = 0
for i in range(m):
    graph[a[i]][b[i]] = False
    graph[b[i]][a[i]] = False
    visited = [False] * n
    dfs(0, n, graph, visited)
    bridge = False
    for j in range(n):
        if visited[j] == False:
            bridge = True
    if bridge:
        ans += 1
    graph[a[i]][b[i]] = True
    graph[b[i]][a[i]] = True
print(ans)

-    n, m = list(map(int, input().split()))

-        ai, bi = list(map(int, input().split()))

-                            if b1[i] in v2:

-    #        print(a[i],b[i],len(vtx1),vtx1)

+graph = [[False] * limit for i in range(limit)]

+    ai, bi = list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

#!/usr/bin/env python3

import sys

from fractions import gcd

import math

def main():

    N, M = list(map(int, input().split()))

    a = list(map(int, input().split()))

    tmp = 1

    count = None

    for i in range(N):

      tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)

      c = 0

      n = a[i]//2

      while n % 2 == 0:

        c += 1

        n //= 2

      if i == 0:

        count = c

      elif count != c:

        print((0))

        exit()

    print(((M//tmp +1)//2))

if __name__ == '__main__':

    main()

# optimized version of the same code:

from math import gcd

N, M = list(map(int, input().split()))

A = list(map(int, input().split()))

B = [a//2 for a in A]

LCM = 1

for i in range(N):

    LCM = LCM * B[i] // gcd(LCM, B[i])

for i in range(N):

    if LCM // B[i] % 2 == 0:

        print((0))

        exit()

print(((M//LCM + 1)//2))

#!/usr/bin/env python3
import sys
from fractions import gcd
import math

def main():
    N, M = list(map(int, input().split()))
    a = list(map(int, input().split()))
    tmp = 1
    count = None
    for i in range(N):
        tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)
        c = 0
        n = a[i] // 2
        while n % 2 == 0:
            c += 1
            n //= 2
        if i == 0:
            count = c
        elif count != c:
            print((0))
            exit()
    print(((M // tmp + 1) // 2))

if __name__ == "__main__":
    main()

from math import gcd

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [a // 2 for a in A]
LCM = 1
for i in range(N):
    LCM = LCM * B[i] // gcd(LCM, B[i])
for i in range(N):
    if LCM // B[i] % 2 == 0:
        print((0))
        exit()
print(((M // LCM + 1) // 2))

-    N, M = list(map(int, input().split()))

-    a = list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N = int(eval(input()))

V = np.array([int(i) for i in input().split(" ")])

C = np.array([int(i) for i in input().split(" ")])

vc = V-C

val = 0

for i in range(N):

    if vc[i]>0:

        val+=vc[i]

print(val)

# optimized version of the same code:

N = int(eval(input()))

V = [int(i) for i in input().split(" ")]

C = [int(i) for i in input().split(" ")]

val = 0

for i in range(N):

    vc=V[i]-C[i]

    if vc>0:

        val+=vc

print(val)

import numpy as np

N = int(eval(input()))
V = np.array([int(i) for i in input().split(" ")])
C = np.array([int(i) for i in input().split(" ")])
vc = V - C
val = 0
for i in range(N):
    if vc[i] > 0:
        val += vc[i]
print(val)

N = int(eval(input()))
V = [int(i) for i in input().split(" ")]
C = [int(i) for i in input().split(" ")]
val = 0
for i in range(N):
    vc = V[i] - C[i]
    if vc > 0:
        val += vc
print(val)

-V = np.array([int(i) for i in input().split(" ")])

-C = np.array([int(i) for i in input().split(" ")])

+V = [int(i) for i in input().split(" ")]

+C = [int(i) for i in input().split(" ")]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

a=input().split()

b=list(map(int,a))

W=b[0]

H=b[1]

x=b[2]

y=b[3]

r=b[4]

if (r <= x <= (W - r)) and (r <= y <= (H - r)):

  print('Yes')

else:

  print('No')

# optimized version of the same code:

W,H,x,y,r = [int(i) for i in input().split()]

if (r <= x <= (W - r)) and (r <= y <= (H - r)):

  print('Yes')

else:

  print('No')

a = input().split()
b = list(map(int, a))
W = b[0]
H = b[1]
x = b[2]
y = b[3]
r = b[4]
if (r <= x <= (W - r)) and (r <= y <= (H - r)):
    print("Yes")
else:
    print("No")

W, H, x, y, r = [int(i) for i in input().split()]
if (r <= x <= (W - r)) and (r <= y <= (H - r)):
    print("Yes")
else:
    print("No")

+W, H, x, y, r = [int(i) for i in input().split()]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

ia = [int(i) for i in input().split(" ")]

W=ia[0]

H=ia[1]

x=ia[2]

y=ia[3]

r=ia[4]

print(("Yes" if 0<=x-r and x+r<=W and 0<=y-r and y+r<=H else "No"))

# optimized version of the same code:

# encoding:utf-8

input = list(map(int, input().split()))

W, H, x, y, r = input

if x - r < 0 or x + r > W:

	print("No")

elif y - r < 0 or y + r > H:

	print("No")

else:

	print("Yes")

ia = [int(i) for i in input().split(" ")]
W = ia[0]
H = ia[1]
x = ia[2]
y = ia[3]
r = ia[4]
print(("Yes" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else "No"))

-ia = [int(i) for i in input().split(" ")]

-print(("Yes" if 0 <= x - r and x + r <= W and 0 <= y - r and y + r <= H else "No"))

+input = list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N=eval(input())

a=[]

t=True

for _ in range(int(N)):

    a+=[list(map(int,input().split()))]

for i in range(int(N)):

    if a[i][0]%2==0:

        if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:

            continue

        else:

            print('No')

            t=False

            break

    else:

        if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:

            continue

        else:

            print('No')

            t=False

            break

if t:

    print('Yes')

# optimized version of the same code:

import sys

n=int(eval(input()))

t=[]

for i in range(n):

    t.append(list(map(int,input().split())))

for i,d in enumerate(t):

    if i>0:

        b=d[0]-a

        c=abs(d[1]+d[2]-aa)

    a=d[0]

    aa=d[1]+d[2]

    if i==0:

        if not (a >= aa and a % 2 == aa % 2):

            print('No')

            sys.exit()

        else:

            continue

    if not (b>=c and b%2==c%2):

        print('No')

        sys.exit()

print('Yes')

N = eval(input())
a = []
t = True
for _ in range(int(N)):
    a += [list(map(int, input().split()))]
for i in range(int(N)):
    if a[i][0] % 2 == 0:
        if abs(a[i][1] + a[i][2]) <= a[i][0] and (a[i][1] + a[i][2]) % 2 == 0:
            continue
        else:
            print("No")
            t = False
            break
    else:
        if abs(a[i][1] + a[i][2] <= a[i][0]) and (a[i][1] + a[i][2]) % 2 == 1:
            continue
        else:
            print("No")
            t = False
            break
if t:
    print("Yes")

import sys

n = int(eval(input()))
t = []
for i in range(n):
    t.append(list(map(int, input().split())))
for i, d in enumerate(t):
    if i > 0:
        b = d[0] - a
        c = abs(d[1] + d[2] - aa)
    a = d[0]
    aa = d[1] + d[2]
    if i == 0:
        if not (a >= aa and a % 2 == aa % 2):
            print("No")
            sys.exit()
        else:
            continue
    if not (b >= c and b % 2 == c % 2):
        print("No")
        sys.exit()
print("Yes")

-    a += [list(map(int, input().split()))]

+    t.append(list(map(int, input().split())))

+        if not (a >= aa and a % 2 == aa % 2):

+    if not (b >= c and b % 2 == c % 2):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

w = eval(input())

anal = np.array([])

for i in range(ord('a'),ord('z')+1):

    anal = np.append(anal,w.count(chr(i)))

if np.all(anal % 2 == 0):

    #ans = np.sum(anal)

    print("Yes")

else:

    print("No")

# optimized version of the same code:

w = str(eval(input()))

count = int()

for i in range(len(w)):

    if w.count(w[i]) % 2 == 0:

        count += 1

if count == len(w):

    print('Yes')

else:

    print('No')

import numpy as np

w = eval(input())
anal = np.array([])
for i in range(ord("a"), ord("z") + 1):
    anal = np.append(anal, w.count(chr(i)))
if np.all(anal % 2 == 0):
    # ans = np.sum(anal)
    print("Yes")
else:
    print("No")

w = str(eval(input()))
count = int()
for i in range(len(w)):
    if w.count(w[i]) % 2 == 0:
        count += 1
if count == len(w):
    print("Yes")
else:
    print("No")

-for i in range(ord("a"), ord("z") + 1):

-    anal = np.append(anal, w.count(chr(i)))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

# -*- coding: utf-8 -*-

from queue import Queue

h,w = list(map(int, input().split()))

d = []

for _ in range(h):

    d.append(eval(input()))

cost = [[0]*w for _ in range(h)]

q = Queue()

q.put((0,0))

while not q.empty():

    hi,wi = q.get()

    if hi==h-1 and wi==w-1:

        break

    for dh,dw in [[0,1],[1,0],[0,-1],[-1,0]]:

        if h>dh+hi>=0 and w>dw+wi>=0 and d[dh+hi][dw+wi]==".":

            if cost[dh+hi][dw+wi]==0 or cost[dh+hi][dw+wi]>cost[hi][wi]+1:

                cost[dh+hi][dw+wi] = cost[hi][wi]+1

                q.put((dh+hi, dw+wi))

if cost[h-1][w-1]==0:

    print((-1))

    exit()

res = 0

for hi in range(h):

    for wi in range(w):

        if (hi==0 and wi==0) or (hi==h-1 and wi==-1):

            continue

        if d[hi][wi]==".":

            res += 1

print((res - cost[h-1][w-1]))

# optimized version of the same code:

# -*- coding: utf-8 -*-

from collections import deque

h,w = list(map(int, input().split()))

m = ["#"*(w+2)] + ["#"+eval(input())+"#" for _ in range(h)] + ["#"*(w+2)]

cnt = 0

for hi in range(1,h+1):

    for wi in range(1,w+1):

        if m[hi][wi]==".":

            cnt += 1

inf = 10**9

d = [[inf]*(w+2) for _ in range(h+2)]

q = deque([(1,1,1)])

d[1][1] = 1

while len(q):

    ch,cw,r = q.popleft()

    for hi,wi in [[ch+1,cw],[ch,cw+1],[ch-1,cw],[ch,cw-1]]:

        if m[hi][wi]=="." and d[hi][wi]>r+1:

            d[hi][wi]=r+1

            q.append((hi,wi,r+1))

if d[h][w]==inf:

    print((-1))

else:

    print((cnt-d[h][w]))

# -*- coding: utf-8 -*-
from queue import Queue

h, w = list(map(int, input().split()))
d = []
for _ in range(h):
    d.append(eval(input()))
cost = [[0] * w for _ in range(h)]
q = Queue()
q.put((0, 0))
while not q.empty():
    hi, wi = q.get()
    if hi == h - 1 and wi == w - 1:
        break
    for dh, dw in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
        if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == ".":
            if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:
                cost[dh + hi][dw + wi] = cost[hi][wi] + 1
                q.put((dh + hi, dw + wi))
if cost[h - 1][w - 1] == 0:
    print((-1))
    exit()
res = 0
for hi in range(h):
    for wi in range(w):
        if (hi == 0 and wi == 0) or (hi == h - 1 and wi == -1):
            continue
        if d[hi][wi] == ".":
            res += 1
print((res - cost[h - 1][w - 1]))

# -*- coding: utf-8 -*-
from collections import deque

h, w = list(map(int, input().split()))
m = ["#" * (w + 2)] + ["#" + eval(input()) + "#" for _ in range(h)] + ["#" * (w + 2)]
cnt = 0
for hi in range(1, h + 1):
    for wi in range(1, w + 1):
        if m[hi][wi] == ".":
            cnt += 1
inf = 10**9
d = [[inf] * (w + 2) for _ in range(h + 2)]
q = deque([(1, 1, 1)])
d[1][1] = 1
while len(q):
    ch, cw, r = q.popleft()
    for hi, wi in [[ch + 1, cw], [ch, cw + 1], [ch - 1, cw], [ch, cw - 1]]:
        if m[hi][wi] == "." and d[hi][wi] > r + 1:
            d[hi][wi] = r + 1
            q.append((hi, wi, r + 1))
if d[h][w] == inf:
    print((-1))
else:
    print((cnt - d[h][w]))

-        if h > dh + hi >= 0 and w > dw + wi >= 0 and d[dh + hi][dw + wi] == ".":

-            if cost[dh + hi][dw + wi] == 0 or cost[dh + hi][dw + wi] > cost[hi][wi] + 1:

-                cost[dh + hi][dw + wi] = cost[hi][wi] + 1

-                q.put((dh + hi, dw + wi))

+d = [[inf] * (w + 2) for _ in range(h + 2)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

a,b,c,x,y=list(map(int,input().split()))

yenmin=a*x+b*y

for zz in range(2*10**5+1):

    xx=max(x-zz//2,0)

    yy=max(y-zz//2,0)

    yen=a*xx+b*yy+c*zz

    if yen<yenmin:

        yenmin=yen

print(yenmin)

#print(xx,yy,zz)

# optimized version of the same code:

a,b,c,x,y=list(map(int,input().split()))

cmax=max(x,y)*2

zmin=(a+b)*10**5

for nc in range(0,cmax+1,2):

    na=max(x-nc//2,0)

    nb=max(y-nc//2,0)

    z=a*na+b*nb+c*nc

    zmin=min(zmin,z)

print(zmin)

a, b, c, x, y = list(map(int, input().split()))
yenmin = a * x + b * y
for zz in range(2 * 10**5 + 1):
    xx = max(x - zz // 2, 0)
    yy = max(y - zz // 2, 0)
    yen = a * xx + b * yy + c * zz
    if yen < yenmin:
        yenmin = yen
print(yenmin)
# print(xx,yy,zz)

a, b, c, x, y = list(map(int, input().split()))
cmax = max(x, y) * 2
zmin = (a + b) * 10**5
for nc in range(0, cmax + 1, 2):
    na = max(x - nc // 2, 0)
    nb = max(y - nc // 2, 0)
    z = a * na + b * nb + c * nc
    zmin = min(zmin, z)
print(zmin)

-yenmin = a * x + b * y
-for zz in range(2 * 10**5 + 1):
-    xx = max(x - zz // 2, 0)
-    yy = max(y - zz // 2, 0)
-    yen = a * xx + b * yy + c * zz
-    if yen < yenmin:
-        yenmin = yen
-print(yenmin)
-# print(xx,yy,zz)
+cmax = max(x, y) * 2
+zmin = (a + b) * 10**5
+for nc in range(0, cmax + 1, 2):
+    na = max(x - nc // 2, 0)
+    nb = max(y - nc // 2, 0)
+    z = a * na + b * nb + c * nc
+    zmin = min(zmin, z)
+print(zmin)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

import numpy as np

n = int(eval(input()))

input = sys.stdin.readline

a = np.array(list(map(int, input().split())))

for i in a:

    if i % 2 == 0:

        if i % 3 != 0 and i % 5 != 0:

            print('DENIED')

            exit()

print('APPROVED')

# optimized version of the same code:

#import sys

#import numpy as np

n = int(eval(input()))

#input = sys.stdin.readline

#a = np.array(list(map(int, input().split())))

a = list(map(int, input().split()))

for i in a:

    if i % 2 == 0:

        if i % 3 != 0 and i % 5 != 0:

            print('DENIED')

            exit()

print('APPROVED')

import sys
import numpy as np

n = int(eval(input()))
input = sys.stdin.readline
a = np.array(list(map(int, input().split())))
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

# import sys
# import numpy as np
n = int(eval(input()))
# input = sys.stdin.readline
# a = np.array(list(map(int, input().split())))
a = list(map(int, input().split()))
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

-a = np.array(list(map(int, input().split())))

+# a = np.array(list(map(int, input().split())))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import queue

INF = 123456789

def main():

    n,m = list(map(int,input().split()))

    G = [[] for _ in range(n)]

    for _ in range(m):

        a,b,c = list(map(int,input().split()))

        a -= 1

        b -= 1

        G[a].append((b,c))

        G[b].append((a,c))

    used = set()

    for i in range(n):

        d = [INF for _ in range(n)]

        par = [-1 for _ in range(n)]

        # dijkstra

        que = queue.PriorityQueue()

        d[i] = 0

        que.put((0,i))

        while not que.empty():

            p = que.get()

            v = p[1]

            if d[v] < p[0]:

                continue

            for (to,cost) in G[v]:

                if d[to] > d[v]+cost:

                    d[to] = d[v]+cost

                    par[to] = v

                    que.put((d[to],to))

        for j in range(n):

            if i != j:

                a,b = j,par[j]

                if a>b:

                    a,b = b,a

                used.add((a,b))

    print((m - len(used)))

if __name__ == '__main__':

    main()

# optimized version of the same code:

INF = 123456789

def main():

    n,m = list(map(int,input().split()))

    d = [ [INF for i in range(n)] for j in range(n) ]

    for i in range(n):

        d[i][i] = 0

    a = [0 for _ in range(m)]

    b = [0 for _ in range(m)]

    c = [0 for _ in range(m)]

    for i in range(m):

        a[i],b[i],c[i] = list(map(int,input().split()))

        a[i] -= 1

        b[i] -= 1

        d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])

        d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])

    # Warshall-Floyd

    for k in range(n):

        for i in range(n):

            for j in range(n):

                d[i][j] = min(d[i][j], d[i][k]+d[k][j])

    ans = 0

    for i in range(m):

        found = 1

        for j in range(n):

            if d[j][a[i]] + c[i] == d[j][b[i]]:

                found = 0

                break

        ans += found

    print(ans)

if __name__ == '__main__':

    main()

import queue

INF = 123456789

def main():
    n, m = list(map(int, input().split()))
    G = [[] for _ in range(n)]
    for _ in range(m):
        a, b, c = list(map(int, input().split()))
        a -= 1
        b -= 1
        G[a].append((b, c))
        G[b].append((a, c))
    used = set()
    for i in range(n):
        d = [INF for _ in range(n)]
        par = [-1 for _ in range(n)]
        # dijkstra
        que = queue.PriorityQueue()
        d[i] = 0
        que.put((0, i))
        while not que.empty():
            p = que.get()
            v = p[1]
            if d[v] < p[0]:
                continue
            for (to, cost) in G[v]:
                if d[to] > d[v] + cost:
                    d[to] = d[v] + cost
                    par[to] = v
                    que.put((d[to], to))
        for j in range(n):
            if i != j:
                a, b = j, par[j]
                if a > b:
                    a, b = b, a
                used.add((a, b))
    print((m - len(used)))

if __name__ == "__main__":
    main()

INF = 123456789

def main():
    n, m = list(map(int, input().split()))
    d = [[INF for i in range(n)] for j in range(n)]
    for i in range(n):
        d[i][i] = 0
    a = [0 for _ in range(m)]
    b = [0 for _ in range(m)]
    c = [0 for _ in range(m)]
    for i in range(m):
        a[i], b[i], c[i] = list(map(int, input().split()))
        a[i] -= 1
        b[i] -= 1
        d[a[i]][b[i]] = min(d[a[i]][b[i]], c[i])
        d[b[i]][a[i]] = min(d[b[i]][a[i]], c[i])
    # Warshall-Floyd
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    ans = 0
    for i in range(m):
        found = 1
        for j in range(n):
            if d[j][a[i]] + c[i] == d[j][b[i]]:
                found = 0
                break
        ans += found
    print(ans)

if __name__ == "__main__":
    main()

-        a, b, c = list(map(int, input().split()))

+    d = [[INF for i in range(n)] for j in range(n)]

-                if d[to] > d[v] + cost:

-                    d[to] = d[v] + cost

-                    que.put((d[to], to))

+        a[i], b[i], c[i] = list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

# 全部試す

# 1つあたりO(M)

# O(M^2) = 10^6くらい

import numpy as np

from scipy.sparse.csgraph import dijkstra

N,M = list(map(int,input().split()))

edge = [list(map(int, input().split())) for _ in range(M)]

graph = np.zeros((N+1, N+1))

for a, b in edge:

  graph[a, b] = 1

ans = 0

for a, b in edge:

  graph[a, b] = np.inf

  # directed=False -> 無向グラフ

  dist = dijkstra(graph, indices=a, directed=False)

  if dist[b] == np.inf:

    ans += 1

  graph[a, b] = 1 # 元に戻す

print(ans)

# optimized version of the same code:

class UnionFind():

    def __init__(self, N):

        """ N個のノードのUnion-Find木を作成する """

        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる

        self.parent = [n for n in range(0, N)]

        # グループの深さ

        self.depth = [1] * N

    def find(self, x):

        """ 木の根(どのグループか)を求める """

        if self.parent[x] == x: return x

        self.parent[x] = self.find(self.parent[x]) # 縮約

        return self.parent[x]

    def unite(self, x, y):

        """ xとyの属する集合を併合する """

        gx = self.find(x)

        gy = self.find(y)

        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）

        if self.depth[gx] < self.depth[gy]:

            self.parent[gx] = gy

        else:

            self.parent[gy] = gx

            if self.depth[gx] == self.depth[gy]: self.depth[gx] += 1

    def is_same_group(self, x, y):

        """ xとyが同じ集合に属するか否か """

        return self.find(x) == self.find(y)

N, M = list(map(int, input().split()))

E = [[int(x)-1 for x in input().split()] for _ in range(M)]

# 各辺について、その辺が存在しない時、aとbが連結になるかをUnion-Findで判定する

ans = 0

for i in range(M):

  uf = UnionFind(N)

  for j, e in enumerate(E):

    if i==j: continue

    a, b = e

    uf.unite(a, b)

  # i番目の辺を除くすべての辺をつないだあとで、i番目の辺(a, b)がつながるかを判定する

  # つながらないならば、そのi番目の辺は橋である

  a, b = E[i]

  if not uf.is_same_group(a, b):

    ans += 1

print(ans)

# 全部試す
# 1つあたりO(M)
# O(M^2) = 10^6くらい
import numpy as np
from scipy.sparse.csgraph import dijkstra

N, M = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(M)]
graph = np.zeros((N + 1, N + 1))
for a, b in edge:
    graph[a, b] = 1
ans = 0
for a, b in edge:
    graph[a, b] = np.inf
    # directed=False -> 無向グラフ
    dist = dijkstra(graph, indices=a, directed=False)
    if dist[b] == np.inf:
        ans += 1
    graph[a, b] = 1  # 元に戻す
print(ans)

class UnionFind:
    def __init__(self, N):
        """N個のノードのUnion-Find木を作成する"""
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self.parent = [n for n in range(0, N)]
        # グループの深さ
        self.depth = [1] * N

    def find(self, x):
        """木の根(どのグループか)を求める"""
        if self.parent[x] == x:
            return x
        self.parent[x] = self.find(self.parent[x])  # 縮約
        return self.parent[x]

    def unite(self, x, y):
        """xとyの属する集合を併合する"""
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy:
            return
        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self.depth[gx] < self.depth[gy]:
            self.parent[gx] = gy
        else:
            self.parent[gy] = gx
            if self.depth[gx] == self.depth[gy]:
                self.depth[gx] += 1

    def is_same_group(self, x, y):
        """xとyが同じ集合に属するか否か"""
        return self.find(x) == self.find(y)

N, M = list(map(int, input().split()))
E = [[int(x) - 1 for x in input().split()] for _ in range(M)]
# 各辺について、その辺が存在しない時、aとbが連結になるかをUnion-Findで判定する
ans = 0
for i in range(M):
    uf = UnionFind(N)
    for j, e in enumerate(E):
        if i == j:
            continue
        a, b = e
        uf.unite(a, b)
    # i番目の辺を除くすべての辺をつないだあとで、i番目の辺(a, b)がつながるかを判定する
    # つながらないならば、そのi番目の辺は橋である
    a, b = E[i]
    if not uf.is_same_group(a, b):
        ans += 1
print(ans)

-from scipy.sparse.csgraph import dijkstra

+        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる

+        self.parent = [n for n in range(0, N)]

+        # グループの深さ

+        """木の根(どのグループか)を求める"""

+        self.parent[x] = self.find(self.parent[x])  # 縮約

+        """xとyの属する集合を併合する"""

+        # 小さい方を大きい方に併合させる（木の偏りが減るので）

+        if self.depth[gx] < self.depth[gy]:

+            if self.depth[gx] == self.depth[gy]:

+        """xとyが同じ集合に属するか否か"""

+        return self.find(x) == self.find(y)

-edge = [list(map(int, input().split())) for _ in range(M)]

+E = [[int(x) - 1 for x in input().split()] for _ in range(M)]

+# 各辺について、その辺が存在しない時、aとbが連結になるかをUnion-Findで判定する

-    dist = dijkstra(graph, indices=a, directed=False)

+    # i番目の辺を除くすべての辺をつないだあとで、i番目の辺(a, b)がつながるかを判定する

+    # つながらないならば、そのi番目の辺は橋である


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

a,b = list(map(int,input().split()))

count = 0

for i in range(a,b+1):

    s = str(i)

    l = len(s)

    if all(s[j] == s[l-j-1] for j in range(l)):

            count += 1

print(count)

# optimized version of the same code:

a,b = list(map(int,input().split()))

count = 0

for i in range(a,b+1):

    s = str(i)

    if s == s[::-1]:

         count += 1

print(count)

a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
    s = str(i)
    l = len(s)
    if all(s[j] == s[l - j - 1] for j in range(l)):
        count += 1
print(count)

a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
    s = str(i)
    if s == s[::-1]:
        count += 1
print(count)

-    if all(s[j] == s[l - j - 1] for j in range(l)):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

class UnionFind:

    def __init__(self, size):

        self.table = [i for i in range(size)]

    def find(self, x):

        return self.table[x]

    def union(self, x, y):

        x1 = self.find(x)

        y1 = self.find(y)

        if x1 == y1:

            return False

        for i in range(len(self.table)):

            if self.table[i] == y1:

                self.table[i] = x1

        return True

N, M = list(map(int, input().split()))

edges = []

for _ in range(M):

    a, b = list(map(int, input().split()))

    edges.append([a-1, b-1])

mat = [[0]*N for _ in range(N)]

for s, g in edges:

    mat[s][g] = 1

    mat[g][s] = 1

ans = 0

for i in range(M):

    uni = UnionFind(N)

    for j in range(M):

        if i != j:

            uni.union(edges[j][0], edges[j][1])

    if not all(uni.find(0) == uni.find(x) for x in range(N)):

        ans += 1

print(ans)

# optimized version of the same code:

# python template for atcoder1

import sys

sys.setrecursionlimit(10**9)

input = sys.stdin.readline

class UnionFind:

    def __init__(self, size):

        """

        size:頂点の数

        """

        self.parent = [i for i in range(size)]

        self.rank = [0 for _ in range(size)]

    def find(self, x):

        """

        xのrootを返す

        """

        if self.parent[x] == x:

            return x

        else:

            return self.find(self.parent[x])

    def union(self, x, y):

        """

        x,yを同じグループとしてまとめる

        """

        x = self.find(x)

        y = self.find(y)

        if x == y:

            return

        if self.rank[x] < self.rank[y]:

            self.parent[x] = y

        else:

            self.parent[y] = x

            if self.rank[x] == self.rank[y]:

                self.rank[x] += 1

    def same(self, x, y):

        """

        xとyが同じグループならTrue

        """

        return self.find(x) == self.find(y)

    def component(self):

        """

        各連結成分のrootの集合を返す

        len()をとれば連結成分の数が求められる

        return-> set()

        """

        comp = set()

        for i in self.parent:

            p = self.find(i)

            comp.add(p)

        return comp

    def __str__(self):

        """

        for debug

        クラスのlistの情報を出力

        """

        ret = "parents\n"

        ret += " ".join(map(str, self.parent))

        ret += '\n'

        ret += " ".join(map(str, self.rank))

        return ret

N, M = list(map(int, input().split()))

edges = []

for _ in range(M):

    a, b = [int(x)-1 for x in input().split()]

    edges.append([a, b])

ans = 0

for e in edges:

    Un = UnionFind(N)

    for g in edges:

        if e == g:

            continue

        else:

            Un.union(g[0], g[1])

    if not Un.same(e[0], e[1]):

        ans += 1

print(ans)

class UnionFind:
    def __init__(self, size):
        self.table = [i for i in range(size)]

    def find(self, x):
        return self.table[x]

    def union(self, x, y):
        x1 = self.find(x)
        y1 = self.find(y)
        if x1 == y1:
            return False
        for i in range(len(self.table)):
            if self.table[i] == y1:
                self.table[i] = x1
        return True

N, M = list(map(int, input().split()))
edges = []
for _ in range(M):
    a, b = list(map(int, input().split()))
    edges.append([a - 1, b - 1])
mat = [[0] * N for _ in range(N)]
for s, g in edges:
    mat[s][g] = 1
    mat[g][s] = 1
ans = 0
for i in range(M):
    uni = UnionFind(N)
    for j in range(M):
        if i != j:
            uni.union(edges[j][0], edges[j][1])
    if not all(uni.find(0) == uni.find(x) for x in range(N)):
        ans += 1
print(ans)

# python template for atcoder1
import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

class UnionFind:
    def __init__(self, size):
        """
        size:頂点の数
        """
        self.parent = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]

    def find(self, x):
        """
        xのrootを返す
        """
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])

    def union(self, x, y):
        """
        x,yを同じグループとしてまとめる
        """
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        """
        xとyが同じグループならTrue
        """
        return self.find(x) == self.find(y)

    def component(self):
        """
        各連結成分のrootの集合を返す
        len()をとれば連結成分の数が求められる
        return-> set()
        """
        comp = set()
        for i in self.parent:
            p = self.find(i)
            comp.add(p)
        return comp

    def __str__(self):
        """
        for debug
        クラスのlistの情報を出力
        """
        ret = "parents\n"
        ret += " ".join(map(str, self.parent))
        ret += "\n"
        ret += " ".join(map(str, self.rank))
        return ret

N, M = list(map(int, input().split()))
edges = []
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    edges.append([a, b])
ans = 0
for e in edges:
    Un = UnionFind(N)
    for g in edges:
        if e == g:
            continue
        else:
            Un.union(g[0], g[1])
    if not Un.same(e[0], e[1]):
        ans += 1
print(ans)

-        self.table = [i for i in range(size)]

+        self.parent = [i for i in range(size)]

+        self.rank = [0 for _ in range(size)]

+            return self.find(self.parent[x])

-        for i in range(len(self.table)):

+        x,yを同じグループとしてまとめる

+        if self.rank[x] < self.rank[y]:

+            if self.rank[x] == self.rank[y]:

+        xとyが同じグループならTrue

+        return self.find(x) == self.find(y)

+        各連結成分のrootの集合を返す

+        len()をとれば連結成分の数が求められる

+        クラスのlistの情報を出力

+        ret += " ".join(map(str, self.parent))

+        ret += " ".join(map(str, self.rank))

-    a, b = list(map(int, input().split()))

+    a, b = [int(x) - 1 for x in input().split()]

-            uni.union(edges[j][0], edges[j][1])

-    if not all(uni.find(0) == uni.find(x) for x in range(N)):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N, K = list(map(int, input().split()))

A = np.zeros(N, dtype=int)

for _ in range(K):

    eval(input())

    for i in input().split():

        A[int(i) - 1] += 1

ans = 0

for i in A:

    if i == 0:

        ans += 1

print(ans)

# optimized version of the same code:

N, K = list(map(int, input().split()))

A = [0] * N

for _ in range(K):

    eval(input())

    for i in map(int, input().split()):

        A[i - 1] += 1

print((A.count(0)))

+    for i in map(int, input().split()):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import itertools

import fractions

def main():

  s = eval(input())

  t = eval(input())

  cnt = 0

  for i in range(3):

    if s[i] == t[i]:

      cnt += 1

  print(cnt)

if __name__ == '__main__':

  main()

# optimized version of the same code:

s = eval(input())

t = eval(input())

ans = 0

for i in range(3):

    if s[i] == t[i]:

        ans += 1

print(ans)

import itertools
import fractions

def main():
    s = eval(input())
    t = eval(input())
    cnt = 0
    for i in range(3):
        if s[i] == t[i]:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

-import itertools
-import fractions
-def main():
-    s = eval(input())
-    t = eval(input())
-    cnt = 0
-    for i in range(3):
-        if s[i] == t[i]:
-            cnt += 1
-    print(cnt)
-if __name__ == "__main__":
-    main()
+s = eval(input())
+t = eval(input())
+ans = 0
+for i in range(3):
+    if s[i] == t[i]:
+        ans += 1
+print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

n,m = list(map(int, input().split()))

connect = np.zeros((n,n))

for i in range(m):

    a, b = list(map(int, input().split()))

    connect[a-1, b-1] = 1

    connect[b-1, a-1] = 1

notbridge = 0

for i in range(n):

    for j in range(n):

        if connect[i,j] == 1:

            connect[i,j] = 0

            connect[j,i] = 0

            stack =[1]

            visited = [1]

            while stack:

                p = stack.pop()

                for k in range(n):

                    if connect[p,k] == 1:

                        if k not in visited:

                            stack.append(k)

                            visited.append(k)

            if len(visited) == n:

                notbridge += 1

            connect[i,j] = 1

            connect[j,i] = 1

print((m-notbridge//2))

# optimized version of the same code:

n,m = list(map(int, input().split()))

connect = [[0 for i in range(n)] for j in range(n)]

for i in range(m):

    a, b = list(map(int, input().split()))

    connect[a-1][b-1] = 1

    connect[b-1][a-1] = 1

notbridge = 0

for i in range(n):

    for j in range(n):

        if connect[i][j] == 1:

            connect[i][j] = 0

            connect[j][i] = 0

            stack =[1]

            visited = [1]

            while stack:

                p = stack.pop()

                for k in range(n):

                    if connect[p][k] == 1:

                        if k not in visited:

                            stack.append(k)

                            visited.append(k)

            if len(visited) == n:

                notbridge += 1

            connect[i][j] = 1

            connect[j][i] = 1

print((m-notbridge//2))

import numpy as np

n, m = list(map(int, input().split()))
connect = np.zeros((n, n))
for i in range(m):
    a, b = list(map(int, input().split()))
    connect[a - 1, b - 1] = 1
    connect[b - 1, a - 1] = 1
notbridge = 0
for i in range(n):
    for j in range(n):
        if connect[i, j] == 1:
            connect[i, j] = 0
            connect[j, i] = 0
            stack = [1]
            visited = [1]
            while stack:
                p = stack.pop()
                for k in range(n):
                    if connect[p, k] == 1:
                        if k not in visited:
                            stack.append(k)
                            visited.append(k)
            if len(visited) == n:
                notbridge += 1
            connect[i, j] = 1
            connect[j, i] = 1
print((m - notbridge // 2))

n, m = list(map(int, input().split()))
connect = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    connect[a - 1][b - 1] = 1
    connect[b - 1][a - 1] = 1
notbridge = 0
for i in range(n):
    for j in range(n):
        if connect[i][j] == 1:
            connect[i][j] = 0
            connect[j][i] = 0
            stack = [1]
            visited = [1]
            while stack:
                p = stack.pop()
                for k in range(n):
                    if connect[p][k] == 1:
                        if k not in visited:
                            stack.append(k)
                            visited.append(k)
            if len(visited) == n:
                notbridge += 1
            connect[i][j] = 1
            connect[j][i] = 1
print((m - notbridge // 2))

+connect = [[0 for i in range(n)] for j in range(n)]

-                    if connect[p, k] == 1:

+                    if connect[p][k] == 1:


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

sys.setrecursionlimit(100000)

N, M = list(map(int, input().split()))

edges = [list(map(int, input().split())) for _ in range(M)]

graph = [[] for _ in range(N)]

for x, y in edges:

    graph[x - 1].append(y - 1)

    graph[y - 1].append(x - 1)

def dfs(v, c):

    # c: color = 1 or -1

    node[v] = c

    for i in graph[v]:

        if node[i] == c:

            return False

        if node[i] == 0 and not dfs(i, -c):

            return False

    return True

node = [0] * N

if dfs(0, 1):

    x = sum(v + 1 for v in node) // 2

    print((x * (N - x) - M))

else:

    print((N * (N - 1) // 2 - M))

# optimized version of the same code:

from collections import deque

N, M = list(map(int, input().split()))

edges = [list(map(int, input().split())) for _ in range(M)]

graph = [[] for _ in range(N)]

for x, y in edges:

    graph[x - 1].append(y - 1)

    graph[y - 1].append(x - 1)

def dfs(s, c):

    q = deque()

    q.append(s)

    visited[s] = True

    color[s] = c

    while len(q) > 0:

        v = q.pop()

        for i in graph[v]:

            if visited[i] and color[i] == color[v]:

                return False

            if not visited[i]:

                visited[i] = True

                color[i] = -color[v]

                q.append(i)

    return True

visited = [False] * N

color = [0] * N

if dfs(0, 1):

    x = sum(v + 1 for v in color) // 2

    print((x * (N - x) - M))

else:

    print((N * (N - 1) // 2 - M))

-        if node[i] == 0 and not dfs(i, -c):

+            if visited[i] and color[i] == color[v]:


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def kmpTable(w):

    lw = len(w)

    nx = [-1] * (lw + 1)

    j = -1

    for i in range(lw):

        while j >= 0 and w[i] != w[j]:

            j = nx[j]

        j += 1

        nx[i + 1] = j

    return nx

def kmpSearch(s, w):

    ls = len(s)

    start = 0

    w_idx = 0

    ret = []

    nx = kmpTable(w)

    while start + w_idx < ls:

        if s[start + w_idx] == w[w_idx]:

            w_idx += 1

            if w_idx == len(w):

                ret.append(start)

                start = start + w_idx - nx[w_idx]

                w_idx = nx[w_idx]

        else:

            if w_idx == 0:

                start += 1

            else:

                start = start + w_idx - nx[w_idx]

                w_idx = nx[w_idx]

    return ret

T = eval(input())

P = eval(input())

ans = kmpSearch(T, P)

if ans:

    print(("\n".join(map(str, ans))))

# optimized version of the same code:

def kmpTable(w):

    lw = len(w)

    nx = [-1] * (lw + 1)

    j = -1

    for i in range(lw):

        while j >= 0 and w[i] != w[j]:

            j = nx[j]

        j += 1

        nx[i + 1] = j

    return tuple(nx)

def kmpSearch(s, w):

    ls = len(s)

    start = 0

    w_idx = 0

    ret = []

    nx = kmpTable(w)

    while start + w_idx < ls:

        if s[start + w_idx] == w[w_idx]:

            w_idx += 1

            if w_idx == len(w):

                ret.append(start)

                start = start + w_idx - nx[w_idx]

                w_idx = nx[w_idx]

        else:

            if w_idx == 0:

                start += 1

            else:

                start = start + w_idx - nx[w_idx]

                w_idx = nx[w_idx]

    return ret

T = eval(input())

P = eval(input())

ans = kmpSearch(T, P)

if ans:

    print(("\n".join(map(str, ans))))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

if sys.argv[-1] == 'ONLINE_JUDGE':

    import os

    import re

    with open(__file__) as f:

        source = f.read().split('###''nbacl')

    for s in source[1:]:

        s = re.sub("'''.*", '', s)

        sp = s.split(maxsplit=1)

        if os.path.dirname(sp[0]):

            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)

        with open(sp[0], 'w') as f:

            f.write(sp[1])

    from nbmodule import cc

    cc.compile()

import numpy as np

from numpy import int64

from nbmodule import solve

f = open(0)

N, K = [int(x) for x in f.readline().split()]

A = np.fromstring(f.read(), dtype=int64, sep=' ')

ans = solve(N, K, A)

print(ans)

'''

###nbacl nbmodule.py

import numpy as np

from numpy import int64

from numba import njit

from numba.types import i8

from numba.pycc import CC

import nbacl.segtree as seg

cc = CC('my_module')

@cc.export('solve', (i8, i8, i8[:]))

@njit

def solve(N, K, A):

    dp = np.zeros(300_001, dtype=int64)

    d = seg.segtree(dp, max, 0)

    for i in range(N):

        x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1

        seg.set(d, max, A[i], x)

    return seg.all_prod(d)

if __name__ == '__main__':

    cc.compile()

###nbacl nbacl/segtree.py

import numpy as np

from numba import njit

from numba.types import i8

@njit

def ceil_pow2(n):

    x = 0

    while (1 << x) < n:

        x += 1

    return x

@njit

def segtree(a, op, e):

    log = ceil_pow2(a.shape[0])

    size = 1 << log

    d = np.empty(size * 2, dtype=a.dtype)

    d[size:size + len(a)] = a

    d[size + len(a):] = e

    # e

    d[0] = e

    for i in range(size - 1, 0, -1):

        update(d, i, op)

    return d

@njit

def update(d, k, op):

    d[k] = op(d[2 * k], d[2 * k + 1])

@njit

def set(d, op, p, x):

    p += d.shape[0] // 2

    d[p] = x

    while p > 1:

        p >>= 1

        update(d, p, op)

@njit

def get(d, p):

    return d[p + d.shape[0] // 2]

@njit

def prod(d, op, left, right):

    size = d.shape[0] // 2

    sml = d[0]

    smr = d[0]

    left += size

    right += size

    while left < right:

        if left & 1:

            sml = op(sml, d[left])

            left += 1

        if right & 1:

            right -= 1

            smr = op(d[right], smr)

        left >>= 1

        right >>= 1

    return op(sml, smr)

@njit

def all_prod(d):

    return d[1]

'''

# optimized version of the same code:

import sys

if sys.argv[-1] == 'ONLINE_JUDGE':

    import os

    import re

    with open(__file__) as f:

        source = f.read().split('###''nbacl')

    for s in source[1:]:

        s = re.sub("'''.*", '', s)

        sp = s.split(maxsplit=1)

        if os.path.dirname(sp[0]):

            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)

        with open(sp[0], 'w') as f:

            f.write(sp[1])

    from nbmodule import cc

    cc.compile()

import numpy as np

from numpy import int64

from nbmodule import solve

f = open(0)

N, K = [int(x) for x in f.readline().split()]

A = np.fromstring(f.read(), dtype=int64, sep=' ')

ans = solve(N, K, A)

print(ans)

'''

###nbacl nbmodule.py

import numpy as np

from numpy import int64

from numba import njit

from numba.types import i8

from numba.pycc import CC

import nbacl.segtree as seg

cc = CC('nbmodule')

@cc.export('solve', (i8, i8, i8[:]))

@njit

def solve(N, K, A):

    dp = np.zeros(300_001, dtype=int64)

    d = seg.segtree(dp, max, 0)

    for i in range(N):

        x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1

        seg.set(d, max, A[i], x)

    return seg.all_prod(d)

if __name__ == '__main__':

    cc.compile()

###nbacl nbacl/segtree.py

import numpy as np

from numba import njit

from numba.types import i8

@njit

def ceil_pow2(n):

    x = 0

    while (1 << x) < n:

        x += 1

    return x

@njit

def segtree(a, op, e):

    log = ceil_pow2(a.shape[0])

    size = 1 << log

    d = np.empty(size * 2, dtype=a.dtype)

    d[size:size + len(a)] = a

    d[size + len(a):] = e

    # e

    d[0] = e

    for i in range(size - 1, 0, -1):

        update(d, i, op)

    return d

@njit

def update(d, k, op):

    d[k] = op(d[2 * k], d[2 * k + 1])

@njit

def set(d, op, p, x):

    p += d.shape[0] // 2

    d[p] = x

    while p > 1:

        p >>= 1

        update(d, p, op)

@njit

def get(d, p):

    return d[p + d.shape[0] // 2]

@njit

def prod(d, op, left, right):

    size = d.shape[0] // 2

    sml = d[0]

    smr = d[0]

    left += size

    right += size

    while left < right:

        if left & 1:

            sml = op(sml, d[left])

            left += 1

        if right & 1:

            right -= 1

            smr = op(d[right], smr)

        left >>= 1

        right >>= 1

    return op(sml, smr)

@njit

def all_prod(d):

    return d[1]

'''

import sys

if sys.argv[-1] == "ONLINE_JUDGE":
    import os
    import re

    with open(__file__) as f:
        source = f.read().split("###" "nbacl")
    for s in source[1:]:
        s = re.sub("'''.*", "", s)
        sp = s.split(maxsplit=1)
        if os.path.dirname(sp[0]):
            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)
        with open(sp[0], "w") as f:
            f.write(sp[1])
    from nbmodule import cc

    cc.compile()
import numpy as np
from numpy import int64
from nbmodule import solve

f = open(0)
N, K = [int(x) for x in f.readline().split()]
A = np.fromstring(f.read(), dtype=int64, sep=" ")
ans = solve(N, K, A)
print(ans)
"""
###nbacl nbmodule.py
import numpy as np
from numpy import int64
from numba import njit
from numba.types import i8
from numba.pycc import CC
import nbacl.segtree as seg
cc = CC('my_module')
@cc.export('solve', (i8, i8, i8[:]))
@njit
def solve(N, K, A):
    dp = np.zeros(300_001, dtype=int64)
    d = seg.segtree(dp, max, 0)
    for i in range(N):
        x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1
        seg.set(d, max, A[i], x)
    return seg.all_prod(d)
if __name__ == '__main__':
    cc.compile()
###nbacl nbacl/segtree.py
import numpy as np
from numba import njit
from numba.types import i8
@njit
def ceil_pow2(n):
    x = 0
    while (1 << x) < n:
        x += 1
    return x
@njit
def segtree(a, op, e):
    log = ceil_pow2(a.shape[0])
    size = 1 << log
    d = np.empty(size * 2, dtype=a.dtype)
    d[size:size + len(a)] = a
    d[size + len(a):] = e
    # e
    d[0] = e
    for i in range(size - 1, 0, -1):
        update(d, i, op)
    return d
@njit
def update(d, k, op):
    d[k] = op(d[2 * k], d[2 * k + 1])
@njit
def set(d, op, p, x):
    p += d.shape[0] // 2
    d[p] = x
    while p > 1:
        p >>= 1
        update(d, p, op)
@njit
def get(d, p):
    return d[p + d.shape[0] // 2]
@njit
def prod(d, op, left, right):
    size = d.shape[0] // 2
    sml = d[0]
    smr = d[0]
    left += size
    right += size
    while left < right:
        if left & 1:
            sml = op(sml, d[left])
            left += 1
        if right & 1:
            right -= 1
            smr = op(d[right], smr)
        left >>= 1
        right >>= 1
    return op(sml, smr)
@njit
def all_prod(d):
    return d[1]
"""

import sys

if sys.argv[-1] == "ONLINE_JUDGE":
    import os
    import re

    with open(__file__) as f:
        source = f.read().split("###" "nbacl")
    for s in source[1:]:
        s = re.sub("'''.*", "", s)
        sp = s.split(maxsplit=1)
        if os.path.dirname(sp[0]):
            os.makedirs(os.path.dirname(sp[0]), exist_ok=True)
        with open(sp[0], "w") as f:
            f.write(sp[1])
    from nbmodule import cc

    cc.compile()
import numpy as np
from numpy import int64
from nbmodule import solve

f = open(0)
N, K = [int(x) for x in f.readline().split()]
A = np.fromstring(f.read(), dtype=int64, sep=" ")
ans = solve(N, K, A)
print(ans)
"""
###nbacl nbmodule.py
import numpy as np
from numpy import int64
from numba import njit
from numba.types import i8
from numba.pycc import CC
import nbacl.segtree as seg
cc = CC('nbmodule')
@cc.export('solve', (i8, i8, i8[:]))
@njit
def solve(N, K, A):
    dp = np.zeros(300_001, dtype=int64)
    d = seg.segtree(dp, max, 0)
    for i in range(N):
        x = seg.prod(d, max, (A[i] - K) if A[i] > K else 0, (A[i] + K + 1) if A[i] + K < 300_000 else 300_001) + 1
        seg.set(d, max, A[i], x)
    return seg.all_prod(d)
if __name__ == '__main__':
    cc.compile()
###nbacl nbacl/segtree.py
import numpy as np
from numba import njit
from numba.types import i8
@njit
def ceil_pow2(n):
    x = 0
    while (1 << x) < n:
        x += 1
    return x
@njit
def segtree(a, op, e):
    log = ceil_pow2(a.shape[0])
    size = 1 << log
    d = np.empty(size * 2, dtype=a.dtype)
    d[size:size + len(a)] = a
    d[size + len(a):] = e
    # e
    d[0] = e
    for i in range(size - 1, 0, -1):
        update(d, i, op)
    return d
@njit
def update(d, k, op):
    d[k] = op(d[2 * k], d[2 * k + 1])
@njit
def set(d, op, p, x):
    p += d.shape[0] // 2
    d[p] = x
    while p > 1:
        p >>= 1
        update(d, p, op)
@njit
def get(d, p):
    return d[p + d.shape[0] // 2]
@njit
def prod(d, op, left, right):
    size = d.shape[0] // 2
    sml = d[0]
    smr = d[0]
    left += size
    right += size
    while left < right:
        if left & 1:
            sml = op(sml, d[left])
            left += 1
        if right & 1:
            right -= 1
            smr = op(d[right], smr)
        left >>= 1
        right >>= 1
    return op(sml, smr)
@njit
def all_prod(d):
    return d[1]
"""

-cc = CC('my_module')
+cc = CC('nbmodule')