/* -*- coding: utf-8 -*- * * 3002.cc: No.3002 螟夐・シ上・蜑イ繧顔ョ・縲彳asy縲・- yukicoder */ #include #include using namespace std; /* constant */ /* typedef */ using ll = long long; /* global variables */ /* subroutines */ /* main */ int main() { ll a, b; scanf("%lld%lld", &a, &b); b %= 3; ll u = 0, v = 0; if (b == 0) { // a=u(cost+isint)+v -> (u*cost+v-a)+u*isint=0 // -> u*cost+v-a=0, u*isint=0 // -> u=0,v=a u = 0, v = a; } else if (b == 1) { // a(cost+isint)=u(cost+isint)+v ->u*cost+v-a*cost+(u-a)isint=0 // -> u*cost+v-a*cost=0, u-a=0 // -> u=a, v=0 u = a, v = 0; } else { // a(cost-isint)=u(cost+isint)+v ->u*cost+v-a*cost+(u+a)isint=0 // -> u*cost+v-a*cost=0, u+a=0 // -> u=-a, v=2a*cost=-a (cost=-1/2) u = -a, v = -a; } printf("%lld %lld\n", u, v); return 0; }