#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e6 + 2;
int a[maxn + 1], store[maxn + 1];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, first, second, sum = 0, zeros = 0, ones = 0;
  cin >> n >> k >> first;
  cout << (n + k) / first << " ";
  if ((n % first + k % first) >= first) {
    cout << (min(min(min(n % first, k % first), first - (k % first)),
                 first - (n % first)));
  } else {
    cout << "0";
  }
}
