F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Interval

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 169    Accepted Submission(s): 52


Problem Description
Alice get M sequences ordered from 1 to M. Now she rearrange the M sequences and connect them from left to right to get a new sequence. And she wanna know the sum of great common divisores of all different interval of the result sequence. She define the sum as beautiful value but it's not the answer. We can easy know there are M! different rearrangements. She want to calculate the sum of beautiful value of all rearragements. It's too difficult. So help her please. Output the answer mod 1000000007.
 

Input
The input contains multiple test cases.

For each test case, the first line contains one integer $M(1\leq M\leq 80000)$. Then followed M lines. Each line start with a integer $S(1\leq S\leq 80000)$, then followed S integers. The sum of S is not big than 80000. All integers are between 1 and 80000.
 

Output
For each test case, output the answer mod 1000000007.
 

Sample Input
2 2 1 2 1 1 1 3 1 1 1
 

Sample Output
14 6
 

Author
ZSTU
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 09:14:04, Gzip enabled