Back to Problem Solutions forum
package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;
public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
long result = 0;
long Sonic = 0;
final int seed = 113;
final int limit = 10000007;
boolean point = false;
while (point == false) {
String numa = reader.readLine();
long a = Integer.parseInt(numa);
if (a == -1) { point = true;}
result = (result + a) * seed;
if (result < limit) {
System.out.print(result);
}
if (result > limit) {
Sonic = result % limit;
System.out.print(Sonic);
}
}
}
}
If you have correct results from running your code, simply paste the results and the source code then click Submit. There's no need to run it on the site.