import java.util.*; import java.io.*; class Solution { public static long sumUnderModulo(long a, long b){ long M = 1000000007; // a+b mod M = (a mod M + b mod M)mod M return (a % M + b % M)%M; } } class GFG { public static void main(String args[])throws IOException { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); //taking testcases int t = Integer.parseInt(read.readLine()); while(t-- > 0) { String[] str = read.readLine().trim().split(" "); //taking input a and b Long a = Long.parseLong(str[0]); Long b = Long.parseLong(str[1]); //calling method sumUnderModulo() System.out.println(new Solution().sumUnderModulo(a,b)); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter