local ffi = require 'ffi' local M = ffi.load 'gmp' ffi.cdef [[ typedef unsigned long mp_limb_t; typedef struct { int _mp_alloc; int _mp_size; mp_limb_t * _mp_d; } __mpz_struct; typedef __mpz_struct mpz_t[1]; typedef const __mpz_struct * mpz_srcptr; typedef __mpz_struct * mpz_ptr; void __gmpz_init_set_d(mpz_ptr, double); void __gmpz_divexact(mpz_ptr, mpz_srcptr, mpz_srcptr); void __gmpz_mul_si(mpz_ptr, mpz_srcptr, long); int __gmp_printf(const char *, ...); ]] M.__gmp_printf((function (f, g, x) if x==0 then return "1 0\n" end if x>31 then return "0 0\n" end return "%Zd %Zd\n", f(31,x), f(30,x-1,g) end)(function (n, r, f) local tn,tr = ffi.new("mpz_t"),ffi.new("mpz_t") M.__gmpz_init_set_d(tn,1) M.__gmpz_init_set_d(tr,1) if n-r0LL do M.__gmpz_mul_si(tn,tn,n-r) M.__gmpz_mul_si(tr,tr,r) r=r-1LL end M.__gmpz_divexact(tn,tn,tr) return f~=nil and f(tn) or tn end, function (tn) M.__gmpz_mul_si(tn,tn,2LL^31-1LL) return tn end, io.stdin:read("*n")))