Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Array and Operations

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou have written on a piece of paper an array of *n* positive integers *a*[1], *a*[2], ..., *a*[*n*] and *m* good pairs of integers (*i*_{1}, *j*_{1}), (*i*_{2}, *j*_{2}), ..., (*i*_{m}, *j*_{m}). Each good pair (*i*_{k}, *j*_{k}) meets the following conditions: *i*_{k} + *j*_{k} is an odd number and 1 ≤ *i*_{k} < *j*_{k} ≤ *n*.

In one operation you can perform a sequence of actions:

- take one of the good pairs (
*i*_{k},*j*_{k}) and some integer*v*(*v*> 1), which divides both numbers*a*[*i*_{k}] and*a*[*j*_{k}]; - divide both numbers by
*v*, i. e. perform the assignments: and .

Determine the maximum number of operations you can sequentially perform on the given array. Note that one pair may be used several times in the described operations.

Input

The first line contains two space-separated integers *n*, *m* (2 ≤ *n* ≤ 100, 1 ≤ *m* ≤ 100).

The second line contains *n* space-separated integers *a*[1], *a*[2], ..., *a*[*n*] (1 ≤ *a*[*i*] ≤ 10^{9}) — the description of the array.

The following *m* lines contain the description of good pairs. The *k*-th line contains two space-separated integers *i*_{k}, *j*_{k} (1 ≤ *i*_{k} < *j*_{k} ≤ *n*, *i*_{k} + *j*_{k} is an odd number).

It is guaranteed that all the good pairs are distinct.

Output

Output the answer for the problem.

Examples

Input

3 2

8 3 8

1 2

2 3

Output

0

Input

3 2

8 12 8

1 2

2 3

Output

2

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/22/2021 06:22:34 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|