Joty and Chocolate

题意翻译

Joty 有 $n$ 块瓷砖,编号为 $1,2,3,\cdots ,n$ ,Joty 可以把编号为 $a$ 的倍数的瓷砖刷成红色,同时她会得到 $p$ 块巧克力;她也可以把编号为 $b$ 的倍数的瓷砖刷成蓝色**如果这个瓷砖是 $a,b$ 的公倍 数,则她可以任选一个颜色并得到对应的巧克力报酬**,并得到 $q$ 块巧克力。 输入一行5个数据,$n,a,b,p,q$ 。 输出一个数据:表示 Joty 能得到的巧克力最多有多少?

题目描述

Little Joty has got a task to do. She has a line of $ n $ tiles indexed from $ 1 $ to $ n $ . She has to paint them in a strange pattern. An unpainted tile should be painted Red if it's index is divisible by $ a $ and an unpainted tile should be painted Blue if it's index is divisible by $ b $ . So the tile with the number divisible by $ a $ and $ b $ can be either painted Red or Blue. After her painting is done, she will get $ p $ chocolates for each tile that is painted Red and $ q $ chocolates for each tile that is painted Blue. Note that she can paint tiles in any order she wants. Given the required information, find the maximum number of chocolates Joty can get.

输入输出格式

输入格式


The only line contains five integers $ n $ , $ a $ , $ b $ , $ p $ and $ q $ ( $ 1<=n,a,b,p,q<=10^{9} $ ).

输出格式


Print the only integer $ s $ — the maximum number of chocolates Joty can get. Note that the answer can be too large, so you should use $ 64 $ -bit integer type to store it. In C++ you can use the long long integer type and in Java you can use long integer type.

输入输出样例

输入样例 #1

5 2 3 12 15

输出样例 #1

39

输入样例 #2

20 2 3 3 5

输出样例 #2

51