**Pritom** is very good at math. But he get bored while finding out LCM. When the numbers are big he fall asleep some times. His teacher gave him an assignment with a list of numbers that he have to find out **LCM of those numbers starting from index 1 to index k**, called Prefix LCM. So You have to help him to find LCM of any length from an array of numbers . ***Note: LCM is the smallest positive number that is a multiple of two or more numbers.***<br> You may read details of LCM here: https://en.wikipedia.org/wiki/Least_common_multiple Input: ------ The first line of the input contains an integer **n** (**1 ≤ n ≤10**) — the total numbers in array. <br> Next **n** lines contains the sequence of integers n1, n2, ..., nth (**1 ≤ ni ≤ 25**).<br> Next line contain an integer **Q (1≤ Q ≤ n)** - the total number of queries. <br> Next **Q** lines contains a query with **k (1≤ k ≤ n)** where **k** denotes the index of the array. Output: ------- For every query with integer k, you just have to print a single integer, denoting the **LCM of numbers from index 1 to k of the given array**. Sample Input ------------ 3 2 4 5 3 1 2 3 Sample Output ------------- 2 4 20

Abdullah Al Rifat

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 1.00 |

Go | 1.00 |

Java | 1.00 |

JavaScript | 1.00 |

Objective-C | 1.00 |

Perl | 1.00 |

PHP | 1.00 |

Python | 1.00 |

Python3 | 1.00 |

Ruby | 1.00 |

VB.Net | 1.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | dmehrab06 | Cpp14 | 0.00s |

02 | njrafi | Cpp14 | 0.00s |

03 | naim2711 | Cpp14 | 0.00s |

04 | cse_nazmul | Cpp | 0.00s |

05 | kazinayeem | Cpp | 0.00s |

06 | Mohtasim | Cpp14 | 0.00s |

07 | Nirjhor | Cpp14 | 0.00s |

08 | KNUTH | Cpp | 0.00s |

09 | alhelal_cse | Cpp | 0.00s |

10 | mahbubcseju | Cpp14 | 0.00s |

11 | nuhu_iu | Cpp | 0.00s |

12 | Jakir_Hossain_Sust | Cpp14 | 0.00s |

13 | ksohan | Cpp | 0.00s |

14 | Zeronfinity | Cpp14 | 0.00s |

15 | dipta007 | Cpp14 | 0.00s |

16 | demon | Cpp | 0.00s |

17 | shailyroy | Cpp14 | 0.00s |

18 | Roll_Number_27 | Cpp | 0.00s |

19 | mtmohim | Cpp | 0.00s |

20 | Mahim007 | Cpp14 | 0.00s |

21 | zitul_mahmud | Cpp | 0.00s |

22 | Anik_Nicks | Cpp14 | 0.00s |

23 | HR_Habib | Cpp | 0.00s |

24 | sakib_ruet_13 | Cpp | 0.00s |

25 | ssavi | Cpp14 | 0.00s |

26 | badhansen123 | Cpp14 | 0.00s |

27 | skmonir | Cpp14 | 0.00s |

28 | KIRIN_36 | Cpp14 | 0.00s |

29 | loop_breaker | Cpp14 | 0.00s |

30 | Zayed | Cpp14 | 0.00s |

31 | fsshakkhor | Cpp14 | 0.00s |

32 | anikatahsin | Cpp14 | 0.00s |

33 | Trusted_Frustrated | Cpp14 | 0.00s |

34 | asad_IT | Cpp14 | 0.00s |

35 | Optimus_primeV2 | Cpp14 | 0.00s |

36 | Jisancse | Cpp14 | 0.00s |

37 | emrul | Cpp14 | 0.00s |

38 | Foysol_Ahmed | Cpp14 | 0.00s |

39 | Biprodas | Cpp | 0.00s |

40 | sazal_dev | Cpp14 | 0.00s |

41 | reshan13 | Cpp14 | 0.00s |

42 | Jahangir67 | Cpp14 | 0.00s |

43 | Nur_Alam39 | Cpp | 0.00s |

44 | shamimjucse | Cpp14 | 0.00s |

45 | reza_ul | Cpp14 | 0.00s |

46 | Masum_ice | Cpp14 | 0.00s |

47 | orpib | Cpp | 0.00s |

48 | t0whid | Cpp14 | 0.00s |

49 | Pure_Protea | Cpp14 | 0.00s |

50 | Knight_King | Cpp14 | 0.00s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(