import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

T readNum(T)(){
  return readStr.to!T;
}

T[] readNums(T)(){
  return readStr.split.to!(T[]);
}

string readStr(){
  return readln.chomp;
}

void main(){
  auto i = readNums!ulong;
  auto x = i[0];
  auto y = i[1];
  auto z = i[2];

  auto buy = (x / z) + (y / z);

  x %= z;
  y %= z;

  ulong give;
  if(x + y >= z){
    give = min(z - x, z - y);
    buy += (x + y) / z;
  }

  writeln(buy, " ", give);
}
