#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, int>& lhs, const pair<int, int>& rhs) {
  if (lhs.first != rhs.first) {
    return lhs.first > rhs.first;
  }
  return lhs.second < rhs.second;
}
signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  long long a, b, k;
  cin >> a >> b >> k;
  if (a % k + b % k >= k) {
    cout << a / k + b / k + 1 << " " << k - max(a % k, b % k) << endl;
  } else {
    cout << a / k + b / k << " 0\n";
  }
}
