#include <bits/stdc++.h>
using namespace std;
void solve(istream& in, ostream& out) {
  long long x, y, z;
  in >> x >> y >> z;
  long long cnt = (x + y) / z;
  x %= z;
  y %= z;
  long long t = x + y >= z ? z - max(x, y) : 0;
  out << cnt << " " << t << " " << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solve(in, out);
}
