### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 why runtime error in test case 2 ??
Author: mohamednabil00000
ID: 060530
Problem: 146
Contest: 0
Date: 2013-12-03 19:46:14

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Solution {

public static void main(String[] args) throws IOException {

Scanner in = new Scanner(System.in);

double l = in.nextDouble();
double n = in.nextDouble();
double ans = 0;
for (int i = 0; i < (int) n; i++) {
double t = in.nextDouble();
double v = in.nextDouble();
ans = (ans % l + ((double) t % l * (double) v % l) % l) % l;

}
System.out.printf("%.4fn", ans % l);

}
}