local ffi = require 'ffi' local C = ffi.C ffi.cdef [[ long atol(const char *); int printf(const char *, ...); ]] C.printf("%ld\n", (function (s, n) local a, b = C.atol(s:match("(%d+)%s")), C.atol(s:match("%s(%d+)")) return ((a%n) * (b%n)) % n end)(io.stdin:read("*l"), 1000000007LL))