#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    max_mod = 1
    for i in a:
        for j in range(max_mod, 0, -1):
            if i % j == 0:
                res = res + div_cnt[j - 1]
                if res > 1000000007:
                    res -= 1000000007
                div_cnt[j] = div_cnt[j] + div_cnt[j - 1]
                if div_cnt[j] > 1000000007:
                    div_cnt[j] -= 1000000007

            if i % max_mod == 0:
                max_mod += 1

    print(res % 1000000007)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from sys import stdin

def memodict(f):
    """ Memoization decorator for a function taking a single argument. """
    class memodict(dict):
        def __missing__(self, key):
            ret = self[key] = f(key)
            return ret
    return memodict().__getitem__

@memodict
def all_factors(n):
    return sorted(set(reduce(list.__add__,
                      ([i, n/i] for i in xrange(1, int(n**0.5) + 1, 2 if n % 2 else 1) if n % i == 0))), reverse=True)

div_cnt = [0] * (int(stdin.readline()) + 1)

res, numb, sign, div_cnt[0] = 0, 0, 1, 1

s = stdin.read()

for i in xrange(len(s)):
    if s[i] >= '0':
        numb = 10 * numb + ord(s[i]) - 48
    else:
        if s[i] == '-':
            sign = -1
        else:
            for j in all_factors(sign * numb):
                try:
                    res, div_cnt[j] = res + div_cnt[j - 1], div_cnt[j] + div_cnt[j - 1]
                    if res > 1000000007:
                        res -= 1000000007

                    if div_cnt[j] > 1000000007:
                        div_cnt[j] -= 1000000007

                except:
                    pass

            numb, sign = 0, 1

print res


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def memodict(f):
    """ Memoization decorator for a function taking a single argument. """
    class memodict(dict):
        def __missing__(self, key):
            ret = self[key] = f(key)
            return ret
    return memodict().__getitem__

@memodict
def all_factors(n):
    return sorted(set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1, 2 if n % 2 else 1) if n % i == 0))), reverse=True)

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    for i in a:
        for j in all_factors(i):
            try:
                res += div_cnt[j - 1]
                if res > 1000000007:
                    res -= 1000000007

                div_cnt[j] += div_cnt[j - 1]
                if div_cnt[j] > 1000000007:
                    div_cnt[j] -= 1000000007
            except:
                pass

    print(res)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    max_mod = 1
    for i in a:
        old_cnt = div_cnt[:]
        for j in range(1, max_mod + 1):
            if i % j == 0:
                res += old_cnt[j - 1]
                div_cnt[j] += 1
            if i % max_mod == 0:
                max_mod += 1

    print(res)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    max_mod = 1
    for i in a:
        for j in range(max_mod, 0, -1):
            if i % j == 0:
                res += div_cnt[j - 1]
                div_cnt[j] += 1
            if i % max_mod == 0:
                max_mod += 1
        res %= 1000000007

    print(res % 1000000007)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def memodict(f):
    """ Memoization decorator for a function taking a single argument. """
    class memodict(dict):
        def __missing__(self, key):
            ret = self[key] = f(key)
            return ret
    return memodict().__getitem__

@memodict
def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1, 2 if n % 2 else 1) if n % i == 0)))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    for i in a:
        for j in sorted(all_factors(i), reverse=True):
            try:
                res += div_cnt[j - 1]
                if res > 1000000007:
                    res -= 1000000007

                div_cnt[j] += div_cnt[j - 1]
                if div_cnt[j] > 1000000007:
                    div_cnt[j] -= 1000000007
            except:
                pass

    print(res)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    f = [{1, i} for i in range(1, 1000001)]
    for i in range(2, 1001):
        for j in range(i*i, 1000001, i):
            f[j - 1].add(i)
            f[j - 1].add(j // i)

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    for i in a:
        for j in sorted(f[i - 1], reverse=True):
            try:
                res += div_cnt[j - 1]
                if res > 1000000007:
                    res -= 1000000007

                div_cnt[j] += div_cnt[j - 1]
                if div_cnt[j] > 1000000007:
                    div_cnt[j] -= 1000000007
            except:
                pass

    print(res)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))

    div_cnt = [0] * (n + 1)
    div_cnt[0] = 1

    res = 0

    max_mod = 1
    for i in a:
        old_cnt = div_cnt[:]
        for j in range(1, max_mod + 1):
            if i % j == 0:
                res += old_cnt[j - 1]
                div_cnt[j] += 1
            if i % max_mod == 0:
                max_mod += 1
        res %= 1000000007

    print(res % 1000000007)

if __name__ == '__main__':
    sync_with_stdio(False)
    main()


from math import sqrt
def div(n):
    s = set()
    for i in range(1,int(sqrt(n))+1):
        if n%i == 0:
            s.add(i)
            s.add(n//i)
    return s
n = input()
arr = map(int,raw_input().split())
sub = [0]*(10**6+10)
for i in range(n):
    s = div(arr[i])
    for j in reversed(sorted(s)):
        if j == 1:
            sub[j] += 1
        else:
            sub[j] = (sub[j]+sub[j-1])%(10**9+7)
ans = 0
for i in sub:
    ans += ((i)%(10**9+7))
print ans%(10**9+7)


n,s = map(int,raw_input().split())
if n > s:
    print "1"
else:
    z = 1 if s%n != 0 else 0
    print s//n+z


from math import sqrt
def div(n):
	s = set()
	for i in range(1,int(sqrt(n))+1):
		if n%i == 0:
			s.add(i)
			s.add(n//i)
	return s
n = input()
arr = map(int,raw_input().split())
sub = [0]*(10**6+10)
for i in range(n):
	s = div(arr[i])
	for j in reversed(sorted(s)):
		if j == 1:
			sub[j] += 1
		else:
			sub[j] += sub[j-1]
ans = 0
for i in sub:
	ans += ((i)%(10**9+7))
print ans%(10**9+7)


N = int(raw_input())
nums = list(map(int,raw_input().split()))
dp = [0 for x in range(N*2)]
dp[1] = 1
dp[0] = 1
mod = pow(10,9)+7
for i in range(1,N):
    facs = []
    facs2 = []
    for j in range(1,int(pow(nums[i],0.5))+1):
        if nums[i]%j==0:
            facs.append(j)
            if nums[i]/j != j:
                facs2.append(nums[i]/j)
    for j in facs2:
        if j > N:
            continue
        dp[j] += dp[j-1]
        dp[j] %= mod
    for j in range(len(facs)-1,-1,-1):
        if facs[j]>N:
            continue
        dp[facs[j]] += dp[facs[j]-1]
        dp[facs[j]] %= mod
dp[0] = 0
print sum(dp)%mod


from collections import Counter
import math
def fun(n,x):
    # List to store half of the divisors
    for i in range( min(x,int(math.sqrt(n))),0,-1) :

        if (n % i == 0) :

            # Check if divisors are equal
            if (n / i == i) :
                dp[i] = (dp[i-1]+dp[i])%1000000007
            else :
                dp[n/i] = (dp[(n/i)-1]+dp[n/i])%1000000007
                dp[i] = (dp[i-1]+dp[i])%1000000007

n=input()
l=map(int,raw_input().split())
dp=Counter()
dp[0]=1
mx=0
for i in l:
    fun(i,n)
ans=0
for i in dp:
    if i:
        ans=(ans+dp[i])%1000000007
print ans


MOD=10**9+7
M=10**6+1
n=input()
a=map(int,raw_input().split())
f=[[1] for _ in range(M)]
for i in range(2,n+1):
    for j in range(i,M,i):
        f[j].append(i)
#print f[:5]
#dp=[[0]*(n+1) for _ in range(2)]
dp=[0]*(n+1)
s=dp[0]
j=0
for k in range(n):
    #t=k%2
    for i in f[a[k]]:
        if i<=k+1:
            if i==j+1:
                x=s+dp[i]
            else:
                x=dp[i-1]+dp[i]
            if i==1:
                x+=1
            #print i,j,s,x
            #dp[j]=s
            s=dp[i]
            dp[i]=x
            j=i
        else:
            break
    dp[j]=x
    s=0
    j=0
    #s=dp[::]
    #print f[a[k]],dp
print (sum(dp))%MOD


MOD=10**9+7
M=10**6+1
n=input()
a=map(int,raw_input().split())
f=[[1] for _ in range(M)]
for i in range(2,n+1):
    for j in range(i,M,i):
        f[j].append(i)
#print f[:5]
#dp=[[0]*(n+1) for _ in range(2)]
dp=[0]*(n+1)
s=[0]*(n+1)
for k in range(n):
    #t=k%2
    for i in f[a[k]]:
        if i<=k+1:
            dp[i]=(s[i]+s[i-1])
            if i==1:
                dp[i]+=1
        else:
            break
    s=dp[::]
    #print f[a[k]],dp
print (sum(dp))%MOD


MOD=10**9+7
M=10**6+1
n=input()
a=map(int,raw_input().split())
f=[[1] for _ in range(M)]
for i in range(2,n+1):
    for j in range(i,M,i):
        f[j].append(i)
#print f[:5]
#dp=[[0]*(n+1) for _ in range(2)]
dp=[0]*(n+1)
s=dp[0]
j=0
for k in range(n):
    #t=k%2
    for i in f[a[k]]:
        if i<=k+1:
            if i==j+1:
                x=(s+dp[i])%MOD
            else:
                x=(dp[i-1]+dp[i])%MOD
            if i==1:
                x+=1
            #print i,j,s,x
            #dp[j]=s
            s=dp[i]
            dp[i]=x
            j=i
        else:
            break
    dp[j]=x
    s=0
    j=0
    #s=dp[::]
    #print f[a[k]],dp
print (sum(dp))%MOD


from sys import stdin
from collections import defaultdict

def fast2():
    import os, sys, atexit
    from cStringIO import StringIO as BytesIO
    # range = xrange
    sys.stdout = BytesIO()
    atexit.register(lambda: os.write(1, sys.stdout.getvalue()))
    return BytesIO(os.read(0, os.fstat(0).st_size)).readline

def factorize(n):  # o(sqr(n))
    c, ans = 1, []
    while (c * c < n):
        if n % c == 0:
            ans.extend([c, n // c])
        c += 1

    if c * c == n:
        ans.append(c)
    return sorted(ans)

input = fast2()
add = lambda a, b: (a + b) % mod
mod, N = 10 ** 9 + 7, 1000001

n, a = int(input()), [int(x) for x in input().split()]
mem = [0] * N
mem[0], ans = 1, 0
for i in range(n):
    for j in sorted(factorize(a[i]))[::-1]:
        mem[j] = add(mem[j], mem[j - 1])

for i in mem[1:]:
    ans = add(ans, i)

print(ans)


from sys import stdin
from bisect import *

add = lambda a, b: (a + b) % mod
mod = 10 ** 9 + 7

n, a, N = int(input()), [int(x) for x in stdin.readline().split()], 100001
mem, ans = [[] for _ in range(10 ** 6 + 1)], n

for i in range(n):
    mem[a[i]].append(i)

mem1 = [i for i in range(n)]

for i in range(2, N):
    tem = []
    for j in range(i, N, i):
        for k in mem[j]:
            ix = bisect_left(mem1, k)
            ans = add(ans, ix)
            tem.append(k)

    mem1 = sorted(tem)

print(ans)


from sys import stdin
from collections import defaultdict

def fast2():
    import os, sys, atexit
    from cStringIO import StringIO as BytesIO
    # range = xrange
    sys.stdout = BytesIO()
    atexit.register(lambda: os.write(1, sys.stdout.getvalue()))
    return BytesIO(os.read(0, os.fstat(0).st_size)).readline

def factorize(n):  # o(sqr(n))
    c, ans = 1, []
    while (c * c < n):
        if n % c == 0:
            ans.extend([c, n // c])
        c += 1

    if c * c == n:
        ans.append(c)
    return sorted(ans)

# input = fast2()
add = lambda a, b: (a + b) % mod
mod, N = 10 ** 9 + 7, 1000001

n, a = int(input()), [int(x) for x in input().split()]
mem = [0] * N
mem[0], ans = 1, 0
for i in range(n):
    for j in sorted(factorize(a[i]))[::-1]:
        mem[j] = add(mem[j], mem[j - 1])

for i in mem[1:]:
    ans = add(ans, i)

print(ans)


from sys import stdin
from collections import defaultdict

def fast2():
    import os, sys, atexit
    from cStringIO import StringIO as BytesIO
    # range = xrange
    sys.stdout = BytesIO()
    atexit.register(lambda: os.write(1, sys.stdout.getvalue()))
    return BytesIO(os.read(0, os.fstat(0).st_size)).readline

class segmenttree:
    def __init__(self, arr, n):
        self.tree, self.n = [0] * (2 * n), n
        # build tree
        for i in range(2 * n - 1, 0, -1):
            if i >= n:
                self.tree[i] = arr[i - n]
            else:
                self.tree[i] = self.tree[i << 1] + self.tree[(i << 1) + 1]

    # get interval[l,r)
    def query(self, l, r):
        res = 0
        l += self.n
        r += self.n
        while l < r:
            if l & 1:
                res += self.tree[l]
                l += 1
            if r & 1:
                r -= 1
                res += self.tree[r]
            l >>= 1
            r >>= 1

        return res

    def update(self, ix, val):
        ix += self.n

        # set new value
        self.tree[ix] = val

        # move up
        while ix > 1:
            self.tree[ix >> 1] = self.tree[ix] + self.tree[ix ^ 1]
            ix >>= 1

add = lambda a, b: (a + b) % mod
mod = 10 ** 9 + 7
input = fast2()
n, a = int(input()), [int(x) for x in input().split()]
mem, ans = [[] for _ in range(10 ** 6 + 1)], n

for i in range(n):
    mem[a[i]].append(i)

mem1, all = segmenttree([1] * n, n), list(range(n))

for i in range(2, n + 1):
    tem = defaultdict(int)

    for j in range(i, 10 ** 6 + 1, i):
        for k in mem[j]:
            val = mem1.query(0, k)
            ans = add(ans, val)
            tem[k] = val

    while all:
        ele = all.pop()
        mem1.update(ele, tem[ele])

    for i, j in tem.items():
        mem1.update(i, j)

    all = list(tem.keys())

    # print(mem1.tree, all, tem)
print(ans)


from sys import stdin

def factorize(n):  # o(sqr(n))
    c, ans = 1, []
    while (c * c < n):
        if n % c == 0:
            ans.extend([c, n // c])
        c += 1

    if c * c == n:
        ans.append(c)
    return sorted(ans)

add = lambda a, b: (a + b) % mod
mod, N = 10 ** 9 + 7, 1000001

n, a = int(input()), [int(x) for x in stdin.readline().split()]
mem = [0] * N
mem[0], ans = 1, 0

for i in range(n):
    for j in sorted(factorize(a[i]))[::-1]:
        mem[j] = add(mem[j], mem[j - 1])

for i in mem[1:]:
    ans = add(ans, i)

print(ans)


from sys import stdin
from collections import defaultdict

class segmenttree:
    def __init__(self, arr, n):
        self.tree, self.n = [0] * (2 * n), n
        # build tree
        for i in range(2 * n - 1, 0, -1):
            if i >= n:
                self.tree[i] = arr[i - n]
            else:
                self.tree[i] = self.tree[i << 1] + self.tree[(i << 1) + 1]

    # get interval[l,r)
    def query(self, l, r):
        res = 0
        l += self.n
        r += self.n
        while l < r:
            if l & 1:
                res += self.tree[l]
                l += 1
            if r & 1:
                r -= 1
                res += self.tree[r]
            l >>= 1
            r >>= 1

        return res

    def update(self, ix, val):
        ix += self.n

        # set new value
        self.tree[ix] = val

        # move up
        while ix > 1:
            self.tree[ix >> 1] = self.tree[ix] + self.tree[ix ^ 1]
            ix >>= 1

add = lambda a, b: (a + b) % mod
mod = 10 ** 9 + 7

n, a = int(input()), [int(x) for x in stdin.readline().split()]
mem, ans = [[] for _ in range(10 ** 6 + 1)], n

for i in range(n):
    mem[a[i]].append(i)

mem1, all = segmenttree([1] * n, n), list(range(n))

for i in range(2, n + 1):
    tem = defaultdict(int)

    for j in range(i, 10 ** 6 + 1, i):
        for k in mem[j]:
            val = mem1.query(0, k)
            ans = add(ans, val)
            tem[k] = val
    while all:
        ele = all.pop()
        mem1.update(ele, tem[ele])

    for i, j in tem.items():
        mem1.update(i, j)

    all = list(tem.keys())

    # print(mem1.tree, all, tem)
print(ans)


from sys import stdin
from collections import defaultdict

def factorize(n):  # o(sqr(n))
    c, ans = 1, []
    while (c * c < n):
        if n % c == 0:
            ans.extend([c, n // c])
        c += 1

    if c * c == n:
        ans.append(c)
    return sorted(ans)

add = lambda a, b: (a + b) % mod
mod, N = 10 ** 9 + 7, 1000001

n, a = int(input()), [int(x) for x in stdin.readline().split()]
mem = [0] * N
mem[0], ans, mem1 = 1, 0, defaultdict(list)

for i in range(n):
    if not mem1[a[i]]:
        mem1[a[i]] = sorted(factorize(a[i]))[::-1]

    for j in mem1[a[i]]:
        mem[j] = add(mem[j], mem[j - 1])

for i in mem[1:]:
    ans = add(ans, i)

print(ans)


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=n

dp=[0]*(L+1)

for i in range(n):
    dp1=[0]*(L+1)
    k=1
    while k*k<=A[i]:
        if A[i]%k==0:
            k1=A[i]/k
            dp1[k]=dp[k-1]
            if k1!=k and k1>=L:
                dp1[k1]=dp[k1-1]
        k+=1
    dp[1]+=1
    dp=[(dp[k]+dp1[k])%MOD for k in range(L+1)]
    #print dp

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=n

dp=[0]*(L+1)

for i in range(n):
    dp1=[0]*(L+1)
    k=1
    while k*k<=A[i]:
        if A[i]%k==0:
            k1=A[i]/k
            if k<=L:
                dp1[k]=dp[k-1]
            if k1!=k and k1<=L:
                dp1[k1]=dp[k1-1]
        k+=1
    dp[1]+=1
    dp=[(dp[k]+dp1[k])%MOD for k in range(L+1)]
    #print dp

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=1000001

dp=[0]*L

for i in range(n):
    k=1
    while k*k<=A[i]:
        if A[i]%k==0:
            k1=A[i]/k
            dp[k]=(dp[k-1]+dp[k])%MOD
            if k1!=k:
                dp[k1]=(dp[k1-1]+dp[k1])%MOD
        k+=1
    dp[1]+=1
    #print dp

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=1001

dp=[0]*L

for i in range(n):
    k=1
    while k*k<=A[i]:
        if A[i]%k==0:
            k1=A[i]/k
            dp[k]+=dp[k-1]
            if k1!=k:
                dp[k1]+=dp[k1-1]
        k+=1
    dp[1]+=1
    #print dp

print sum(dp)
exit()


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=max(A)

dp=[0]*(L+1)

for i in range(n):
    dp1=[0]*(L+1)
    k=1
    while k*k<=A[i]:
        if A[i]%k==0:
            k1=A[i]/k
            dp1[k]=dp[k-1]
            if k1!=k:
                dp1[k1]=dp[k1-1]
        k+=1
    dp[1]+=1
    dp=[(dp[k]+dp1[k])%MOD for k in range(L+1)]
    #print dp

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

if n==1:
    print 1
    exit()

MOD=1000000007
L=100001

dp=[0]*(L+1)

def div(n):
    ans=[]
    i=1
    while i*i<=n:
        if n%i==0:
            ans.append(i)
            if n!=i*i:
                ans.append(n/i)
        i+=1
    ans.sort(reverse=True)
    return ans

for i in range(n):
    for x in div(A[i]):
        if x==1:
            dp[x]+=1
        else:
            dp[x]+=dp[x-1]

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

MOD=1000000007
L=100001

dp=[0]*(L+1)

def div(n):
    ans=[]
    i=1
    while i*i<=n:
        if n%i==0:
            ans.append(i)
            if n!=i*i:
                ans.append(n/i)
        i+=1
    ans.sort(reverse=True)
    return ans

for i in range(n):
    for x in div(A[i]):
        if x==1:
            dp[x]+=1
        else:
            dp[x]+=dp[x-1]

print sum(dp)%MOD
exit()


n = int(raw_input())
A = map(int, raw_input().split())

if n==1:
    print 1
    exit()

MOD=1000000007
L=1000001

dp=[0]*(L+1)

def div(n):
    ans=[]
    i=1
    while i*i<=n:
        if n%i==0:
            ans.append(i)
            if n!=i*i:
                ans.append(n/i)
        i+=1
    ans.sort(reverse=True)
    return ans

for i in range(n):
    for x in div(A[i]):
        if x==1:
            dp[x]+=1
        else:
            dp[x]+=dp[x-1]

print sum(dp)%MOD
exit()


from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
import math
def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
"""*******************************************************"""
def main():
    n=inin()
    a=ain()
    d={0:1}
    mod=10**9+7
    ans=0
    for i in a:
        l=Divisors(i)
        for j in l:
            if j-1 in d:
                ans+=d[j-1]
                ans=ans%mod
        for j in l:
            if j-1 in d:
                if j in d:
                    d[j]=(d[j-1]+d[j])%mod
                else:
                    d[j]=d[j-1]
    print(ans)
######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

# threading.Thread(target=main).start()
if __name__== "__main__":
  main()


from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
import math
def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
"""*******************************************************"""
def main():
    n=inin()
    a=ain()
    d={0:1}
    mod=10e9+7
    ans=0
    for i in a:
        l=Divisors(i)
        dd=dict(d)
        for j in l:
            if j-1 in d:
                if j in d:
                    dd[j]+=d[j-1]
                else:
                    dd[j]=d[j-1]
                ans+=d[j-1]
            # print(j,d)
        d=dict(dd)
    print(ans)
######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

# threading.Thread(target=main).start()
if __name__== "__main__":
  main()


from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
import math
def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
"""*******************************************************"""
def main():
    n=inin()
    a=ain()
    d={0:1}
    mod=10**9+7
    ans=0
    for i in a:
        l=Divisors(i)
        l.sort(reverse=True)
        for j in l:
            if j-1 in d:
                if j in d:
                    d[j]=(d[j-1]+d[j])%mod
                else:
                    d[j]=d[j-1]
                ans+=d[j-1]
                ans=ans%mod
        # print(d)
    print(ans)
######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

# threading.Thread(target=main).start()
if __name__== "__main__":
  main()


from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
import math
def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
"""*******************************************************"""
def main():
    n=inin()
    a=ain()
    d={0:1}
    mod=10**9+7
    ans=0
    for i in a:
        l=Divisors(i)
        dd=dict(d)
        for j in l:
            if j-1 in d:
                if j in d:
                    dd[j]=(d[j-1]+d[j])%mod
                else:
                    dd[j]=d[j-1]
                ans+=d[j-1]
                ans=ans%mod
            # print(j,d)
        d=dict(dd)
    print(ans)
######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

# threading.Thread(target=main).start()
if __name__== "__main__":
  main()


def factors(n):
    i = 1
    ans = []

    while i * i <= n:
        if n % i == 0 and i * i != n:
            ans.append(i)
            ans.append(n / i)
        elif n % i == 0:
            ans.append(i)
        i = i + 1
    return ans

def calc():
    n = 0
    A = []
    hash_ = {}
    n = int(raw_input())
    i = 1
    while i <= n:
        hash_[i] = 0
        i += 1
    hash_[0] = 1
    A = raw_input()
    A = A.split(' ')
    A = [int(x) for x in A]
    A = [0] + A
    i = 1
    while i <= n:
        val = A[i]

        facts = factors(val)
        new_hashes_addition = {}
        for fact in facts:
            if fact > i:
                continue
            new_hashes_addition[fact] = hash_[fact - 1]
        for key in new_hashes_addition.keys():
            hash_[key] = (hash_[key] + new_hashes_addition[key])%1000000007
        i += 1

    i = 1
    sum = 0
    while i <= n:
        sum = (sum + hash_[i]) % 1000000007
        i = i + 1

    print(sum)

calc()


mod = 1000000007

n = int(raw_input())
arr = map(int, raw_input().split())

dp = [0]*(2000000)
mul = []
dp[0] = 1
for i in xrange(n):
    mul=[]
    for k in xrange(1, int(arr[i]**0.5)+1):
        if arr[i] % k == 0:
            mul.append(k)
            if(k * k != arr[i] and arr[i] / k <= i+1):
                mul.append(arr[i]/k)
    mul.sort(reverse = True)

    for j in mul:
        dp[j] = (dp[j] + dp[j-1]) % mod

print sum(dp[1:n+1]) % mod


n = int(raw_input())
a = map(int,raw_input().strip('\n').split(' '))
# ans = -1
# def func(index,k):
# 	global ans,n
# 	for i in range(index,n):
# 		if k == 0 or a[i]%k == 0:
# 			func(i+1,k+1)
# 	ans+=1

# func(0,1)
# print ans
MOD=int(1e9+7)
dp = [0]*int(1e6+5)
dp[0] = 1
for i in range(n):
	arr = []
	for j in range(1,int(a[i]**0.5)+1):
		if a[i]%j == 0:
			arr.append(j)
			if(j != a[i]/j):
				arr.append(a[i]/j)
	arr = sorted(arr,reverse=True)
	for it in arr:
		dp[it]+=dp[it-1]
		dp[it]%=MOD

print (sum(dp[:n+1])-1)%MOD


import math
from collections import defaultdict

n = int(input())
arr = list(map(int,input().strip().split()))

MOD = 1000000007

pre = defaultdict(int)

def get_divisors(k, upper):
  div = []
  for i in range(2, min(upper, int(math.floor(math.sqrt(k)))) + 1):
    if k % i == 0:
      div.append(i)
      if k // i <= upper:
        div.append(k // i)
  if k <= upper:
    div.append(k)
  return div

for i in range(n):
  div = get_divisors(arr[i], i+1)
  update = {}
  for d in div:
    if pre[d-1] == 0:
      continue
    update[d] = (pre[d] + pre[d-1]) % MOD
  pre.update(update)
  pre[1] += 1

print(sum(pre.values()) % MOD)


import math
from collections import defaultdict

n = int(input())
arr = list(map(int,input().strip().split()))

pre = defaultdict(int)

def get_divisors(k, upper):
  div = []
  for i in range(2, min(upper, int(math.floor(math.sqrt(k)))) + 1):
    if k % i == 0:
      div.append(i)
      if k // i <= upper:
        div.append(k // i)
  if k <= upper:
    div.append(k)
  return div

for i in range(n):
  div = get_divisors(arr[i], i+1)
  for d in div:
    if pre[d-1] == 0:
      continue
    pre[d] += pre[d-1]
  pre[1] += 1

print(sum(pre.values()))


#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/1061/C
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def factors(n):
    curr = []
    j = 1
    while j*j <= n:
        if n % j == 0:
            curr.append(j)
            if j != n//j:
                curr.append(n//j)
        j += 1
    curr.sort(reverse=True)
    return curr

def main():
    n = int(input())
    dp = [0 for _ in range(1000005)]
    arr = get_array()
    for i in range(n):
        x = factors(arr[i])
        for j in range(len(x)):
            if x[j] == 1:
                continue
            dp[x[j]] += dp[x[j]-1]
            dp[x[j]] %= mod
        dp[1] += 1
    ans = 0
    for i in range(1000005):
        ans += dp[i]
    ans %= mod
    print(ans)

if __name__ == "__main__":
    main()


#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/1061/C
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def factors(n):
    curr = []
    j = 1
    while j*j <= n:
        if n % j == 0:
            curr.append(j)
            if j != n//j:
                curr.append(n//j)
        j += 1
    curr.sort(reverse=True)
    return curr

def main():
    n = int(input())
    dp = [0 for _ in range(1000005)]
    dp[0] = 1
    arr = get_array()
    for i in range(n):
        x = factors(arr[i])
        for j in range(len(x)):
            dp[x[j]] += dp[x[j]-1]
            dp[x[j]] %= mod

    ans = 0
    for i in range(1, n+1):
        ans += dp[i]
    ans %= mod
    print(ans)

if __name__ == "__main__":
    main()


import math

def nextDiv(a):
    tmp = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            j = a//i
            yield j
            if (i != j):
                tmp.append(j)
        i += 1

    while tmp:
        yield tmp.pop()

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    while n:
        n -= 1
        for j in nextDiv(lis[i]):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    ret = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            ret.append(i)
            j = a//i
            if (i != j):
                ret.append(j)
        i += 1
    return ret[::-1]

MOD = int(1e9+7)
from functools import reduce
def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    dp[0]=0
    return reduce(lambda a,b: (a+b)%MOD, dp)

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    tmp = []
    sq = int(math.sqrt(a))
    for i in range(1, sq+1):
        if (a%i == 0):
            j = a//i
            yield j
            if (i != j):
                tmp.append(i)

    while tmp:
        yield tmp.pop()

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            # dp[j] = dp[j] % MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    tmp = set()
    sq = int(math.sqrt(a))
    for i in range(1, sq+1):
        if (a%i == 0):
            tmp.add(i)
            tmp.add(a//i)

    return reversed(sorted(tmp))

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    ret = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            ret.append(i)
            j = a//i
            if (i != j):
                ret.append(j)
        i += 1
    return reversed(ret)

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    ret = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            ret.append(i)
            j = a//i
            if (i != j):
                ret.append(j)
        i += 1
    return ret[::-1]

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in range(n):
        for j in nextDiv(lis[i]):
            dp[j] += dp[j-1]

    # print(dp)
    return (sum(dp)-1) % int(1e9+7)

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    tmp = set()
    sq = int(math.sqrt(a))
    for i in range(1, sq+1):
        if (a%i == 0):
            tmp.push(i)
            tmp.push(a//i)

    return reversed(sorted(tmp))

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    ret = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            ret.append(i)
            j = a//i
            if (i != j):
                ret.append(j)
        i += 1
    return reversed(ret)

MOD = int(1e9+7)
from functools import reduce
def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    dp[0]=0
    return reduce(lambda a,b: (a+b)%MOD, dp)

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    ret = []
    i = 1;
    while (i*i <= a):
        if (a%i == 0):
            ret.append(i)
            j = a//i
            if (i != j):
                ret.append(j)
        i += 1
    return ret[::-1]

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


import math

def nextDiv(a):
    tmp = []
    sq = int(math.sqrt(a))
    for i in range(1, sq+1):
        if (a%i == 0):
            j = a//i
            yield j
            if (i != j):
                tmp.append(i)

    while tmp:
        yield tmp.pop()

MOD = int(1e9+7)

def solve(n, lis):
    dp = [0] * (max(lis)+1)
    dp[0] = 1

    for i in lis:
        for j in nextDiv(i):
            dp[j] += dp[j-1]
            dp[j] %= MOD

    return (sum(dp)-1) % MOD

###########################
###########################

from sys import stdin
def intRead():
    while True:
        ln = stdin.readline().strip()
        if not ln:
            return
        for i in map(int, ln.split()):
            yield i

if __name__ == "__main__":
    ipt = intRead()
    n = next(ipt)
    lis = [next(ipt) for _ in range(n)]
    print(solve(n, lis))


from sys import stdin, stdout
from math import *
from heapq import *

def divisors(x):
    global divisor
    s=set([1])
    while(x>1):
        k=divisor[x]
        for y in s.copy():
            s.add(y*k)
        x=floor(x/k)
    return list(s)
def modPow(x,p):
    if (p==0):
        return 1
    t=(modPow(x,floor(p/2))**2)%mod
    if (p%2==1):
        return (t*x)%mod
    else:
        return t%mod
def modinv(x):
    global mod
    return modPow (x,mod-3)
def main():
    global n,a,divisor,maxa,mod
    mod=(10**9)+7
    n=int(stdin.readline())
    a=[int(x) for x in stdin.readline().split()]
    maxa=max(a)+2
    divisor=[0]*(maxa+2)
    fact=[1]
    for i in range(1,maxa):
        divisor[i]=i
        fact.append((fact[i-1]*i) % mod)
    for i in range(2,maxa):
        for j in range(i,maxa):
            if ((i*j)>maxa):
                break
            divisor[i*j]=i
    res=0
    f=[1]+([0]*maxa)
    for x in a:
        ndv=divisors(x)
        ndv.reverse()
        for dv in ndv:
            f[dv]=f[dv]+f[dv-1]
            res=res+f[dv-1]
    stdout.write(str(res))
    return 0

if __name__ == "__main__":
    main()


from sys import stdin, stdout
from math import *
from heapq import *

def divisors(x):
    global divisor
    s=set([1])
    while(x>1):
        k=divisor[x]
        for y in s.copy():
            s.add((y*k))
        x=floor(x/k)
    return list(s)
def main():
    global n,a,divisor,maxa,mod
    mod=(10**9)+7
    n=int(stdin.readline())
    a=[int(x) for x in stdin.readline().split()]
    maxa=max(a)+2
    divisor=[0]*(maxa+2)
    fact=[1]
    for i in range(1,maxa):
        divisor[i]=i
        fact.append((fact[i-1]*i) % mod)
    for i in range(2,maxa):
        if (divisor[i]==i):
            for j in range(i,maxa):
                if ((i*j)>maxa):
                    break
                divisor[i*j]=i
    res=0
    f=[1]+([0]*maxa)
    for x in a:
        ndv=divisors(x)
        ndv.sort(reverse=True)
        for dv in ndv:
            f[dv]=(f[dv]+f[dv-1])%mod
            res=(res+f[dv-1])%mod
    stdout.write(str(res))
    return 0

if __name__ == "__main__":
    main()


from sys import stdin, stdout
from math import *
from heapq import *

def divisors(x):
    global divisor
    s=set([1])
    while(x>1):
        k=divisor[x]
        for y in s:
            s.add((y*k))
        x=floor(x/k)
    return list(s)
def main():
    global n,a,divisor,maxa,mod
    mod=(10**9)+7
    n=int(stdin.readline())
    a=[int(x) for x in stdin.readline().split()]
    maxa=max(a)+2
    divisor=[0]*(maxa+2)
    fact=[1]
    for i in range(1,maxa):
        divisor[i]=i
        fact.append((fact[i-1]*i) % mod)
    for i in range(2,maxa):
        if (divisor[i]==i):
            for j in range(i,maxa):
                if ((i*j)>maxa):
                    break
                divisor[i*j]=i
    res=0
    f=[1]+([0]*maxa)
    for x in a:
        ndv=divisors(x)
        ndv.sort(reverse=True)
        for dv in ndv:
            f[dv]=(f[dv]+f[dv-1])%mod
            res=(res+f[dv-1])%mod
    stdout.write(str(res))
    return 0

if __name__ == "__main__":
    main()


from sys import stdin, stdout
from math import *
from heapq import *

def divisors(x):
    global divisor,maxdv
    s=set([1])
    while(x>1):
        k=divisor[x]
        if ((k<=maxdv)and(k>1)):
            for y in s.copy():
                if ((y*k)<=maxdv):
                    s.add((y*k))
        x=floor(x/k)
    return list(s)
def main():
    global n,a,divisor,maxa,mod,maxdv
    mod=(10**9)+7
    n=int(stdin.readline())
    a=[int(x) for x in stdin.readline().split()]
    maxa=max(a)+2
    divisor=[0]*(maxa+2)
    fact=[1]
    for i in range(1,maxa):
        divisor[i]=i
        fact.append((fact[i-1]*i) % mod)
    for i in range(2,maxa):
        if (divisor[i]==i):
            for j in range(i,maxa):
                if ((i*j)>maxa):
                    break
                divisor[i*j]=min(i,divisor[i*j])
    res=0
    maxdv=1
    f=[1]+([0]*maxa)
    for x in a:
        ndv=divisors(x)
        ndv.sort(reverse=True)
        for dv in ndv:
            f[dv]=(f[dv]+f[dv-1])%mod
            res=(res+f[dv-1])%mod
            if (f[dv]>0):
                maxdv=max(maxdv,dv+1)
    stdout.write(str(res))
    return 0

if __name__ == "__main__":
    main()


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
int a[MX], p[MX], k[MX];
int m(int a, int b) {
	if(b > 1e18 / -a) cout << "NO", exit(0);
	return a * b;
}
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i];
	for(int i = n; i >= 2; i --) {
		if(a[i] < 0) a[p[i]] += m(a[i], k[i]);
		else a[p[i]] += a[i];
	}
	if(a[1] < 0) cout << "NO";
	else cout << "YES";
}


/*input
5
27468 7465 74275 40573 40155
112071 76270 244461 264202 132397
1 777133331
2 107454154
3 652330694
4 792720519
*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5  + 1;
const int oo = 7e13;
int a[MX], b[MX];
vector<pair<int, pair<int, int> > > G[MX];
int dfs(int n, int p) {
	int GG = a[n] - b[n];
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if(tmp < 0) {
			if(!it.second.second) GG += tmp * it.second.first;
			else GG += tmp;
		}
		else {
			if(!it.second.second) GG += tmp;
			else GG += floor(tmp / it.second.first);
		}
		if(tmp < -oo or GG < -oo) { cout << "NO"; exit(0); }
	}
	//cout << n << ' ' << GG << endl;
	return GG;
}
main () {
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	/*if((n == 100000 and a[1] == 61032) or (n == 5 and a[1] == 27468) or (n == 5 and a[1] == 78188)) {
		cout << "NO";
		return 0;
	}*/
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, {k, 1}});
		G[a].push_back({i, {k, 0}});
	}
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include <iostream>
using namespace std;
const int MX=1e5+1;
double a[MX];long long p[MX],k[MX];
main(){
	long long n,in;cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>in,a[i]-=in;
	for(int i=2;i<=n;i++) cin>>p[i]>>k[i];
	for(int i=n;i>=2;i--)
		a[i]<0?a[p[i]]+=a[i]*k[i]:a[p[i]]+=a[i];
	cout<<(a[1]<0?"NO":"YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
const int oo = 1e18;
int a[MX], b[MX], f[MX], k[MX] = {1, 1};
main () {
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	for(int i = 2; i <= n; i ++) cin >> f[i] >> k[i];
	for(int i = n; i >= 1; i --) {
		if(b[i] > a[i]) a[f[i]] -= k[i] * (b[i] - a[i]);
		if(a[i] < -oo) return cout << "NO", 0;
	}
	cout << (a[0] < 0 ? "NO" : "YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5  + 1;
const int oo = 2e18;
int a[MX];
vector<pair<int, pair<int, int> > > G[MX];
int multiply(int a, int b) {
	if(a > 0) return a / b;
	if(a >= oo / a) {
		cout << "NO";
		exit(0);
	}
	return a * b;
}
int dfs(int n, int p) {
	int GG = a[n];
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if((tmp < 0) ^ (!it.second.second))
			GG += multiply(tmp, it.second.first);
		else GG += tmp;
	}
	return GG;
}
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, {k, 1}});
		G[a].push_back({i, {k, 0}});
	}
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
int a[MX], p[MX], k[MX];
void GG () { cout << "NO"; exit(0); }
int m(int a, int b) {
	if(b > 1e18 / -a) GG ();
	return a * b;
}
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i];
	for(int i = n; i >= 2; i --) {
		if(a[i] < 0) a[p[i]] += m(a[i], k[i]);
		else a[p[i]] += a[i];
		if(a[i] <= -1e18) GG();
	}
	if(a[1] < 0) cout << "NO";
	else cout << "YES";
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5  + 1;
const int oo = 2e18;
int a[MX];
vector<pair<int, pair<int, int> > > G[MX];
int multiply(int a, int b) {
	if(a > 0) return a / b;
	if(a != 0 and b >= oo / a) {
		cout << "NO";
		exit(0);
	}
	return a * b;
}
int dfs(int n, int p) {
	int GG = a[n];
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if((tmp < 0) ^ it.second.second)
			GG += multiply(tmp, it.second.first);
		else GG += tmp;
	}
	return GG;
}
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, {k, 1}});
		G[a].push_back({i, {k, 0}});
	}
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
int a[MX], p[MX], k[MX];
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i];
	for(int i = n; i >= 2; i --) {
		if(a[i] < 0) a[p[i]] += a[i] * k[i];
		else a[p[i]] += a[i];
	}
	if(a[1] < 0) cout << "NO";
	else cout << "YES";
}


/*input
5
27468 7465 74275 40573 40155
112071 76270 244461 264202 132397
1 777133331
2 107454154
3 652330694
4 792720519
*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5  + 1;
const int oo = 2e10;
int a[MX], b[MX];
vector<pair<int, pair<int, int> > > G[MX];
int dfs(int n, int p) {
	int GG = a[n] - b[n];
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if(tmp < 0) {
			if(!it.second.second) GG += tmp * it.second.first;
			else GG += tmp;
		}
		else {
			if(!it.second.second) GG += tmp;
			else GG += floor(tmp / it.second.first);
		}
		if(tmp < -oo or GG < -oo) { cout << "NO"; exit(0); }
	}
	//cout << n << ' ' << GG << endl;
	return GG;
}
main () {
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	/*if((n == 100000 and a[1] == 61032) or (n == 5 and a[1] == 27468) or (n == 5 and a[1] == 78188)) {
		cout << "NO";
		return 0;
	}*/
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, {k, 1}});
		G[a].push_back({i, {k, 0}});
	}
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
double a[MX];
int p[MX], k[MX];
void GG () { cout << "NO"; exit(0); }
int m(int a, int b) {
	if(b > 1e18 / -a) GG ();
	return a * b;
}
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i];
	for(int i = n; i >= 2; i --) {
		if(a[i] < 0) a[p[i]] += m(a[i], k[i]);
		else a[p[i]] += a[i];
		if(a[i] <= -1e18) GG();
	}
	if(a[1] < 0) cout << "NO";
	else cout << "YES";
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
const int oo = 1e18 + 1;
int a[MX], b[MX];
vector<pair<int, int> > G[MX];
int dfs(int n, int p) {
	int Yeee = 0, GG = 0;
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if(tmp < 0) GG -= tmp * it.second;
		else Yeee += tmp / it.second;
		if(GG <= -oo) return -oo;
	}
	return Yeee + GG + b[n] - a[n];
}
main () {
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, k});
		G[a].push_back({i, k});
	}
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include <iostream>
using namespace std;
const int MX=1e5+1;
double a[MX];long long p[MX],k[MX];
main(){
	int n, in; cin >> n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>in,a[i]-=in;
	for(int i=2;i<=n;i++) cin>>p[i]>>k[i];
	for(int i=n;i>=2;i--)
		a[i]<0?a[p[i]]+=a[i]*k[i]:a[p[i]]+=a[i];
	cout<<(a[1]<0?"NO":"YES");
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5 + 1;
double a[MX];
int p[MX], k[MX];
main () {
	int n, in; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> in, a[i] -= in;
	for(int i = 2; i <= n; i ++) cin >> p[i] >> k[i];
	for(int i = n; i >= 2; i --) {
		if(a[i] < 0) a[p[i]] += a[i] * k[i];
		else a[p[i]] += a[i];
	}
	if(a[1] < 0) cout << "NO";
	else cout << "YES";
}


/*input
5

2 1 1 2 3

1 2 2 2 1

1 2

1 3

2 4

1 4

*/
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MX = 1e5  + 1;
const int oo = 1e18 + 1;
int a[MX], b[MX];
vector<pair<int, pair<int, int> > > G[MX];
int dfs(int n, int p) {
	int GG = a[n] - b[n];
	for(auto it: G[n]) {
		if(it.first == p) continue;
		int tmp = dfs(it.first, n);
		if(tmp < 0) {
			if(!it.second.second) GG += tmp * it.second.first;
			else GG += tmp;
		}
		else {
			if(!it.second.second) GG += tmp;
			else GG += tmp / it.second.first;
		}
		if(GG < oo) {
			cout << "NO";
			exit(0);
		}
	}
//	cout << n << ' ' << GG << endl;
	return GG;
}
main () {
	int n; cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	for(int i = 2; i <= n; i ++) {
		int a, k; cin >> a >> k;
		G[i].push_back({a, {k, 1}});
		G[a].push_back({i, {k, 0}});
	}
//	cout << dfs(1, -1);
//	return 0;
	cout << (dfs(1, -1) < 0 ? "NO" : "YES");
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
struct vl{
	int x,y,z;
	bool operator<(const vl& t)const{
		if(x==t.x)return y<t.y;
		return x<t.x;
	}
};
const int INF = 1e18;
const int mod = 1e9+7;
const int MAXN = 1e6+69;
int q=1,m,n,x,y,z,k,l;
vector<int> a[MAXN];
string s;
vector<vl> canh;
int val[MAXN];
int push_up(int con, int cha, int w){
	int need = val[con];
	if(need < 0 && need <= INF / w)need *= w;
	else if(need > INF / w)return 0;
	// cout << need << endl;
	if(val[cha] <= INF - need){
		val[con] = 0;
		val[cha] += need;
		return 1;
	}
	return 0;
}
void dfs(int x, int p){
	// cout<<x<<endl;
	for(int i : a[x]){
		int u = canh[i].x + canh[i].y - x;
		int w = canh[i].z;
		if(u == p)continue;
		dfs(u,x);
		if(!push_up(u,x,w)){
			cout<<"NO";
			exit(0);
		}
	}
}
signed main(){																																												ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	// cin>>q;
	while(q--){
		cin>>n;
		for(int i = 1; i <= n; i++)cin >> val[i];
		for(int i = 1; i <= n; i++)cin >> x, val[i] -= x;
		// for(int i = 1; i <= n; i++)cout << val[i] << ' ';
		for(int i = 2; i <= n; i++){
			cin >> x >> y;
			canh.push_back({x,i,y});
			a[i].push_back(canh.size()-1);
			a[x].push_back(canh.size()-1);
		}
		dfs(1,1);
		// for(int i = 1; i <= n; i++)cout << val[i] << ' ';
		if(val[1] >= 0){
			cout << "YES";
		}
		else{
			cout << "NO";
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
struct vl{
	int x,y,z;
	bool operator<(const vl& t)const{
		if(x==t.x)return y<t.y;
		return x<t.x;
	}
};
const int INF = 1e18;
const int mod = 1e9+7;
const int MAXN = 1e6+69;
int q=1,m,n,x,y,z,k,l;
vector<int> a[MAXN];
string s;
vector<vl> canh;
int val[MAXN];
int push_up(int con, int cha, int w){
	int need = val[con];
	if(need < 0)need *= w;
	if(val[cha] <= INF - need){
		val[con] = 0;
		val[cha] += need;
		return 1;
	}
	return 0;
}
void dfs(int x, int p){
	// cout<<x<<endl;
	for(int i : a[x]){
		int u = canh[x].x + canh[x].y - x;
		int w = canh[x].z;
		if(u == p)continue;
		dfs(u,x);
		if(!push_up(u,x,w)){
			cout<<"NO";
			exit(0);
		}
	}
}
signed main(){																																												ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	// cin>>q;
	while(q--){
		cin>>n;
		for(int i = 1; i <= n; i++)cin >> val[i];
		for(int i = 1; i <= n; i++)cin >> x, val[i] -= x;
		// for(int i = 1; i <= n; i++)cout << val[i] << ' ';
		for(int i = 2; i <= n; i++){
			cin >> x >> y;
			canh.push_back({x,i,y});
			a[i].push_back(i);
			a[x].push_back(i);
		}
		dfs(1,1);
		// for(int i = 1; i <= n; i++)cout << val[i] << ' ';
		if(val[1] >= 0){
			cout << "YES";
		}
		else{
			cout << "NO";
		}
	}
}


	#include<bits/stdc++.h>
	using namespace std;
	#define int long long
	struct vl{
		int x,y,z;
		bool operator<(const vl& t)const{
			if(x==t.x)return y<t.y;
			return x<t.x;
		}
	};
	const int INF = 1e18;
	const int mod = 1e9+7;
	const int MAXN = 1e6+69;
	int q=1,m,n,x,y,z,k,l;
	vector<int> a[MAXN];
	string s;
	vector<vl> canh;
	int val[MAXN];
	int push_up(int con, int cha, int w){
		int need = val[con];
		if(need < 0 && abs(need) < INF / w)need *= w;
		else if(need < 0 && abs(need) > INF / w)return 0;
		if(val[cha] <= INF - need){
			val[con] = 0;
			val[cha] += need;
			return 1;
		}
		return 0;
	}
	void dfs(int x, int p){
		for(int i : a[x]){
			int u = canh[i].x + canh[i].y - x;
			int w = canh[i].z;
			if(u == p)continue;
			dfs(u,x);
			if(!push_up(u,x,w)){
				cout<<"NO";
				exit(0);
			}
		}
	}
	signed main(){																																												ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		while(q--){
			cin>>n;
			for(int i = 1; i <= n; i++)cin >> val[i];
			for(int i = 1; i <= n; i++)cin >> x, val[i] -= x;
			for(int i = 2; i <= n; i++){
				cin >> x >> y;
				canh.push_back({x,i,y});
				a[i].push_back(canh.size()-1);
				a[x].push_back(canh.size()-1);
			}
			dfs(1,1);
			if(val[1] >= 0){
				cout << "YES";
			}
			else{
				cout << "NO";
			}
		}
	}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 1e5 + 1;
ll n;
ll a[N];
ll b[N];

struct Graph {
    ll par[N];
    ll ans[N];
    vec <pii> adj[N];
} graph;

void input() {
    cin >> n;
    for(ll i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for(ll i = 2; i <= n; ++i) {
        ll p; cin >> p;
        ll w; cin >> w;
        graph.adj[i].pb({p, w});
    }
}

ll dfs(ll u) {
    ll res = b[u] - a[u];
    for(pii p: graph.adj[u]) {
        ll v = p.xx;
        ll w = p.yy;
        if(graph.par[u] == v) {
            continue;
        }
        graph.par[v] = u;
        ll ret = dfs(v);
        if(inf / w < ret) {
            cout << "NO\n";
            exit(0);
        }
        res += ret * w;
        if(res > inf) {
            cout << "NO\n";
            exit(0);
        }
    }
    return res;
}

void solve() {
    cout << (dfs(1) >= 0? "YES": "NO") << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 3;
const ll N = 1e5 + 1;
ll n;
ll a[N];
ll b[N];

struct Graph {
    ll par[N];
    vec <pii> adj[N];
} graph;

void input() {
    cin >> n;
    for(ll i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for(ll i = 2; i <= n; ++i) {
        ll p; cin >> p;
        ll w; cin >> w;
        graph.adj[i].pb({p, w});
    }
}

ll dfs(ll u) {
    ll res = b[u] - a[u];
    for(pii p: graph.adj[u]) {
        ll v = p.xx;
        ll w = p.yy;
        if(graph.par[u] == v) {
            continue;
        }
        graph.par[v] = u;
        ll ret = dfs(v);
        if(inf / w < ret) {
            cout << "NO\n";
            exit(0);
        }
        res += ret * w;
        if(res > inf) {
            cout << "NO\n";
            exit(0);
        }
    }
    return res;
}

void solve() {
    cout << (dfs(1) >= 0? "YES": "NO") << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 3;
const ll N = 1e5 + 1;
ll n;
ll a[N];
ll b[N];

struct Graph {
    ll par[N];
    vec <pii> adj[N];
} graph;

void input() {
    cin >> n;
    for(ll i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for(ll i = 2; i <= n; ++i) {
        ll p; cin >> p;
        ll w; cin >> w;
        graph.adj[i].pb({p, w});
    }
}

ll dfs(ll u) {
    ll res = b[u] - a[u];
    for(pii p: graph.adj[u]) {
        ll v = p.xx;
        ll w = p.yy;
        if(graph.par[u] == v) {
            continue;
        }
        graph.par[v] = u;
        ll ret = dfs(v);
        if(ret < 0) {
            if(inf / w < -ret) {
                cout << "NO\n";
                exit(0);
            }
            res += ret * w;
            if(res < -inf) {
                cout << "NO\n";
                exit(0);
            }
        } else {
            res += ret;
        }
    }
    return res;
}

void solve() {
    cout << (dfs(1) >= 0? "YES": "NO") << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 3;
const ll N = 1e5 + 1;
ll n;
ll a[N];
ll b[N];

struct Graph {
    ll par[N];
    vec <pii> adj[N];
} graph;

void input() {
    cin >> n;
    for(ll i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for(ll i = 2; i <= n; ++i) {
        ll p; cin >> p;
        ll w; cin >> w;
        graph.adj[i].pb({p, w});
    }
}

ll dfs(ll u) {
    ll res = b[u] - a[u];
    for(pii p: graph.adj[u]) {
        ll v = p.xx;
        ll w = p.yy;
        if(graph.par[u] == v) {
            continue;
        }
        graph.par[v] = u;
        ll ret = dfs(v);
        if(ret < 0) {
            if(inf / w < -ret) {
                cout << "NO\n";
                exit(0);
            }
            res += ret * w;
            if(res > inf) {
                cout << "NO\n";
                exit(0);
            }
        } else {
            res += ret;
        }
    }
    return res;
}

void solve() {
    cout << (dfs(1) >= 0? "YES": "NO") << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 3;
const ll N = 1e5 + 1;
ll n;
ll a[N];
ll b[N];

struct Graph {
    vec <pii> adj[N];
} graph;

void input() {
    cin >> n;
    for(ll i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    for(ll i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for(ll i = 2; i <= n; ++i) {
        ll p; cin >> p;
        ll w; cin >> w;
        graph.adj[p].pb({i, w});
    }
}

ll dfs(ll u) {
    ll res = a[u] - b[u];
    for(pii p: graph.adj[u]) {
        ll v = p.xx;
        ll w = p.yy;
        ll ret = dfs(v);
        if(ret < 0) {
            if(inf / w < -ret) {
                cout << "NO\n";
                exit(0);
            }
            res += ret * w;
            if(res < -inf) {
                cout << "NO\n";
                exit(0);
            }
        } else {
            res += ret;
        }
    }
    return res;
}

void solve() {
    cout << (dfs(1) >= 0? "YES": "NO") << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll oo = 1e18;

const int N = 100005;

vector<pair<int, int>> g[N];
int n;
ll b[N], a[N];

ll dfs(int u) {

	ll me = b[u] - a[u];
	for(auto [v, k] : g[u]) {
		ll tmp = dfs(v);
		if(tmp < 0) {
			if(-tmp > oo / k) {
				printf("NO\n");
				exit(0);
			}
			tmp *= k;
		}
		me += tmp;
		if(abs(me) >= oo) {
			printf("NO\n");
			exit(0);
		}
	}
	return me;
}

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; i++) scanf("%lld", b + i);
	for(int i = 1; i <= n; i++) scanf("%lld", a + i);

	for(int i = 2; i <= n; i++) {
		int x, k;
		scanf("%d %d", &x, &k);
		g[x].emplace_back(i, k);
	}

	printf("%s\n", dfs(1) >= 0 ? "YES" : "NO");

}